[FORGE-105] feat(skills,cli): auto-codex in-skill hints (P2.5-T13)#169
Merged
Conversation
…dex schema (P2.5-T13)
Add `forge codex-suggest <event>` CLI verb that prints a one-line hint
suggesting `/codex review-{plan,impl,decision}` at the end of /plan-task
and /ship skills. Honors `FORGE_AUTO_CODEX=0` env and
`codex.auto_codex_enabled: false` in settings.yaml as disable levers.
Schema additions per SPEC §Settings (lines 234-248):
- `codex.auto_codex_enabled` (consumed by codex-suggest)
- `codex.auto_codex_token_cap` (RESERVED — see scope note below)
- `decisions.*` (forward-compat for /update-spec; no consumer in this PR)
- `doctor.*` (forward-compat for `forge doctor` verb; no consumer in this PR)
All new blocks have `.default({})` — existing settings.yaml files parse cleanly.
Scope deviations from issue body (decided during /plan-task forks):
- /update-spec hint deferred: skill doesn't exist yet. Event registered in
EVENT_TO_VERB for zero-CLI-patch wiring when the skill lands.
- Token-cap accounting dropped: was a legacy artifact of the dropped
Feature 7 (auto-executing host hooks). Passive suggestions bound nothing
meaningful. SPEC amendment to remove the "tokens/session" language is
filed as a follow-up.
Decision: /update-spec scope -> skip per user answer Q1 (skill doesn't exist)
Decision: token-cap concept -> drop per user answer Q2 (legacy artifact)
Decision: suggestion mechanism -> CLI verb per user answer Q3 (testable)
Decision: schema scope -> add all three blocks per user answer Q4 (SPEC parity)
Test coverage: 14 unit tests for codex-suggest + 9 schema tests for new
blocks. Full suite: 1061 pass, 11 skipped, 0 fail.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…fore invoking git Codex 2nd-pass: F1 (confidence 8/10) — `git rev-parse --git-common-dir` honors GIT_DIR / GIT_WORK_TREE / GIT_COMMON_DIR env vars, which an attacker could use to redirect settings.yaml discovery to a controlled repo with auto_codex_enabled toggled. Strip those vars (plus GIT_CEILING_DIRECTORIES) before invoking git so resolution stays anchored on cwd. Regression test plants a poisoned GIT_DIR and asserts the suggestion still fires (sanitization holds). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3eedc12 to
abb1028
Compare
Open
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
forge codex-suggest <event>CLI verb that prints a one-line hint at the end of/plan-taskand/shipskills suggesting/codex review-{plan,impl}. Implements SPEC §Auto-codex skill-level hooks (lines 942-963) without host-level Claude Code hooks (Feature 7 was dropped 2026-05-17).forge codex-suggest <event>— reads.forge/settings.yaml(cwd or viagit rev-parse --git-common-dirfallback), checkscodex.auto_codex_enabled+FORGE_AUTO_CODEXenv, prints the locked hint text or stays silent.codex.*,decisions.*,doctor.*blocks — all.default({})so existing settings.yaml parses unchanged. Onlycodex.auto_codex_enabledis consumed in this PR; the other blocks are forward-compat for/update-specandforge doctor./plan-task(withBash(forge*)in tools), andforge codex-suggest shipappended to/shipOutput section.Why
P2.5-T13. Multi-model second opinion (ETHOS §6) is mandated on CRITICAL.md paths but historically required users to remember to invoke
/codexmanually. The in-skill hint surfaces the next-step recommendation at the exact moment it's needed (post-plan, pre-PR) without auto-executing — user types or skips. No host hooks → no Claude Code version coupling.Forks asked & answered (in plan)
/update-specscopeEVENT_TO_VERBfor zero-CLI-patch wiring when it lands.auto_codex_token_capin schema as RESERVED (no consumer). SPEC amendment to drop "tokens/session" language filed as follow-up FORGE-124.forge codex-suggestCLI verborchestrate) since it's stateless.decisions+doctorblocks inert in this PR.Codex 2nd-pass (CRITICAL path:
src/cli/init/scaffold.ts)codex execreview, 7 attack vectors. One actionable finding:git rev-parse --git-common-dirhonorsGIT_DIR/GIT_WORK_TREE/GIT_COMMON_DIRenv vars, which an attacker could use to redirect settings discovery to a controlled repo. Fixed in commit3eedc12— strip those vars (plusGIT_CEILING_DIRECTORIES) before invoking git. Regression test plants a poisonedGIT_DIRand asserts the suggestion still fires.Scope deviations from issue body
Both deviations were architectural forks decided during
/plan-taskwith explicit user answers — not silent drops:/update-spechint — skill doesn't exist yet. The hint is a 3-line addition; whoever creates/update-specadds it then. Linear acceptance criterion needs a comment trail.Known follow-ups (filed separately, not coupled to this PR)
/pickup-taskdoesn'tnpm installin worktrees. Pre-existing fragility — 6 e2e tests in this repo shell out torepoRoot/node_modules/.bin/tsx. They pass on main, fail in fresh worktrees. Worth a separate ticket for/pickup-taskto either install or symlinknode_modulesduring hydration.Test plan
npm test— 1062 pass / 11 skipped / 0 fail (15 new codex-suggest tests + 9 new schema tests)npm run typecheck— cleannpm run build— clean (ESM + CJS, 6 files, 318 KB ESM / 344 KB CJS)gitleaks detect— no leaksnode dist/bin/forge.cjs codex-suggest plan-task→ prints💡 Suggested next: /codex review-plan (run with FORGE_AUTO_CODEX=0 to disable)FORGE_AUTO_CODEX=0 node dist/bin/forge.cjs codex-suggest plan-task→ silentnode dist/bin/forge.cjs codex-suggest ship→ prints/codex review-implnode dist/bin/forge.cjs codex-suggest update-spec→ prints/codex review-decision(reserved)node dist/bin/forge.cjs codex-suggest bogus→ exit 1 with stderr message/codex review(CRITICAL pathsrc/cli/init/scaffold.tstouched) — F1 fixed, F2-7 no actionLinked
Closes FORGE-105 (P2.5-T13).
🤖 Generated with Claude Code