Skip to content

feat(agent): prepare official hooks by default#33

Merged
hefxpzwk merged 6 commits into
developfrom
feature/agent-wrapper-default-route
Jul 7, 2026
Merged

feat(agent): prepare official hooks by default#33
hefxpzwk merged 6 commits into
developfrom
feature/agent-wrapper-default-route

Conversation

@hefxpzwk

@hefxpzwk hefxpzwk commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Scope

This draft PR continues the agent-mode product route work on feature/agent-wrapper-default-route.

Implemented in this update:

  • tfy start --agent remains the simple default path: generic wrapper + Codex + Claude Code official project hook routes.
  • --host all means the Codex + Claude Code safe project writers only.
  • Public/product wording now names only Codex and Claude Code as supported named agent hosts.
  • Public docs, help text, capabilities, setup dry-runs, release notes, issue template, status --json, and launch-report --json no longer publish a non-supported host inventory.
  • Explicit invalid host inputs fail closed and list supported alternatives only: codex, claude-code.
  • MCP remains advanced/complementary, not the default agent command-interception path.

Supported claims

Supported named agent routes in current product wording:

  • Codex official project PreToolUse Bash hook route
  • Claude Code official project PreToolUse Bash hook route
  • Generic wrapper fallback

Launch support is still evidence-gated: setup/config writes remain configured_unverified / active=false until real host invocation plus route-bound raw/ledger/no-negative/positive-savings evidence exists.

Validation

Local validation completed:

  • cargo fmt --all
  • cargo test -p tfy-cli --test product_ux -- --nocapture
  • cargo test -p tfy-cli --test adapter_gateway -- --nocapture
  • cargo test -p tfy-cli --test hook_gateway -- --nocapture
  • ./scripts/verify.sh
  • git diff --check
  • Manual public-surface checks ✅
    • status --json host matrix: mcp_stdio, tfy_agent_adapter, generic_shell, codex, claude-code
    • mcp capabilities: mcp-stdio, Codex setup snippet, Claude Code setup snippet
    • hook capabilities: test-shim, codex, claude-code
    • adapter capabilities: generic-shell, codex, claude-code, mcp
    • invalid setup/MCP target errors fail closed with supported hosts: codex, claude-code
    • public docs grep found no removed named-host inventory
  • Independent code review: APPROVE ✅
  • Independent architect review: CLEAR ✅
  • Ultragoal checkpoint: G005 complete ✅

Risk notes

  • Real installed Codex/Claude host processes were not relaunched in this local pass; existing live-smoke tests remain the evidence path.
  • Do not reintroduce non-Codex/Claude host names into public docs, help, capabilities, dry-runs, launch-report matrices, or templates without a new approved plan and tests.

hefxpzwk added 2 commits July 6, 2026 14:30
Bare agent start now creates a project-local TFY command wrapper instead of silently choosing a Codex MCP setup path, so the public agent flow matches the shared human/agent raw-first pipeline while MCP stays complementary.

Constraint: TFY must not claim private hooks, universal interception, negative savings, or MCP-primary command interception without evidence.

Rejected: default Codex MCP auto-configuration | it made MCP look like the primary agent command-interception path.

Rejected: GA readiness through MCP-only evidence | named-host GA claims must still require named-host invocation evidence.

Confidence: high

Scope-risk: moderate

Directive: Keep bare tfy start --agent on the wrapper route; official host hooks remain planned/test-shim-only until public host support and route evidence exist.

Tested: ./scripts/verify.sh; cargo test -p tfy-cli --test product_ux lifecycle_start_agent -- --nocapture; cargo test -p tfy-cli --test product_ux launch -- --nocapture; cargo test -p tfy-cli --test agent_workspace -- --nocapture

Not-tested: real external Codex/Claude/Cursor host invocation because launch-supported status requires separate host-bound evidence.
Codex and Claude Code now use documented PreToolUse Bash hooks to rewrite agent Bash commands into TFY's shared raw-first command gateway while setup remains evidence-gated until real host invocation proof exists.

Constraint: Codex/Claude command interception must use official host hooks and preserve TFY raw-first/no-negative/truthful-claims invariants.

Rejected: MCP-first named-host command routing | It does not satisfy the default command interception path for agent Bash commands.

Rejected: Executing pending commands inside PreToolUse hooks | It can double-run side-effecting commands and violates official hook control semantics.

Confidence: high

Scope-risk: moderate

Directive: Keep hook ingress as a thin rewrite/provenance router; do not promote setup to launch_supported without route-bound host evidence.

Tested: ./scripts/verify.sh; cargo test -p tfy-cli --test hook_gateway -- --nocapture; cargo test -p tfy-cli --test product_ux -- --nocapture; independent code-reviewer APPROVE and architect CLEAR

