gsd-opencode 1.30.0 → 1.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/agents/gsd-debugger.md +0 -1
  2. package/agents/gsd-doc-verifier.md +207 -0
  3. package/agents/gsd-doc-writer.md +608 -0
  4. package/agents/gsd-executor.md +22 -1
  5. package/agents/gsd-phase-researcher.md +41 -0
  6. package/agents/gsd-plan-checker.md +82 -0
  7. package/agents/gsd-planner.md +123 -194
  8. package/agents/gsd-security-auditor.md +129 -0
  9. package/agents/gsd-ui-auditor.md +40 -0
  10. package/agents/gsd-user-profiler.md +2 -2
  11. package/agents/gsd-verifier.md +84 -18
  12. package/commands/gsd/gsd-add-backlog.md +1 -1
  13. package/commands/gsd/gsd-analyze-dependencies.md +34 -0
  14. package/commands/gsd/gsd-autonomous.md +6 -2
  15. package/commands/gsd/gsd-cleanup.md +5 -0
  16. package/commands/gsd/gsd-debug.md +24 -21
  17. package/commands/gsd/gsd-discuss-phase.md +7 -2
  18. package/commands/gsd/gsd-docs-update.md +48 -0
  19. package/commands/gsd/gsd-execute-phase.md +4 -0
  20. package/commands/gsd/gsd-help.md +2 -0
  21. package/commands/gsd/gsd-join-discord.md +2 -1
  22. package/commands/gsd/gsd-manager.md +1 -0
  23. package/commands/gsd/gsd-new-project.md +4 -0
  24. package/commands/gsd/gsd-plan-phase.md +5 -0
  25. package/commands/gsd/gsd-quick.md +5 -3
  26. package/commands/gsd/gsd-reapply-patches.md +171 -39
  27. package/commands/gsd/gsd-research-phase.md +2 -12
  28. package/commands/gsd/gsd-review-backlog.md +1 -0
  29. package/commands/gsd/gsd-review.md +3 -2
  30. package/commands/gsd/gsd-secure-phase.md +35 -0
  31. package/commands/gsd/gsd-thread.md +1 -1
  32. package/commands/gsd/gsd-workstreams.md +7 -2
  33. package/get-shit-done/bin/gsd-tools.cjs +42 -8
  34. package/get-shit-done/bin/lib/commands.cjs +68 -14
  35. package/get-shit-done/bin/lib/config.cjs +18 -10
  36. package/get-shit-done/bin/lib/core.cjs +383 -80
  37. package/get-shit-done/bin/lib/docs.cjs +267 -0
  38. package/get-shit-done/bin/lib/frontmatter.cjs +47 -2
  39. package/get-shit-done/bin/lib/init.cjs +85 -5
  40. package/get-shit-done/bin/lib/milestone.cjs +21 -0
  41. package/get-shit-done/bin/lib/model-profiles.cjs +2 -0
  42. package/get-shit-done/bin/lib/phase.cjs +232 -189
  43. package/get-shit-done/bin/lib/profile-output.cjs +97 -1
  44. package/get-shit-done/bin/lib/roadmap.cjs +137 -113
  45. package/get-shit-done/bin/lib/schema-detect.cjs +238 -0
  46. package/get-shit-done/bin/lib/security.cjs +5 -3
  47. package/get-shit-done/bin/lib/state.cjs +366 -44
  48. package/get-shit-done/bin/lib/verify.cjs +158 -14
  49. package/get-shit-done/bin/lib/workstream.cjs +6 -2
  50. package/get-shit-done/references/agent-contracts.md +79 -0
  51. package/get-shit-done/references/artifact-types.md +113 -0
  52. package/get-shit-done/references/context-budget.md +49 -0
  53. package/get-shit-done/references/continuation-format.md +15 -15
  54. package/get-shit-done/references/domain-probes.md +125 -0
  55. package/get-shit-done/references/gate-prompts.md +100 -0
  56. package/get-shit-done/references/model-profiles.md +2 -2
  57. package/get-shit-done/references/planner-gap-closure.md +62 -0
  58. package/get-shit-done/references/planner-reviews.md +39 -0
  59. package/get-shit-done/references/planner-revision.md +87 -0
  60. package/get-shit-done/references/planning-config.md +15 -0
  61. package/get-shit-done/references/revision-loop.md +97 -0
  62. package/get-shit-done/references/ui-brand.md +2 -2
  63. package/get-shit-done/references/universal-anti-patterns.md +58 -0
  64. package/get-shit-done/references/workstream-flag.md +56 -3
  65. package/get-shit-done/templates/SECURITY.md +61 -0
  66. package/get-shit-done/templates/VALIDATION.md +3 -3
  67. package/get-shit-done/templates/claude-md.md +27 -4
  68. package/get-shit-done/templates/config.json +4 -0
  69. package/get-shit-done/templates/debug-subagent-prompt.md +2 -6
  70. package/get-shit-done/templates/planner-subagent-prompt.md +2 -10
  71. package/get-shit-done/workflows/add-phase.md +2 -2
  72. package/get-shit-done/workflows/add-todo.md +1 -1
  73. package/get-shit-done/workflows/analyze-dependencies.md +96 -0
  74. package/get-shit-done/workflows/audit-milestone.md +8 -12
  75. package/get-shit-done/workflows/autonomous.md +158 -13
  76. package/get-shit-done/workflows/check-todos.md +2 -2
  77. package/get-shit-done/workflows/complete-milestone.md +13 -4
  78. package/get-shit-done/workflows/diagnose-issues.md +8 -6
  79. package/get-shit-done/workflows/discovery-phase.md +1 -1
  80. package/get-shit-done/workflows/discuss-phase-assumptions.md +22 -4
  81. package/get-shit-done/workflows/discuss-phase-power.md +291 -0
  82. package/get-shit-done/workflows/discuss-phase.md +149 -11
  83. package/get-shit-done/workflows/docs-update.md +1093 -0
  84. package/get-shit-done/workflows/execute-phase.md +362 -66
  85. package/get-shit-done/workflows/execute-plan.md +1 -1
  86. package/get-shit-done/workflows/help.md +9 -6
  87. package/get-shit-done/workflows/insert-phase.md +2 -2
  88. package/get-shit-done/workflows/manager.md +27 -26
  89. package/get-shit-done/workflows/map-codebase.md +10 -32
  90. package/get-shit-done/workflows/new-milestone.md +14 -8
  91. package/get-shit-done/workflows/new-project.md +48 -25
  92. package/get-shit-done/workflows/next.md +1 -1
  93. package/get-shit-done/workflows/note.md +1 -1
  94. package/get-shit-done/workflows/pause-work.md +73 -10
  95. package/get-shit-done/workflows/plan-milestone-gaps.md +2 -2
  96. package/get-shit-done/workflows/plan-phase.md +184 -32
  97. package/get-shit-done/workflows/progress.md +20 -20
  98. package/get-shit-done/workflows/quick.md +102 -84
  99. package/get-shit-done/workflows/research-phase.md +2 -6
  100. package/get-shit-done/workflows/resume-project.md +4 -4
  101. package/get-shit-done/workflows/review.md +56 -3
  102. package/get-shit-done/workflows/secure-phase.md +154 -0
  103. package/get-shit-done/workflows/settings.md +13 -2
  104. package/get-shit-done/workflows/ship.md +13 -4
  105. package/get-shit-done/workflows/transition.md +6 -6
  106. package/get-shit-done/workflows/ui-phase.md +4 -14
  107. package/get-shit-done/workflows/ui-review.md +25 -7
  108. package/get-shit-done/workflows/update.md +165 -16
  109. package/get-shit-done/workflows/validate-phase.md +1 -11
  110. package/get-shit-done/workflows/verify-phase.md +127 -6
  111. package/get-shit-done/workflows/verify-work.md +69 -21
  112. package/package.json +1 -1
