Commit 095de5c
authored
feat: token optimization, context compression beta, and anti-drift guards (#78)
* chore: update changelog and version to 0.3.4
* feat: add AskUserQuestion enforcement, context recovery, and robustness fixes
- Add check --recover to comet-state.sh for structured compaction recovery
- Add field_status() helper for DONE/PENDING/BROKEN field reporting
- Fix unbound variable crash when tasks.md missing under set -u
- Fix path truncation risk with spaces in design_doc field
- Unify direct_override fallback style to || true
- Enforce AskUserQuestion tool at all 21 decision points across 7 skills
- Add red flags table, uncertainty weighting, naming guard, file verification
- Add idempotency notes and compaction recovery sections to all phases
- Sync all 14 zh/en skill files to full parity
- Add 8 test cases for check --recover covering all phases
- Bump version to 0.3.5
* fix: address PR review feedback for comet-state recover
- Remove inconsistent trailing-space stripping in design_doc field_status call
- Add explicit elif for verify_result=pass with pending branch_status
to avoid misleading 'not yet started' recovery message
* fix: update skills.test.ts assertions to match AskUserQuestion wording
All skill files were updated to require AskUserQuestion tool explicitly,
but skills.test.ts still expected the old text without AskUserQuestion.
Updated 12 assertions across zh/en to match the new wording.
* fix: use bare superpowers skill names
* feat: resolve bash executable for Comet scripts and update documentation
* docs: design plan-ready build pause
* test: cover plan-ready build pause state
* feat: implement plan-ready build pause functionality and update related documentation
* fix: complete plan-ready pause docs and bash runner
* fix(env): optimize Bash parsing and WSL Bash detection logic
* chore: release 0.3.7 workflow updates
* fix: align comet skill confirmation flows
* feat: add DouYin and REDNote links to README files
* feat: add subagent_dispatch field to .comet.yaml state machine
Require subagent_dispatch confirmation before build_mode can be set
to subagent-driven-development. This ensures the platform has real
background subagent/Task/multi-agent dispatch capability before
entering subagent execution mode.
- Add subagent_dispatch field (null|confirmed) to init template
- Add enum validation in comet-state.sh and comet-yaml-validate.sh
- Add guard check in comet-guard.sh to block build-complete without
confirmed subagent_dispatch
- Add transition guard in comet-state.sh require_build_decisions
- Update recovery guidance in cmd_recover for subagent scenarios
- Update SKILL.md (zh) with subagent execution rules and stale
plan-ready pause handling
- Add 219 lines of tests covering all new validation paths
* fix: address review findings for dev branch
- Replace REDNote/xiaohongshu links with stable profile URL (M1)
- Fix stale plan-ready + pending=0 recovery guidance to suggest
running guard instead of continuing tasks (H1)
- Add openspec/config.yaml removal to CHANGELOG (M2)
* feat: add tdd_mode and subagent_dispatch fields to .comet.yaml state machine
- Add tdd_mode (tdd|direct) field: user chooses TDD enforcement at build step 3
- Add subagent_dispatch (null|confirmed) field: gate subagent-driven-development on confirmed platform capability
- Guard: tdd_mode_selected() + subagent_dispatch_confirmed() checks in guard_build()
- State: cmd_set whitelist/enum, require_build_decisions, cmd_recover display
- Validate: KNOWN_KEYS + enum schema for both new fields
- SKILL.md (zh+en): TDD mode table, execution constraints, hard constraint docs
- Tests: 5 new tdd_mode tests, bulk tdd_mode field additions, assertion updates
Closes #67
* fix: correct tdd_mode indentation and linter formatting in test files
* fix: merge delta specs during archive
* feat: add PRD split preflight to open phase for large inputs
Chinese and English comet-open skills now triage large PRDs before
creating OpenSpec artifacts, allowing users to split independent
capabilities into multiple Comet changes. Each split item enters
the /comet-open state-machine path with minimal resume support.
- Add §1a PRD split preflight (blocking point) to both skill files
- Add decision point 8 to main comet skill decision node list
- Add test coverage for split choices, state init, resume rules
- Update CHANGELOG.md with Added and Tests entries
* fix: address multi-dimensional review findings for state machine, guards, scripts, and skills
- Prevent command injection via build/verify command fields (reject shell metacharacters)
- Prevent path traversal via design_doc and other path fields in cmd_set
- Enforce design_doc requirement for full workflow in design guard
- Preserve verification_report and branch_status across verify-fail re-verify cycles
- Fix preset (hotfix/tweak) upgrade path to include phase rollback to design
- Add verify retry limit (3 consecutive fails triggers mandatory user decision)
- Add manual verify_mode override mechanism
- Fix UTC date consistency across all scripts
- Fix SCRIPT_DIR resolution for macOS (replace readlink -f with portable alternative)
- Fix archive directory resolution with timezone-safe fallback
- Set chmod 600 on all mktemp files
- Fix pipe hash error propagation in handoff and guard scripts
- Add open phase recovery granularity (3 states with specific actions)
- Add 50% scope threshold continue-in-current-change option in build
- Add worktree plan commit instruction in build
- Add context compaction recovery section in archive skill
- Add 5 new test cases covering critical and high-severity fixes
* feat: add verification-before-completion gate to comet-verify
Load Superpowers verification-before-completion skill before
lightweight (2a) and full (2b) verification checks, enforcing
evidence-based confirmation before any completion claims.
* fix: require archive confirmation
* feat: integrate CodeGraph into comet init, update, and doctor
Add optional CodeGraph (@colbymchenry/codegraph) installation step to
comet init and comet update, with platform-aware agent wiring via the
codegraph CLI. Doctor now reports CodeGraph CLI and project init status.
* docs: update readme
* docs: update readme
* docs: expand and translate contributing guide
* feat(core): add beta context compression for spec projection handoff
* fix(core): harden beta context compression — verbatim projection, JSON validation
- Replace AWK keyword filter with verbatim cat projection for spec files,
eliminating language-dependent matching (Chinese/non-English specs work)
- Replace beta_spec_projection_covers_headings (English heading grep) with
beta_spec_json_structurally_valid (JSON field + source coverage check)
- Add role field (spec/supporting) to spec-context.json files array,
remove language-dependent projection array
- Warn when --full is passed in beta mode instead of silently ignoring
- Use grep -F for file path matching in guard (no regex escaping needed)
- Add tests: Chinese spec verbatim projection, JSON corruption detection,
--full beta warning
* feat(core): add token optimizations — TDD single load, brainstorming checkpoint, plan offload, hash on-demand read
Six token optimizations for the Comet phased workflow:
1. TDD skill loaded once (not per-task) — saves ~44K per 10-task run
2. Brainstorming checkpoint (brainstorm-summary.md) for compaction recovery
3. Plan creation offloaded to subagent with inline fallback
4. Verification skill loading deduplicated (moved before branch point)
5. tasks.md incremental scan via grep instead of full re-read
6. Hash on-demand read in verify (skips only tasks.md when hash matches)
Design Doc creation deliberately kept in main session to preserve full
brainstorming conversation context for complex requirements.
New: comet-handoff.sh --hash-only flag (backward-compatible).
Tests: 79 passing (3 new for --hash-only, 1 timeout fix).
* docs: merge duplicate changelog sections in 0.3.7
* feat(core): add cross-platform rules/hooks distribution and phase write guard
- Add comet-phase-guard.md rule file injected every turn to prevent phase drift
- Add comet-hook-guard.sh PreToolUse hook that hard-blocks file writes in
open/design/archive phases with whitelist for openspec, docs, .claude paths
- Correct platform definitions: Cline (.clinerules/ at root), GitHub Copilot
(.instructions.md format), Kiro (.kiro/steering/), Gemini (no rulesDir)
- Add rulesDir/rulesFormat to 17 platforms, supportsHooks/hookFormat to 9
- Hook installers support 7 formats: claude-code, gemini, windsurf, copilot,
qwen, kiro, qoder — each writing platform-specific config files
- Fix installClaudeCodeHooks to use correct { matcher, hooks: [{type,command}] }
format matching Claude Code settings schema
- Fix comet-hook-guard.sh sed portability (POSIX-compliant //* pattern)
- Fix Copilot hooks PowerShell field to wrap bash invocation explicitly
- Add 10 tests covering phase-based blocking, whitelist paths, archive bypass
- Update manifest.json with rules/hooks entries, bump to 0.3.3
- Update .claude/settings.local.json with correct hook config format
* feat(core): distribute rules and hooks during comet update
When updating installed platforms, comet update now also distributes
anti-drift phase guard rules and hook-guard scripts alongside skill
files, keeping all three components in sync after a Comet upgrade.
* fix(core): add rules/hooks results to update JSON output and error isolation
- Track totalRulesCopied and totalHooksInstalled across platform loop
- Include rules and hooks fields in JSON output for programmatic consumers
- Wrap rules/hooks distribution in try/catch to prevent failures from
blocking the primary skill-copy loop
* fix(core): deduplicate YAML fields in replace_yaml_field
replace_yaml_field in comet-state.sh now deduplicates all fields after
replacement, keeping only the last occurrence of each key. Previously,
multiple cmd_set calls for the same field (e.g., during verify-fail →
re-verify cycles) could leave duplicate lines in .comet.yaml.
Fixes #77
* feat(comet-design): add beta-gated context compression for spec handoff
* feat(core): add context compression benchmark and documentation
- Add CONTEXT-COMPRESSION.md with compression principles, full benchmark
report (L1/L2/L3 phases), and reproduction steps
- Add context-execution-benchmark.mjs for L1/L2/L3 phase benchmarks
with tier scaling (small/medium/large)
- Add context-compression-benchmark.mjs for token-level compression tests
- Add shared benchmark-utils.mjs (spawnCapture, parseClaudeJson, etc.)
- Add benchmark test suites (16 tests total)
- Add benchmark:context and benchmark:execution npm scripts
- Reference context compression feature in README.md and README-zh.md
- Update CHANGELOG.md with benchmark entries
* docs: add NEWS.md, update README and CHANGELOG for 0.3.7
- Add NEWS.md with condensed 0.3.7 highlights (CodeGraph, context compression, token optimizations, anti-drift guard, workflow hardening)
- Update README-zh.md and README.md News section with concise summary linking to NEWS.md
- Add comet-hook-guard.sh to script table, tdd_mode/subagent_dispatch to .comet.yaml fields, anti-drift guard to reliability section in README-zh.md
- Add missing CHANGELOG entry for rules/hooks update JSON output fix
* feat(platforms): add globalSkillsDir property to platform configurations
* fix(commands): update CodeGraph install message with accurate savings
* feat(skills): clarify behavior for loading openspec-propose skill
* fix: improve command injection prevention and path validation in scripts
* feat(skills): update workflow steps and clarify protocol handling for uncommitted changes
* feat: add deterministic next-step resolver for workflow transitions and enhance documentation
* feat: enforce Superpowers plan task completion checks in build guard and update documentation
* feat: enhance brainstorming process with incremental updates to checkpoint file
* feat: implement active context compaction gate for design process to optimize token usage
* docs: remove unless doc
* fix: harden comet skill design based on comprehensive review
H1: hook guard whitelist refined to phase-aware filtering — open/archive
can no longer freely write to openspec/* and docs/superpowers/*
H2: tweak → full upgrade conditions synced (new capability, delta spec)
H3: archive step numbering fixed (duplicate ### 0.)
H4: stale pause auto-clear now logs before clearing
M1: boilerplate version tag (v2) added for sync tracking
M3: scale thresholds documented (tasks>3, specs>1, files>4)
M4: hotfix open→build now checks auto_transition via next call
M6: review gate fallback when requesting-code-review unavailable
M7: Spec Patch scope bounded (no structural rewrites)
M5: dirty-worktree skips .gitignore-matched build artifacts
L2: tweak applicable conditions removed ambiguous file count
L3: hotfix >3 tasks clarified as execution method switch, not upgrade
L4: TDD default direct noted for hotfix/tweak in build skill
L5: archive guard prohibition promoted to WARNING block
All changes synced across zh/en versions. 100 tests pass.
* fix: harden skill trigger phrasing and guard source-only bypass
- Standardize skill dependency triggers to use **立即执行:** / **Immediately execute:** format for writing-plans, executing-plans, and subagent-driven-development in both zh and en SKILL.md
- Move ARGUMENTS/Language constraints to post-load section per Skill trigger phrasing rules
- Prevent COMET_GUARD_SOURCE_ONLY=1 from silently bypassing guard validations when script is executed directly (exit 1 instead of exit 0)
* test(config): exclude benchmark tests from CI and mock select prompt
* fix(comet): correct source-only execution check and enhance path resolution
* fix(scripts): improve unreachable code handling in comet-guard.sh
* feat: config.yaml and docs update
* docs: update readme
* chore: update title log
* docs: update readme
* Revert "docs: update readme"
This reverts commit 1135df1.
* docs: update img
* docs: update readme
* docs: update readme
* docs: update readme
* feat: add branch naming convention with user input for comet-build
Users can now customize branch names during the build phase instead of
using the change name directly. The agent recommends a structured name
(feature/hotfix/tweak/YYYYMMDD/<change-name>) based on workflow type,
and the user can accept or input a custom name.
Closes #811 parent caf0f38 commit 095de5c
64 files changed
Lines changed: 10364 additions & 1412 deletions
File tree
- .claude
- .github/workflows
- assets
- skills-zh
- comet-archive
- comet-build
- comet-design
- comet-hotfix
- comet-open
- comet-tweak
- comet-verify
- comet
- reference
- skills
- comet-archive
- comet-build
- comet-design
- comet-hotfix
- comet-open
- comet-tweak
- comet-verify
- comet
- reference
- rules
- scripts
- docs
- superpowers/specs
- img
- openspec
- scripts
- src
- commands
- core
- test/ts
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
| 88 | + | |
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
38 | 47 | | |
39 | 48 | | |
40 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
0 commit comments