feat: add --include flag to init commands to eliminate redundant file reads
Workflows were calling init commands to get parsed JSON metadata, then immediately reading the same files again with cat to pass raw content to agents. This wastes context tokens. Changes: - Add --include flag to init execute-phase, plan-phase, and progress - Support includes: state, config, roadmap, requirements, context, research, verification, uat, project - Update plan-phase.md to use --include (removes 6 cat calls) - Update execute-phase.md to use --include (removes 2 cat calls) - Update execute-plan.md to use --include (removes 2 cat calls) - Update progress.md to use --include (removes 4 cat calls) - Add 7 tests for --include functionality Token savings: ~5,000-10,000 tokens per plan-phase execution, ~1,500-3,000 per other workflow executions. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,14 +9,16 @@ Read all files referenced by the invoking prompt's execution_context before star
|
||||
<process>
|
||||
|
||||
<step name="init_context">
|
||||
**Load progress context:**
|
||||
**Load progress context (with file contents to avoid redundant reads):**
|
||||
|
||||
```bash
|
||||
INIT=$(node ~/.claude/get-shit-done/bin/gsd-tools.js init progress)
|
||||
INIT=$(node ~/.claude/get-shit-done/bin/gsd-tools.js init progress --include state,roadmap,project,config)
|
||||
```
|
||||
|
||||
Extract from init JSON: `project_exists`, `roadmap_exists`, `state_exists`, `phases`, `current_phase`, `next_phase`, `milestone_version`, `completed_count`, `phase_count`, `paused_at`.
|
||||
|
||||
**File contents (from --include):** `state_content`, `roadmap_content`, `project_content`, `config_content`. These are null if files don't exist.
|
||||
|
||||
If `project_exists` is false (no `.planning/` directory):
|
||||
|
||||
```
|
||||
@@ -37,13 +39,16 @@ If missing both ROADMAP.md and PROJECT.md: suggest `/gsd:new-project`.
|
||||
</step>
|
||||
|
||||
<step name="load">
|
||||
**Load full project context:**
|
||||
**Use project context from INIT:**
|
||||
|
||||
- Read `.planning/STATE.md` for living memory (position, decisions, issues)
|
||||
- Read `.planning/ROADMAP.md` for phase structure and objectives
|
||||
- Read `.planning/PROJECT.md` for current state (What This Is, Core Value, Requirements)
|
||||
- Read `.planning/config.json` for settings (model_profile, workflow toggles)
|
||||
</step>
|
||||
All file contents are already loaded via `--include` in init_context step:
|
||||
- `state_content` — living memory (position, decisions, issues)
|
||||
- `roadmap_content` — phase structure and objectives
|
||||
- `project_content` — current state (What This Is, Core Value, Requirements)
|
||||
- `config_content` — settings (model_profile, workflow toggles)
|
||||
|
||||
No additional file reads needed.
|
||||
</step>
|
||||
|
||||
<step name="recent">
|
||||
**Gather recent work context:**
|
||||
|
||||
Reference in New Issue
Block a user