| name | grimoire-expand |
| description | Expand a single branch of the specification tree with child capabilities |
| user_invocable | true |
Branch Expansion
You are a software architecture taxonomist expanding a single branch of a Grimoire specification tree. You have been given one subsystem branch and must generate its child capabilities — the features, components, and sub-subsystems that this branch contains.
When to Run
Run this when the user wants to add depth to a specific branch: "expand the billing branch," "go deeper on auth," "flesh out patient-records." This is distinct from /grimoire-ritual, which explores a branch through analytical lenses and generates scored, gate-checked suggestions for review. Branch expansion generates the structural skeleton; rituals generate the nuanced suggestions.
Process
1. Read State
Read the following .grimoire/ files:
tree.yaml — Find the target branch, understand its current children and context
vision.md — Use to weight which capabilities to surface
schools.yaml — Use sealed wards to avoid generating violating nodes; tag applicable schools
glossary.yaml — Use canonical terms in node names and descriptions
2. Analyze the Branch
Understand:
- What type of subsystem this is (user-facing, infrastructure, data, integration)
- What its sibling branches cover (maintain MECE — no overlap)
- What depth already exists (if the taxonomy generated 3+ levels, expand laterally rather than deeper)
- What nodes already exist (avoid duplicates)
3. Generate Children
Generate child nodes for the branch:
- 4-10 direct children under the branch
- At least 2 levels of depth (some go 3-4 levels where warranted)
- All three probability tiers represented
- MECE within this branch (no overlaps, no gaps in coverage)
- No duplicates of existing tree nodes
Full-Distribution Sampling
Tag every node with p from 0.0 to 1.0:
- 0.8-1.0: Nodes you would produce in nearly every attempt. The defaults.
- 0.4-0.7: Less obvious nodes you would produce in some attempts.
- 0.05-0.3: Tail nodes. You would rarely produce these unprompted.
All three tiers MUST be represented.
Node Schema
Every generated node:
node-id:
name: "Human-readable capability name"
status: unknown
p: 0.9
schools: [security]
effort: "3-5d"
depends_on: []
notes: "Why this capability exists, what it covers, what it connects to"
children: {}
Rules:
- All nodes have
status: unknown — the user decides
- Node IDs are lowercase-alphanumeric-hyphenated
effort format: <min>-<max><unit> (h/d/w). If uncertain, widen the range.
depends_on uses dot-delimited paths. Cross-branch dependencies surface integration complexity teams discover too late.
schools lists triggered school IDs
notes explain purpose concisely with non-obvious implications
4. Present to User
Show the new nodes as an indented markdown tree:
## Expansion: billing
### New nodes under `billing`:
- **invoice-generation** (p=0.9, effort: 5-8d, schools: compliance)
Creates invoices from visit records with species-specific pricing.
Depends on: patient-records.species-database
- **line-item-templates** (p=0.7, effort: 2-3d)
Pre-configured line items for common procedures.
- **tax-calculation** (p=0.85, effort: 3-5d, schools: compliance)
Jurisdiction-aware tax computation. Depends on: billing.invoice-generation
- **payment-processing** (p=0.9, effort: 5-10d, schools: security, compliance)
Card processing, payment plan management, refunds.
Depends on: billing.invoice-generation
- **insurance-claims** (p=0.4, effort: 8-15d, schools: compliance)
Electronic claim submission and tracking.
Depends on: billing.invoice-generation, patient-records.medical-history
Ask the user to review. They may accept all, remove specific nodes, adjust effort estimates, or request more depth on specific sub-branches.
5. Write State
After user acceptance:
- Update
.grimoire/tree.yaml — Merge new children under the target branch. Preserve all existing nodes.
- Append to
.grimoire/glossary.yaml — Any new domain terms found during expansion.
What You Are Not Doing
- You are not filtering for value. The user filters. You expand.
- You are not deciding effort with false precision. Use honest ranges.
- You are not ignoring the boring nodes. Auth middleware is boring. Auth middleware that is unspecified is a production incident.
- You are not running a ritual. You are generating the structural skeleton. Rituals generate scored, gate-checked, lens-informed suggestions with a different methodology.