@@ -5,7 +5,7 @@
5
5
  const fs = require('fs');
6
6
  const path = require('path');
7
7
  const os = require('os');
8
- const { safeReadFile, loadConfig, normalizePhaseName, execGit, findPhaseInternal, getMilestoneInfo, stripShippedMilestones, extractCurrentMilestone, planningDir, planningRoot, output, error, checkAgentsInstalled } = require('./core.cjs');
8
+ const { safeReadFile, loadConfig, normalizePhaseName, escapeRegex, execGit, findPhaseInternal, getMilestoneInfo, stripShippedMilestones, extractCurrentMilestone, planningDir, planningRoot, output, error, checkAgentsInstalled, CONFIG_DEFAULTS } = require('./core.cjs');
9
9
  const { extractFrontmatter, parseMustHavesBlock } = require('./frontmatter.cjs');
10
10
  const { writeStateMd } = require('./state.cjs');
11
11
 
@@ -757,6 +757,71 @@ function cmdValidateHealth(cwd, options, raw) {
757
757
  }
758
758
  }
759
759
 
760
+ // ─── Check 9: STATE.md / ROADMAP.md cross-validation ─────────────────────
761
+ if (fs.existsSync(statePath) && fs.existsSync(roadmapPath)) {
762
+ try {
763
+ const stateContent = fs.readFileSync(statePath, 'utf-8');
764
+ const roadmapContentFull = fs.readFileSync(roadmapPath, 'utf-8');
765
+
766
+ // Extract current phase from STATE.md
767
+ const currentPhaseMatch = stateContent.match(/\*\*Current Phase:\*\*\s*(\S+)/i) ||
768
+ stateContent.match(/Current Phase:\s*(\S+)/i);
769
+ if (currentPhaseMatch) {
770
+ const statePhase = currentPhaseMatch[1].replace(/^0+/, '');
771
+ // Check if ROADMAP shows this phase as already complete
772
+ const phaseCheckboxRe = new RegExp(`-\\s*\\[x\\].*Phase\\s+0*${escapeRegex(statePhase)}[:\\s]`, 'i');
773
+ if (phaseCheckboxRe.test(roadmapContentFull)) {
774
+ // STATE says "current" but ROADMAP says "complete" — divergence
775
+ const stateStatus = stateContent.match(/\*\*Status:\*\*\s*(.+)/i);
776
+ const statusVal = stateStatus ? stateStatus[1].trim().toLowerCase() : '';
777
+ if (statusVal !== 'complete' && statusVal !== 'done') {
778
+ addIssue('warning', 'W011',
779
+ `STATE.md says current phase is ${statePhase} (status: ${statusVal || 'unknown'}) but ROADMAP.md shows it as [x] complete — state files may be out of sync`,
780
+ 'Run /gsd-progress to re-derive current position, or manually update STATE.md');
781
+ }
782
+ }
783
+ }
784
+ } catch { /* intentionally empty — cross-validation is advisory */ }
785
+ }
786
+
787
+ // ─── Check 10: Config field validation ────────────────────────────────────
788
+ if (fs.existsSync(configPath)) {
789
+ try {
790
+ const configRaw = fs.readFileSync(configPath, 'utf-8');
791
+ const configParsed = JSON.parse(configRaw);
792
+
793
+ // Validate branching_strategy
794
+ const validStrategies = ['none', 'phase', 'milestone'];
795
+ if (configParsed.branching_strategy && !validStrategies.includes(configParsed.branching_strategy)) {
796
+ addIssue('warning', 'W012',
797
+ `config.json: invalid branching_strategy "${configParsed.branching_strategy}"`,
798
+ `Valid values: ${validStrategies.join(', ')}`);
799
+ }
800
+
801
+ // Validate context_window is a positive integer
802
+ if (configParsed.context_window !== undefined) {
803
+ const cw = configParsed.context_window;
804
+ if (typeof cw !== 'number' || cw <= 0 || !Number.isInteger(cw)) {
805
+ addIssue('warning', 'W013',
806
+ `config.json: context_window should be a positive integer, got "${cw}"`,
807
+ 'Set to 200000 (default) or 1000000 (for 1M models)');
808
+ }
809
+ }
810
+
811
+ // Validate branch templates have required placeholders
812
+ if (configParsed.phase_branch_template && !configParsed.phase_branch_template.includes('{phase}')) {
813
+ addIssue('warning', 'W014',
814
+ 'config.json: phase_branch_template missing {phase} placeholder',
815
+ 'Template must include {phase} for phase number substitution');
816
+ }
817
+ if (configParsed.milestone_branch_template && !configParsed.milestone_branch_template.includes('{milestone}')) {
818
+ addIssue('warning', 'W015',
819
+ 'config.json: milestone_branch_template missing {milestone} placeholder',
820
+ 'Template must include {milestone} for version substitution');
821
+ }
822
+ } catch { /* parse error already caught in Check 5 */ }
823
+ }
824
+
760
825
  // ─── Perform repairs if requested ─────────────────────────────────────────
