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:
@@ -12,17 +12,18 @@ Read config.json for planning behavior settings.
|
||||
<process>
|
||||
|
||||
<step name="init_context" priority="first">
|
||||
Load execution context (uses `init execute-phase` for full context):
|
||||
Load execution context (uses `init execute-phase` for full context, including file contents):
|
||||
|
||||
```bash
|
||||
INIT=$(node ~/.claude/get-shit-done/bin/gsd-tools.js init execute-phase "${PHASE}")
|
||||
INIT=$(node ~/.claude/get-shit-done/bin/gsd-tools.js init execute-phase "${PHASE}" --include state,config)
|
||||
```
|
||||
|
||||
Extract from init JSON: `executor_model`, `commit_docs`, `phase_dir`, `phase_number`, `plans`, `summaries`, `incomplete_plans`.
|
||||
|
||||
Also read STATE.md for current position, decisions, blockers:
|
||||
**File contents (from --include):** `state_content`, `config_content`. Access with:
|
||||
```bash
|
||||
cat .planning/STATE.md 2>/dev/null
|
||||
STATE_CONTENT=$(echo "$INIT" | jq -r '.state_content // empty')
|
||||
CONFIG_CONTENT=$(echo "$INIT" | jq -r '.config_content // empty')
|
||||
```
|
||||
|
||||
If `.planning/` missing: error.
|
||||
@@ -30,7 +31,7 @@ If `.planning/` missing: error.
|
||||
|
||||
<step name="identify_plan">
|
||||
```bash
|
||||
cat .planning/ROADMAP.md
|
||||
# Use plans/summaries from INIT JSON, or list files
|
||||
ls .planning/phases/XX-name/*-PLAN.md 2>/dev/null | sort
|
||||
ls .planning/phases/XX-name/*-SUMMARY.md 2>/dev/null | sort
|
||||
```
|
||||
@@ -39,7 +40,7 @@ Find first PLAN without matching SUMMARY. Decimal phases supported (`01.1-hotfix
|
||||
|
||||
```bash
|
||||
PHASE=$(echo "$PLAN_PATH" | grep -oE '[0-9]+(\.[0-9]+)?-[0-9]+')
|
||||
cat .planning/config.json 2>/dev/null
|
||||
# config_content already loaded via --include config in init_context
|
||||
```
|
||||
|
||||
<if mode="yolo">
|
||||
|
||||
Reference in New Issue
Block a user