Skip to main content

Overview

Large engineering problems rarely arrive with clear boundaries. When building something new—especially integrating with unfamiliar systems—you often don’t know what you don’t know. This guide demonstrates how to use sudocode’s hierarchical spec system to progressively decompose ambiguous problems into smaller specifications. The pattern:
  1. Start by discussing your problem statement and design constraints with the agent
  2. Use the agent to conduct initial research and planning, and create a spec that captures the overall plan
  3. Discuss the spec with your agent to surface unknowns
  4. Identify areas of ambiguity through Q&A
  5. Carve out a sub-specification for scoped investigation of ambiguities
  6. Design experiments to validate assumptions
  7. Link discoveries back to original spec, using sub-spec as documentation for disambiguations and implementations

Example: Building a Coder Server API Wrapper

We’ll walk through building a wrapper API for coder-server, an open-source VS Code in the browser. Specifically, we need to understand how authentication flows work—both OpenID Connect sharing and GitHub authentication—across our wrapper API and the underlying coder server. This is a perfect case for spec breakdown because:
  • The integration surface is unclear
  • Authentication flows span multiple systems
  • We need to discover how the existing system works before designing our wrapper

Phase 1: Initial Discussion & Spec Creation

Before creating any artifacts, start with a conversation to understand the problem space. The agent conducts research and presents learnings to the user. Step 1: Discuss the problem and constraints Via the sudocode web server at localhost:3000/executions, or in your agent CLI (with the sudocode MCP enabled), start a conversation with the agent to discuss your problem and constraints.
Step 2: Agent creates the initial spec
The spec captures the API surface and explicitly lists Open Questions—unknowns are first-class content. Review the spec in the web UI at localhost:3000. Navigate to the Specs page to see the rendered markdown, review the structure, and make any edits before continuing.
Viewing and editing the spec in the web UI

Phase 2: Surfacing Unknowns

With a spec in place, discuss it to probe deeper. The goal is to identify which unknowns are blocking and need focused investigation. Step 3: Discuss the spec to surface unknowns
Step 4: Identify specific ambiguities to investigate
This discussion identified two competing architectural approaches that need investigation before we can proceed.

Phase 3: Carving Out Sub-Specs

Here’s where hierarchical specs shine. Instead of trying to resolve ambiguity in the parent spec, you carve out focused sub-specs to investigate specific unknowns. Each sub-spec isolates one area of ambiguity for deep investigation. Step 5: Carve out an investigation sub-spec
Create sub-specs for alternative approaches too:
Now we have a clear structure:

Phase 4: Designing & Running Experiments

With sub-specs carved out, design concrete experiments to validate assumptions. Each experiment should have a clear goal, method, and success criteria. Execute experiments as issues linked to the sub-spec. Step 6: Execute experiments as issues
Capture findings as feedback on the sub-spec:

Phase 5: Linking Back

After experiments complete, link discoveries back to the original spec. The sub-spec becomes permanent documentation of what was investigated and decided. Update the parent spec with the architectural decision. Step 7: Update sub-spec with findings and link back to parent
Update parent spec with the architectural decision:
┌─────────────┐ ┌─────────────┐ ┌──────────────┐ │ Browser │────▶│ Our Platform │────▶│ Coder-Server │ └─────────────┘ └─────────────┘ └──────────────┘ │ │ │ │ GitHub OAuth │ Shared OIDC │ └──────────────────▶│◀───────────────────┘ (same token)

The Breakdown Pattern Summary

1

1. Discuss Problem & Constraints

Start with conversation before creating artifacts. Understand the problem space, constraints, and what needs to be figured out.
2

2. Create Initial Spec

Agent conducts research and creates a spec capturing the overall plan. Explicitly list open questions—unknowns are first-class content.
3

3. Surface Unknowns

Discuss the spec to probe deeper. Identify which unknowns are blocking vs. minor details.
4

4. Identify Ambiguities

Through Q&A, pinpoint specific areas that need investigation before you can commit to an approach.
5

5. Carve Out Sub-Specs

Create focused child specs to investigate specific unknowns. Each sub-spec isolates one area of ambiguity with clear questions and experiments.
6

6. Design & Run Experiments

Execute experiments as issues linked to sub-specs. Capture findings as feedback on the sub-spec.
7

7. Link Back

Update sub-specs with conclusions. Bubble up the architectural decision to the parent spec. Sub-specs become documentation of what was investigated.

When to Use This Pattern

This breakdown pattern works well when:
  • Integrating with unfamiliar systems - You need to discover how they work
  • Facing architectural forks - Multiple valid approaches need evaluation
  • Requirements are unclear - The problem space needs exploration
  • Risk is high - Wrong decisions are expensive to reverse
The goal isn’t to plan everything upfront. It’s to discover what you need to know before committing to an implementation path.

Best Practices

Don’t pretend you know more than you do. “Open Questions” and “TBD” sections are valuable—they make unknowns visible and trackable.
Each experiment should have:
  • A specific question it answers
  • A concrete method to execute
  • Clear criteria for what “success” looks like
Each sub-spec should investigate one area of ambiguity. If you find yourself with compound questions, split into multiple sub-specs.
When you choose one approach over another, archive the unchosen sub-spec rather than deleting it. It documents the decision rationale.

Spec-Driven Development

The complete SDD workflow

Specs Concept

Deep dive into specifications

Workflows

Designing and running workflows