761
826
  const repairActions = [];
762
827
  if (options.repair && repairs.length > 0) {
@@ -766,21 +831,21 @@ function cmdValidateHealth(cwd, options, raw) {
766
831
  case 'createConfig':
767
832
  case 'resetConfig': {
768
833
  const defaults = {
769
- model_profile: 'balanced',
770
- commit_docs: true,
771
- search_gitignored: false,
772
- branching_strategy: 'none',
773
- phase_branch_template: 'gsd/phase-{phase}-{slug}',
774
- milestone_branch_template: 'gsd/{milestone}-{slug}',
775
- quick_branch_template: null,
834
+ model_profile: CONFIG_DEFAULTS.model_profile,
835
+ commit_docs: CONFIG_DEFAULTS.commit_docs,
836
+ search_gitignored: CONFIG_DEFAULTS.search_gitignored,
837
+ branching_strategy: CONFIG_DEFAULTS.branching_strategy,
838
+ phase_branch_template: CONFIG_DEFAULTS.phase_branch_template,
839
+ milestone_branch_template: CONFIG_DEFAULTS.milestone_branch_template,
840
+ quick_branch_template: CONFIG_DEFAULTS.quick_branch_template,
776
841
  workflow: {
777
- research: true,
778
- plan_check: true,
779
- verifier: true,
780
- nyquist_validation: true,
842
+ research: CONFIG_DEFAULTS.research,
843
+ plan_check: CONFIG_DEFAULTS.plan_checker,
844
+ verifier: CONFIG_DEFAULTS.verifier,
845
+ nyquist_validation: CONFIG_DEFAULTS.nyquist_validation,
781
846
  },
782
- parallelization: true,
783
- brave_search: false,
847
+ parallelization: CONFIG_DEFAULTS.parallelization,
848
+ brave_search: CONFIG_DEFAULTS.brave_search,
784
849
  };
785
850
  fs.writeFileSync(configPath, JSON.stringify(defaults, null, 2), 'utf-8');
786
851
  repairActions.push({ action: repair, success: true, path: 'config.json' });
@@ -874,6 +939,84 @@ function cmdValidateAgents(cwd, raw) {
874
939
  }, raw);
875
940
  }
876
941
 
942
+ // ─── Schema Drift Detection ──────────────────────────────────────────────────
943
+
944
+ function cmdVerifySchemaDrift(cwd, phaseArg, skipFlag, raw) {
945
+ const { detectSchemaFiles, checkSchemaDrift } = require('./schema-detect.cjs');
946
+
947
+ if (!phaseArg) {
948
+ error('Usage: verify schema-drift <phase> [--skip]');
949
+ return;
950
+ }
951
+
952
+ // Find phase directory
953
+ const pDir = planningDir(cwd);
954
+ const phasesDir = path.join(pDir, 'phases');
955
+ if (!fs.existsSync(phasesDir)) {
956
+ output({ drift_detected: false, blocking: false, message: 'No phases directory' }, raw);
957
+ return;
958
+ }
959
+
960
+ // Find matching phase directory
961
+ let phaseDir = null;
962
+ const entries = fs.readdirSync(phasesDir, { withFileTypes: true });
963
+ for (const entry of entries) {
964
+ if (entry.isDirectory() && entry.name.includes(phaseArg)) {
965
+ phaseDir = path.join(phasesDir, entry.name);
966
+ break;
967
+ }
968
+ }
969
+
970
+ // Also try exact match
971
+ if (!phaseDir) {
972
+ const exact = path.join(phasesDir, phaseArg);
973
+ if (fs.existsSync(exact)) phaseDir = exact;
974
+ }
975
+
976
+ if (!phaseDir) {
977
+ output({ drift_detected: false, blocking: false, message: `Phase directory not found: ${phaseArg}` }, raw);
978
+ return;
979
+ }
980
+
981
+ // Collect files_modified from all PLAN.md files in the phase
982
+ const allFiles = [];
983
+ const planFiles = fs.readdirSync(phaseDir).filter(f => f.endsWith('-PLAN.md'));
984
+ for (const pf of planFiles) {
985
+ const content = fs.readFileSync(path.join(phaseDir, pf), 'utf-8');
986
+ // Extract files_modified from frontmatter
987
+ const fmMatch = content.match(/files_modified:\s*\[([^\]]*)\]/);
988
+ if (fmMatch) {
989
+ const files = fmMatch[1].split(',').map(f => f.trim()).filter(Boolean);
990
+ allFiles.push(...files);
991
+ }
992
+ }
993
+
994
+ // Collect execution log from SUMMARY.md files
995
+ let executionLog = '';
996
+ const summaryFiles = fs.readdirSync(phaseDir).filter(f => f.endsWith('-SUMMARY.md'));
997
+ for (const sf of summaryFiles) {
998
+ executionLog += fs.readFileSync(path.join(phaseDir, sf), 'utf-8') + '\n';
999
+ }
1000
+
1001
+ // Also check git commit messages for push evidence
1002
+ const gitLog = execGit(cwd, ['log', '--oneline', '--all', '-50']);
1003
+ if (gitLog.exitCode === 0) {
1004
+ executionLog += '\n' + gitLog.stdout;
1005
+ }
1006
+
1007
+ const result = checkSchemaDrift(allFiles, executionLog, { skipCheck: !!skipFlag });
1008
+
1009
+ output({
1010
+ drift_detected: result.driftDetected,
1011
+ blocking: result.blocking,
1012
+ schema_files: result.schemaFiles,
1013
+ orms: result.orms,
1014
+ unpushed_orms: result.unpushedOrms,
1015
+ message: result.message,
1016
+ skipped: result.skipped || false,
1017
+ }, raw);
1018
+ }
1019
+
877
1020
  module.exports = {
878
1021
  cmdVerifySummary,
879
1022
  cmdVerifyPlanStructure,
@@ -885,4 +1028,5 @@ module.exports = {
885
1028
  cmdValidateConsistency,
886
1029
  cmdValidateHealth,
887
1030
  cmdValidateAgents,
1031
+ cmdVerifySchemaDrift,
888
1032
  };
@@ -339,9 +339,13 @@ function cmdWorkstreamComplete(cwd, name, options, raw) {
339
339
  // ─── Active Workstream Commands ──────────────────────────────────────────────
340
340
 
341
341
  function cmdWorkstreamSet(cwd, name, raw) {
342
- if (!name) {
342
+ if (!name || name === '--clear') {
343
+ if (name !== '--clear') {
344
+ error('Workstream name required. Usage: workstream set <name> (or workstream set --clear to unset)');
345
+ }
346
+ const previous = getActiveWorkstream(cwd);
343
347
  setActiveWorkstream(cwd, null);
344
- output({ active: null, cleared: true }, raw);
348
+ output({ active: null, cleared: true, previous: previous || null }, raw);
345
349
  return;
346
350
  }
347
351
 
@@ -0,0 +1,79 @@
1
+ # Agent Contracts
2
+
3
+ Completion markers and handoff schemas for all GSD agents. Workflows use these markers to detect agent completion and route accordingly.
4
+
5
+ This doc describes what IS, not what should be. Casing inconsistencies are documented as they appear in agent source files.
6
+
7
+ ---
8
+
9
+ ## Agent Registry
10
+
11
+ | Agent | Role | Completion Markers |
12
+ |-------|------|--------------------|
13
+ | gsd-planner | Plan creation | `## PLANNING COMPLETE` |
14
+ | gsd-executor | Plan execution | `## PLAN COMPLETE`, `## CHECKPOINT REACHED` |
15
+ | gsd-phase-researcher | Phase-scoped research | `## RESEARCH COMPLETE`, `## RESEARCH BLOCKED` |
16
+ | gsd-project-researcher | Project-wide research | `## RESEARCH COMPLETE`, `## RESEARCH BLOCKED` |
17
+ | gsd-plan-checker | Plan validation | `## VERIFICATION PASSED`, `## ISSUES FOUND` |
18
+ | gsd-research-synthesizer | Multi-research synthesis | `## SYNTHESIS COMPLETE`, `## SYNTHESIS BLOCKED` |
19
+ | gsd-debugger | Debug investigation | `## DEBUG COMPLETE`, `## ROOT CAUSE FOUND`, `## CHECKPOINT REACHED` |
20
+ | gsd-roadmapper | Roadmap creation/revision | `## ROADMAP CREATED`, `## ROADMAP REVISED`, `## ROADMAP BLOCKED` |
21
+ | gsd-ui-auditor | UI review | `## UI REVIEW COMPLETE` |
22
+ | gsd-ui-checker | UI validation | `## ISSUES FOUND` |
23
+ | gsd-ui-researcher | UI spec creation | `## UI-SPEC COMPLETE`, `## UI-SPEC BLOCKED` |
24
+ | gsd-verifier | Post-execution verification | `## Verification Complete` (title case) |
25
+ | gsd-integration-checker | Cross-phase integration check | `## Integration Check Complete` (title case) |
26
+ | gsd-nyquist-auditor | Sampling audit | `## PARTIAL`, `## ESCALATE` (non-standard) |
27
+ | gsd-security-auditor | Security audit | `## OPEN_THREATS`, `## ESCALATE` (non-standard) |
28
+ | gsd-codebase-mapper | Codebase analysis | No marker (writes docs directly) |
29
+ | gsd-assumptions-analyzer | Assumption extraction | No marker (returns `## Assumptions` sections) |
30
+ | gsd-doc-verifier | Doc validation | No marker (writes JSON to `.planning/tmp/`) |
31
+ | gsd-doc-writer | Doc generation | No marker (writes docs directly) |
32
+ | gsd-advisor-researcher | Advisory research | No marker (utility agent) |
33
+ | gsd-user-profiler | User profiling | No marker (returns JSON in analysis tags) |
34
+ | gsd-intel-updater | Codebase intelligence analysis | `## INTEL UPDATE COMPLETE`, `## INTEL UPDATE FAILED` |
35
+
36
+ ## Marker Rules
37
+
38
+ 1. **ALL-CAPS markers** (e.g., `## PLANNING COMPLETE`) are the standard convention
39
+ 2. **Title-case markers** (e.g., `## Verification Complete`) exist in gsd-verifier and gsd-integration-checker -- these are intentional as-is, not bugs
40
+ 3. **Non-standard markers** (e.g., `## PARTIAL`, `## ESCALATE`) in audit agents indicate partial results requiring orchestrator judgment
41
+ 4. **Agents without markers** either write artifacts directly to disk or return structured data (JSON/sections) that the caller parses
42
+ 5. Markers must appear as H2 headings (`## `) at the start of a line in the agent's final output
43
+
44
+ ## Key Handoff Contracts
45
+
46
+ ### Planner -> Executor (via PLAN.md)
47
+
48
+ | Field | Required | Description |
49
+ |-------|----------|-------------|
50
+ | Frontmatter | Yes | phase, plan, type, wave, depends_on, files_modified, autonomous, requirements |
51
+ | `<objective>` | Yes | What the plan achieves |
52
+ | `<tasks>` | Yes | Ordered task list with type, files, action, verify, acceptance_criteria |
53
+ | `<verification>` | Yes | Overall verification steps |
54
+ | `<success_criteria>` | Yes | Measurable completion criteria |
55
+
56
+ ### Executor -> Verifier (via SUMMARY.md)
57
+
58
+ | Field | Required | Description |
59
+ |-------|----------|-------------|
60
+ | Frontmatter | Yes | phase, plan, subsystem, tags, key-files, metrics |
61
+ | Commits table | Yes | Per-task commit hashes and descriptions |
62
+ | Deviations section | Yes | Auto-fixed issues or "None" |
63
+ | Self-Check | Yes | PASSED or FAILED with details |
64
+
65
+ ## Workflow Regex Patterns
66
+
67
+ Workflows match these markers to detect agent completion:
68
+
69
+ **plan-phase.md matches:**
70
+ - `## RESEARCH COMPLETE` / `## RESEARCH BLOCKED` (researcher output)
71
+ - `## PLANNING COMPLETE` (planner output)
72
+ - `## CHECKPOINT REACHED` (planner/executor pause)
73
+ - `## VERIFICATION PASSED` / `## ISSUES FOUND` (plan-checker output)
74
+
75
+ **execute-phase.md matches:**
76
+ - `## PHASE COMPLETE` (all plans in phase done)
77
+ - `## Self-Check: FAILED` (summary self-check)
78
+
79
+ > **NOTE:** `## PLAN COMPLETE` is the gsd-executor's completion marker but execute-phase.md does not regex-match it. Instead, it detects executor completion via spot-checks (SUMMARY.md existence, git commit state). This is intentional behavior, not a mismatch.
@@ -0,0 +1,113 @@
1
+ # GSD Artifact Types
2
+
3
+ This reference documents all artifact types in the GSD planning taxonomy. Each type has a defined
4
+ shape, lifecycle, location, and consumption mechanism. A well-formatted artifact that no workflow
5
+ reads is inert — the consumption mechanism is what gives an artifact meaning.
6
+
7
+ ---
8
+
9
+ ## Core Artifacts
10
+
11
+ ### ROADMAP.md
12
+ - **Shape**: Milestone + phase listing with goals and canonical refs
13
+ - **Lifecycle**: Created → Updated per milestone → Archived
14
+ - **Location**: `.planning/ROADMAP.md`
15
+ - **Consumed by**: `plan-phase`, `discuss-phase`, `execute-phase`, `progress`, `state` commands
16
+
17
+ ### STATE.md
18
+ - **Shape**: Current position tracker (phase, plan, progress, decisions)
19
+ - **Lifecycle**: Continuously updated throughout the project
20
+ - **Location**: `.planning/STATE.md`
21
+ - **Consumed by**: All orchestration workflows; `resume-project`, `progress`, `next` commands
22
+
23
+ ### REQUIREMENTS.md
24
+ - **Shape**: Numbered acceptance criteria with traceability table
25
+ - **Lifecycle**: Created at project start → Updated as requirements are satisfied
26
+ - **Location**: `.planning/REQUIREMENTS.md`
27
+ - **Consumed by**: `discuss-phase`, `plan-phase`, CONTEXT.md generation; executor marks complete
28
+
29
+ ### CONTEXT.md (per-phase)
30
+ - **Shape**: 6-section format: domain, decisions, canonical_refs, code_context, specifics, deferred
31
+ - **Lifecycle**: Created before planning → Used during planning and execution → Superseded by next phase
32
+ - **Location**: `.planning/phases/XX-name/XX-CONTEXT.md`
33
+ - **Consumed by**: `plan-phase` (reads decisions), `execute-phase` (reads code_context and canonical_refs)
34
+
35
+ ### PLAN.md (per-plan)
36
+ - **Shape**: Frontmatter + objective + tasks with types + success criteria + output spec
37
+ - **Lifecycle**: Created by planner → Executed → SUMMARY.md produced
38
+ - **Location**: `.planning/phases/XX-name/XX-YY-PLAN.md`
39
+ - **Consumed by**: `execute-phase` executor; task commits reference plan IDs
40
+
41
+ ### SUMMARY.md (per-plan)
42
+ - **Shape**: Frontmatter with dependency graph + narrative + deviations + self-check
43
+ - **Lifecycle**: Created at plan completion → read by subsequent plans in same phase
44
+ - **Location**: `.planning/phases/XX-name/XX-YY-SUMMARY.md`
45
+ - **Consumed by**: Orchestrator (progress), planner (context for future plans), `milestone-summary`
46
+
47
+ ### HANDOFF.json / .continue-here.md
48
+ - **Shape**: Structured pause state (JSON machine-readable + Markdown human-readable)
49
+ - **Lifecycle**: Created on pause → Consumed on resume → Replaced by next pause
50
+ - **Location**: `.planning/HANDOFF.json` + `.planning/phases/XX-name/.continue-here.md` (or spike/deliberation path)
51
+ - **Consumed by**: `resume-project` workflow
52
+
53
+ ---
54
+
55
+ ## Extended Artifacts
56
+
57
+ ### DISCUSSION-LOG.md (per-phase)
58
+ - **Shape**: Audit trail of assumptions and corrections from discuss-phase
59
+ - **Lifecycle**: Created at discussion time → read-only audit record
60
+ - **Location**: `.planning/phases/XX-name/XX-DISCUSSION-LOG.md`
61
+ - **Consumed by**: Human review; not read by automated workflows
62
+
63
+ ### USER-PROFILE.md
64
+ - **Shape**: Calibration tier and preferences profile
65
+ - **Lifecycle**: Created by `profile-user` → Updated as preferences are observed
66
+ - **Location**: `$HOME/.config/opencode/get-shit-done/USER-PROFILE.md`
67
+ - **Consumed by**: `discuss-phase-assumptions` (calibration tier), `plan-phase`
68
+
69
+ ### SPIKE.md / DESIGN.md (per-spike)
70
+ - **Shape**: Research question + methodology + findings + recommendation
71
+ - **Lifecycle**: Created → Investigated → Decided → Archived
72
+ - **Location**: `.planning/spikes/SPIKE-NNN/`
73
+ - **Consumed by**: Planner when spike is referenced; `pause-work` for spike context handoff
74
+
75
+ ---
76
+
77
+ ## Standing Reference Artifacts
78
+
79
+ ### METHODOLOGY.md
80
+
81
+ - **Shape**: Standing reference — reusable interpretive frameworks (lenses) that apply across phases
82
+ - **Lifecycle**: Created → Active → Superseded (when a lens is replaced by a better one)
83
+ - **Location**: `.planning/METHODOLOGY.md` (project-scoped, not phase-scoped)
84
+ - **Contents**: Named lenses, each documenting:
85
+ - What it diagnoses (the class of problem it detects)
86
+ - What it recommends (the class of response it prescribes)
87
+ - When to apply (triggering conditions)
88
+ - Example: Bayesian updating, STRIDE threat modeling, Cost-of-delay prioritization
89
+ - **Consumed by**:
90
+ - `discuss-phase-assumptions` — reads METHODOLOGY.md (if it exists) and applies active lenses
91
+ to the current assumption analysis before surfacing findings to the user
92
+ - `plan-phase` — reads METHODOLOGY.md to inform methodology selection for each plan
93
+ - `pause-work` — includes METHODOLOGY.md in the Required Reading section of `.continue-here.md`
94
+ so resuming agents inherit the project's analytical orientation
95
+
96
+ **Why consumption matters:** A METHODOLOGY.md that no workflow reads is inert. The lenses only
97
+ take effect when an agent loads them into its reasoning context before analysis. This is why
98
+ both the discuss-phase-assumptions and pause-work workflows explicitly reference this file.
99
+
100
+ **Example lens entry:**
101
+
102
+ ```markdown
103
+ ## Bayesian Updating
104
+
105
+ **Diagnoses:** Decisions made with stale priors — assumptions formed early that evidence has since
106
+ contradicted, but which remain embedded in the plan.
107
+
108
+ **Recommends:** Before confirming an assumption, ask: "What evidence would make me change this?"
109
+ If no evidence could change it, it's a belief, not an assumption. Flag for user review.
110
+
111
+ **Apply when:** Any assumption carries Confident label but was formed before recent architectural
112
+ changes, library upgrades, or scope corrections.
113
+ ```
@@ -0,0 +1,49 @@
1
+ # Context Budget Rules
2
+
3
+ Standard rules for keeping orchestrator context lean. Reference this in workflows that spawn subagents or read significant content.
4
+
5
+ See also: `references/universal-anti-patterns.md` for the complete set of universal rules.
6
+
7
+ ---
8
+
9
+ ## Universal Rules
10
+
11
+ Every workflow that spawns agents or reads significant content must follow these rules:
12
+
13
+ 1. **Never** read agent definition files (`agents/*.md`) -- `subagent_type` auto-loads them
14
+ 2. **Never** inline large files into subagent prompts -- tell agents to read files from disk instead
15
+ 3. **read depth scales with context window** -- check `context_window_tokens` in `.planning/config.json`:
16
+ - At < 500000 tokens (default 200k): read only frontmatter, status fields, or summaries. Never read full SUMMARY.md, VERIFICATION.md, or RESEARCH.md bodies.
17
+ - At >= 500000 tokens (1M model): MAY read full subagent output bodies when the content is needed for inline presentation or decision-making. Still avoid unnecessary reads.
18
+ 4. **Delegate** heavy work to subagents -- the orchestrator routes, it doesn't execute
19
+ 5. **Proactive warning**: If you've already consumed significant context (large file reads, multiple subagent results), warn the user: "Context budget is getting heavy. Consider checkpointing progress."
20
+
21
+ ## read Depth by Context Window
22
+
23
+ | Context Window | Subagent Output Reading | SUMMARY.md | VERIFICATION.md | PLAN.md (other phases) |
24
+ |---------------|------------------------|------------|-----------------|------------------------|
25
+ | < 500k (200k model) | Frontmatter only | Frontmatter only | Frontmatter only | Current phase only |
26
+ | >= 500k (1M model) | Full body permitted | Full body permitted | Full body permitted | Current phase only |
27
+
28
+ **How to check:** read `.planning/config.json` and inspect `context_window_tokens`. If the field is absent, treat as 200k (conservative default).
29
+
30
+ ## Context Degradation Tiers
31
+
32
+ Monitor context usage and adjust behavior accordingly:
33
+
34
+ | Tier | Usage | Behavior |
35
+ |------|-------|----------|
36
+ | PEAK | 0-30% | Full operations. read bodies, spawn multiple agents, inline results. |
37
+ | GOOD | 30-50% | Normal operations. Prefer frontmatter reads, delegate aggressively. |
38
+ | DEGRADING | 50-70% | Economize. Frontmatter-only reads, minimal inlining, warn user about budget. |
39
+ | POOR | 70%+ | Emergency mode. Checkpoint progress immediately. No new reads unless critical. |
40
+
41
+ ## Context Degradation Warning Signs
42
+
43
+ Quality degrades gradually before panic thresholds fire. Watch for these early signals:
44
+
45
+ - **Silent partial completion** -- agent claims task is done but implementation is incomplete. Self-check catches file existence but not semantic completeness. Always verify agent output meets the plan's must_haves, not just that files exist.
46
+ - **Increasing vagueness** -- agent starts using phrases like "appropriate handling" or "standard patterns" instead of specific code. This indicates context pressure even before budget warnings fire.
47
+ - **Skipped steps** -- agent omits protocol steps it would normally follow. If an agent's success criteria has 8 items but it only reports 5, suspect context pressure.
48
+
49
+ When delegating to agents, the orchestrator cannot verify semantic correctness of agent output -- only structural completeness. This is a fundamental limitation. Mitigate with must_haves.truths and spot-check verification.
@@ -11,9 +11,9 @@ Standard format for presenting next steps after completing a command or workflow
11
11
 
12
12
  **{identifier}: {name}** — {one-line description}
13
13
 
14
- `{command to copy-paste}`
14
+ `/new` then:
15
15
 
16
- *`/new` first → fresh context window*
16
+ `{command to copy-paste}`
17
17
 
18
18
  ---
19
19
 
@@ -29,7 +29,7 @@ Standard format for presenting next steps after completing a command or workflow
29
29
  1. **Always show what it is** — name + description, never just a command path
30
30
  2. **Pull context from source** — ROADMAP.md for phases, PLAN.md `<objective>` for plans
31
31
  3. **Command in inline code** — backticks, easy to copy-paste, renders as clickable link
32
- 4. **`/new` explanation** — always include, keeps it concise but explains why
32
+ 4. **`/new` first** — always show `/new` before the command so users run it in the correct order
33
33
  5. **"Also available" not "Other options"** — sounds more app-like
34
34
  6. **Visual separators** — `---` above and below to make it stand out
35
35
 
@@ -44,9 +44,9 @@ Standard format for presenting next steps after completing a command or workflow
44
44
 
45
45
  **02-03: Refresh Token Rotation** — Add /api/auth/refresh with sliding expiry
46
46
 
47
- `/gsd-execute-phase 2`
47
+ `/new` then:
48
48
 
49
- *`/new` first → fresh context window*
49
+ `/gsd-execute-phase 2`
50
50
 
51
51
  ---
52
52
 
@@ -69,9 +69,9 @@ Add note that this is the last plan and what comes after:
69
69
  **02-03: Refresh Token Rotation** — Add /api/auth/refresh with sliding expiry
70
70
  *Final plan in Phase 2*
71
71
 
72
- `/gsd-execute-phase 2`
72
+ `/new` then:
73
73
 
74
- *`/new` first → fresh context window*
74
+ `/gsd-execute-phase 2`
75
75
 
76
76
  ---
77
77
 
@@ -91,9 +91,9 @@ Add note that this is the last plan and what comes after:
91
91
 
92
92
  **Phase 2: Authentication** — JWT login flow with refresh tokens
93
93
 
94
- `/gsd-plan-phase 2`
94
+ `/new` then:
95
95
 
96
- *`/new` first → fresh context window*
96
+ `/gsd-plan-phase 2`
97
97
 
98
98
  ---
99
99
 
@@ -120,9 +120,9 @@ Show completion status before next action:
120
120
 
121
121
  **Phase 3: Core Features** — User dashboard, settings, and data export
122
122
 
123
- `/gsd-plan-phase 3`
123
+ `/new` then:
124
124
 
125
- *`/new` first → fresh context window*
125
+ `/gsd-plan-phase 3`
126
126
 
127
127
  ---
128
128
 
@@ -145,14 +145,14 @@ When there's no clear primary action:
145
145
 
146
146
  **Phase 3: Core Features** — User dashboard, settings, and data export
147
147
 
148
+ `/new` then one of:
149
+
148
150
  **To plan directly:** `/gsd-plan-phase 3`
149
151
 
150
152
  **To discuss context first:** `/gsd-discuss-phase 3`
151
153
 
152
154
  **To research unknowns:** `/gsd-research-phase 3`
153
155
 
154
- *`/new` first → fresh context window*
155
-
156
156
  ---
157
157
  ```
158
158
 
@@ -169,9 +169,9 @@ All 4 phases shipped
169
169
 
170
170
  **Start v1.1** — questioning → research → requirements → roadmap
171
171
 
172
- `/gsd-new-milestone`
172
+ `/new` then:
173
173
 
174
- *`/new` first → fresh context window*
174
+ `/gsd-new-milestone`
175
175
 
176
176
  ---
177
177
  ```