Not-tested: Live interactive Codex and Claude Code sessions; launch support still requires user-supplied real host evidence.
@hefxpzwk hefxpzwk changed the title feat(agent): make wrapper the default agent command route feat(agent): support official Codex and Claude hook routing Jul 6, 2026
Live named-host smoke now creates a temporary project, routes an installed Codex or Claude Code CLI through TFY's official hook path, and emits launch-report host evidence only after strict raw/ledger/no-negative/positive-savings validation passes.

Constraint: Named-host launch support must remain evidence-gated and must not be inferred from setup, MCP availability, private hooks, or provider prompt mutation.

Rejected: Accepting the first hook ledger event | It could promote evidence after extra or wrong host commands, so live smoke now requires exactly one expected command.

Rejected: Duplicated live-host policy branches | They would drift across launch support and smoke execution, so LiveHostSmokeSpec owns eligibility, binary, timeout, and bypass policy.

Confidence: high

Scope-risk: moderate

Directive: Keep live smoke explicit opt-in and do not emit host_evidence unless strict command-match, raw artifact, no-negative, positive-savings, and route-bound checks pass.

Tested: cargo test -p tfy-cli --test product_ux -- --nocapture; cargo test -p tfy-cli --test hook_gateway -- --nocapture; ./scripts/verify.sh; real Codex live smoke promoted launch-report evidence; independent code-reviewer APPROVE and architect CLEAR

Not-tested: Real Claude Code live smoke in this environment because installed Claude Code is not logged in; fake-host e2e covers the Claude path.
@hefxpzwk hefxpzwk changed the title feat(agent): support official Codex and Claude hook routing feat(agent): support official Codex and Claude hook evidence Jul 6, 2026
Constraint: Bare start must prepare Codex and Claude without aliasing to --host all.

Rejected: Reusing --host all | It would silently include Cursor/guidance routes beyond the default product scope.

Rejected: Marking setup active | Setup lacks route-bound raw/ledger/no-negative/positive-savings evidence.

Confidence: high

Scope-risk: moderate

Directive: Keep `tfy start --agent` default to wrapper+Codex+Claude only and preserve configured-vs-active separation.

Tested: cargo fmt --all; cargo test -p tfy-cli --test product_ux lifecycle_start_agent -- --nocapture; cargo test -p tfy-cli --test hook_gateway -- --nocapture; cargo test -p tfy-cli --test product_ux -- --nocapture; ./scripts/verify.sh; git diff --check; temp-project `tfy start --agent` smoke; independent code-reviewer APPROVE; independent architect CLEAR

Not-tested: Real Claude Code live smoke; local Claude CLI remains unauthenticated from previous work.
@hefxpzwk hefxpzwk changed the title feat(agent): support official Codex and Claude hook evidence feat(agent): prepare official hooks by default Jul 6, 2026
hefxpzwk added 2 commits July 7, 2026 19:07
Constraint: Product scope supports Codex and Claude Code named agent routes; Cursor must fail closed while legacy TFY-owned cleanup remains cleanup-only.

Rejected: Keep Cursor as MCP setup target | it would keep advertising an unsupported route and conflict with truthful adapter claims.

Confidence: high

Scope-risk: moderate

Directive: Do not re-add Cursor to --host all, setup snippets, MCP install, hook install, or launch promotion without a new approved product plan and tests.

Tested: ./scripts/verify.sh; git diff --check; manual Cursor launch-report/doctor/smoke checks; independent code-reviewer APPROVE; architect CLEAR.

Not-tested: Real installed Codex/Claude/Cursor hosts were not launched in this local pass.
Narrow product-facing host lists and docs so TFY names only Codex and Claude Code as supported named agent hosts while invalid host input fails closed with supported alternatives only.

Constraint: Public TFY agent-mode surfaces should not publish non-supported host inventories while preserving explicit fail-closed errors for user-provided invalid host input.

Rejected: Keep unsupported/planned host matrices in docs and capabilities | conflicts with the supported-host-only product story and creates public support confusion.

Confidence: high

Scope-risk: moderate

Directive: Do not reintroduce non-Codex/Claude host names into public docs, help, capabilities, dry-runs, launch-report matrices, or templates without a new approved plan and tests.

Tested: cargo fmt --all; cargo test -p tfy-cli --test product_ux -- --nocapture; cargo test -p tfy-cli --test adapter_gateway -- --nocapture; cargo test -p tfy-cli --test hook_gateway -- --nocapture; ./scripts/verify.sh; manual status/mcp/hook/adapter capability checks; invalid setup/mcp host checks; public docs no-leak grep; code-reviewer APPROVE; architect CLEAR.

Not-tested: Real installed Codex and Claude Code host processes were not relaunched in this local pass; existing live-smoke tests remain the evidence path.
@hefxpzwk hefxpzwk marked this pull request as ready for review July 7, 2026 13:40
@hefxpzwk hefxpzwk merged commit f3b339b into develop Jul 7, 2026
14 checks passed
@hefxpzwk hefxpzwk deleted the feature/agent-wrapper-default-route branch July 7, 2026 13:42
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.

1 participant