Skip to content

Commit 860a49e

Browse files
mnriemCopilot
andauthored
docs: add guide for handling complex features (#3004)
* docs: add guide for handling complex features Add a Concepts page documenting strategies for dealing with large or complex features where context window exhaustion degrades agent performance during implementation. Covers limiting tasks per run, sub-agent delegation, combining both, and decomposing into smaller specs, with a guideline table for choosing an approach. Closes #2986 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * docs: address review feedback on complex features guide Use task IDs (T001-T010) instead of bare numbers to match the tasks.md template format, and add the combined scoping + delegation approach to the selection table for completeness. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * docs: align complex features guide with command naming conventions Use the full /speckit.implement command name throughout, match the command template wording ('must consider'), and use the product names GitHub Copilot CLI and the GitHub Copilot extension for VS Code. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Manfred Riem <mnriem@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 7a37102 commit 860a49e

2 files changed

Lines changed: 85 additions & 0 deletions

File tree

docs/concepts/complex-features.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Handling Complex Features
2+
3+
Large or complex features often run smoothly through `/speckit.specify`,
4+
`/speckit.plan`, and `/speckit.tasks`, then degrade during implementation. In
5+
the middle of a long `/speckit.implement` run, agents can start to lose track of
6+
the plan, ignore tasks, or hallucinate — usually right before or after context
7+
compaction is triggered.
8+
9+
The underlying cause is context window exhaustion. When a single
10+
implementation run tries to hold the entire feature in context, the model
11+
degrades as the window fills. The fix is to scope each run so it stays well
12+
within context limits.
13+
14+
The `/speckit.implement` command accepts free-form user input that the agent
15+
must consider before proceeding. This means you can scope each run without any
16+
tooling changes.
17+
18+
## Option 1: Limit How Many Tasks Run Per Invocation
19+
20+
Instead of letting `/speckit.implement` run through every task at once, tell it
21+
to stop early:
22+
23+
```text
24+
/speckit.implement only execute tasks T001-T010, then stop and report progress
25+
```
26+
27+
or scope by phase:
28+
29+
```text
30+
/speckit.implement only execute the Setup phase, then stop
31+
```
32+
33+
Because completed tasks are marked `[X]` in `tasks.md`, the next
34+
`/speckit.implement` invocation picks up where you left off. This keeps each run
35+
well within context limits.
36+
37+
## Option 2: Instruct the Agent to Use Sub-Agents
38+
39+
If your coding agent supports sub-agents (for example, GitHub Copilot CLI or the
40+
GitHub Copilot extension for VS Code), you can instruct `/speckit.implement` to
41+
delegate individual tasks:
42+
43+
```text
44+
/speckit.implement delegate each parallel [P] task to a sub-agent
45+
```
46+
47+
Each sub-agent gets a focused context — one task plus the relevant plan
48+
excerpts — rather than the full feature context, so compaction never triggers
49+
in the main session.
50+
51+
## Option 3: Combine Both
52+
53+
For very large features, combine scoping and delegation:
54+
55+
```text
56+
/speckit.implement execute only the Core phase, delegate [P] tasks to sub-agents
57+
```
58+
59+
## Option 4: Decompose the Feature Into Smaller Specs
60+
61+
When even a single phase overwhelms the context, break the feature into
62+
independently specified sub-features. Each sub-feature gets its own
63+
`spec.md`, `plan.md`, and `tasks.md`, and runs through its own
64+
specify/plan/tasks/implement cycle.
65+
66+
This is the "spec of specs" approach: the first iteration breaks a massive
67+
feature into smaller, self-contained specs that can each be implemented without
68+
overwhelming the model. It adds the most overhead, so reserve it for features
69+
that are too large to handle any other way.
70+
71+
## Which Approach to Choose
72+
73+
| Approach | Best for |
74+
| --- | --- |
75+
| Limit to N tasks or a phase | Any agent; simplest; no sub-agent support needed |
76+
| Sub-agent delegation | Agents that support sub-agents; maximizes parallelism |
77+
| Combine scoping + delegation | Large features on sub-agent-capable agents; balances both |
78+
| Decompose into smaller specs | When even a single phase overwhelms the context |
79+
80+
For most cases, limiting task scope per run is the simplest fix. Reach for
81+
sub-agent delegation when your agent supports it and you want parallelism, and
82+
decompose into smaller specs only when a single phase is still too large to
83+
handle in one run.

docs/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
href: concepts/sdd.md
4444
- name: Spec Persistence Models
4545
href: concepts/spec-persistence.md
46+
- name: Handling Complex Features
47+
href: concepts/complex-features.md
4648

4749
# Development workflows
4850
- name: Development

0 commit comments

Comments
 (0)