feat(agent): prepare official hooks by default#33
Merged
Conversation
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.
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.
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.
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.
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.
Scope
This draft PR continues the agent-mode product route work on
feature/agent-wrapper-default-route.Implemented in this update:
tfy start --agentremains the simple default path: generic wrapper + Codex + Claude Code official project hook routes.--host allmeans the Codex + Claude Code safe project writers only.status --json, andlaunch-report --jsonno longer publish a non-supported host inventory.codex, claude-code.Supported claims
Supported named agent routes in current product wording:
Launch support is still evidence-gated: setup/config writes remain
configured_unverified/active=falseuntil 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✅status --jsonhost matrix:mcp_stdio,tfy_agent_adapter,generic_shell,codex,claude-codemcp capabilities:mcp-stdio, Codex setup snippet, Claude Code setup snippethook capabilities:test-shim,codex,claude-codeadapter capabilities:generic-shell,codex,claude-code,mcpsupported hosts: codex, claude-codeRisk notes