Skip to content

fix: triage bundle — agentsDir lookup, Codex legacy README, useBeads gate#59

Merged
cofin merged 3 commits intomainfrom
fix/codex-readme-and-agentsdir-lookup
Apr 27, 2026
Merged

fix: triage bundle — agentsDir lookup, Codex legacy README, useBeads gate#59
cofin merged 3 commits intomainfrom
fix/codex-readme-and-agentsdir-lookup

Conversation

@cofin
Copy link
Copy Markdown
Owner

@cofin cofin commented Apr 27, 2026

Summary

Bundled fixes from the open-issue triage. Closes #50, #53, #55. (#37 closed separately as already-addressed; #48 deferred per maintainer preference.)

#55agentsDir-aware setup-state lookup

hooks/detect-env.{sh,ps1} hardcoded .agents/setup-state.json even after #54 wired CLAUDE_PLUGIN_OPTION_AGENTSDIR into DEFAULT_ROOT_DIR. With agentsDir=specs configured, the hook silently fell through to the "(default)" branch, masking the user's chosen root. Lookup now uses ${DEFAULT_ROOT_DIR}/setup-state.json first, with .agents/setup-state.json as a backward-compat fallback for users who switched agentsDir mid-project.

#50 — Valid Codex 0.125+ legacy install path

README's legacy/manual Codex install block placed the marketplace manifest at ~/.agents/plugins/marketplace.json and used "path": "~/.codex/plugins/flow". Codex 0.125+ rejects any local marketplace path that isn't prefixed with ./. Restructured: marketplace manifest goes next to the cloned repo at ~/.codex/plugins/marketplace.json with "path": "./flow", which resolves correctly relative to the manifest's directory.

#53 — Gate every bd invocation on useBeads/availability

Until now, only hooks/detect-env.{sh,ps1} consulted the useBeads userConfig (3 references in the entire repo); every flow command, agent, and TOML mirror shelled out to bd unconditionally. Toggling useBeads=false suppressed the SessionStart context block but every command still emitted command not found — the toggle was effectively a no-op. Centralized the rule:

  • skills/flow/references/discipline.md — new Beads Mode Iron Law section alongside TDD/Debugging/Verification, with a signal table mapping the three SessionStart hook outputs (Official / Missing / Disabled) to the required agent behavior.
  • agents/{executor,plan-generator,prd-orchestrator}.md + templates/opencode/agents/flow.md — gate added to each agent's IRON LAWS / ZERO-AMBIGUITY MANDATE / Critical Rules block.
  • commands/flow-{implement,status,archive,finish,task,prd,refine,review,revise}.md + commands/flow/{archive,review,validate,refine,status,sync}.toml mirrors — short Beads-mode preamble pointing to the canonical rule, so an agent reading a single command file still sees the gate even without the discipline reference loaded. Markdown preambles are merged into the existing lifecycle-skill blockquote (one continuous callout, MD028-clean).

Falls back to spec.md markers ([ ], [~], [x], [!], [-]) as the source of truth in degraded mode. Never halts for missing Beads.

Test plan

  • make check passes (lint, skills, codex, version sync) — twice (initial and after the MD028 correction)
  • hooks/detect-env.sh smoke-tested for all three lookup paths in /tmp/flow-test/:
    • default .agents/ + .agents/setup-state.json → reads correctly
    • custom agentsDir=specs + specs/setup-state.json → reads correctly (the bug fix)
    • custom agentsDir=specs + no state file → "(default)" branch as expected
  • User-side: re-run claude plugin install flow@flow-marketplace and confirm /doctor no longer flags either Codex or agentsDir issue
  • Smoke-test useBeads=false mode: install plugin with toggle off, run /flow:status and /flow:task — expect graceful degraded-mode output instead of bd: command not found

cofin added 3 commits April 27, 2026 00:55
Closes #50, #55.

#55: hooks/detect-env.{sh,ps1} hardcoded .agents/setup-state.json even
after PR #54 wired CLAUDE_PLUGIN_OPTION_AGENTSDIR into DEFAULT_ROOT_DIR.
With agentsDir=specs the configured root was silently masked and the
hook reported "(default)". Lookup now resolves
${DEFAULT_ROOT_DIR}/setup-state.json first and falls back to
.agents/setup-state.json so users who switched agentsDir mid-project
keep working.

#50: README's legacy / repo-scoped Codex install block placed the
marketplace.json at ~/.agents/plugins/marketplace.json with a
"~/.codex/plugins/flow" path — Codex 0.125+ rejects any local
marketplace path that doesn't start with "./". Restructure: place
the marketplace manifest next to the cloned repo at
~/.codex/plugins/marketplace.json with path "./flow", which resolves
relative to the manifest directory.
…53)

Until now, only hooks/detect-env.{sh,ps1} consulted the useBeads userConfig
toggle (3 references in the entire repo), while every flow command, agent,
and TOML mirror shelled out to `bd` unconditionally. Toggling
useBeads=false suppressed the SessionStart context block but every command
still emitted "command not found" — the toggle was effectively a no-op.

Centralize the rule:

- skills/flow/references/discipline.md — new "Beads Mode Iron Law" section
  alongside TDD/Debugging/Verification, with a signal table mapping the
  three SessionStart hook outputs (Official / Missing / Disabled) to the
  required agent behavior.

- agents/{executor,plan-generator,prd-orchestrator}.md — add the gate to
  each agent's IRON LAWS / ZERO-AMBIGUITY MANDATE block so spec generation,
  PRD orchestration, and task execution all degrade gracefully when bd is
  absent or disabled.

- templates/opencode/agents/flow.md — equivalent rule in OpenCode's
  Critical Rules list.

- commands/flow-{implement,status,archive,finish,task,prd,refine,review,revise}.md
  and their commands/flow/*.toml mirrors (archive, review, validate, refine,
  status, sync) — short preamble pointing to the canonical rule, so
  agents reading a single command file still see the gate even without
  the discipline reference loaded.

Falls back to spec.md markers ([ ], [~], [x], [!], [-]) as the source of
truth in degraded mode. Never halts for missing Beads.
Earlier commit converted the Beads-mode preamble to a plain paragraph to
duck markdownlint's MD028. The correct fix is to keep the blockquote
(it's semantically a callout, matching the existing 'Lifecycle skill'
note style) and merge the two adjacent blockquotes into one continuous
block separated by '>' — markdownlint's documented remedy for MD028.

The blockquote callout reads as a callout in any rendered markdown and
groups the two pre-flight notes (Beads gate + lifecycle skill) into a
single visual block, which is what the structure already implies.
@cofin cofin changed the title fix: agentsDir-aware setup-state lookup + valid Codex legacy install path fix: triage bundle — agentsDir lookup, Codex legacy README, useBeads gate Apr 27, 2026
@cofin cofin merged commit 44b98ce into main Apr 27, 2026
4 checks passed
@cofin cofin deleted the fix/codex-readme-and-agentsdir-lookup branch April 27, 2026 01:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Codex marketplace docs/manifests use local paths rejected by Codex 0.125

1 participant