Repository navigation
feat(kitchen-sink, shift-manager, labs): a trusted repository's conventions load with hooks off (FIX-2421, stacked on FIX-2398) - #4427
Conversation
A trusted Kitchen Sink session loads the repository's conventions (CLAUDE.md, skills) and the keys the operator names, with the repository's hooks off. Wave-1 package slice: a settings layer in claude-code and a CURSOR_PASS export in cursor; the app PR follows. POC: the issue's settingSources ['project'] alone runs project hooks; disableAllHooks keeps conventions and stops them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiFUL7CTUSZikwbMGcT
…CURSOR_PASS copies Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiFUL7CTUSZikwbMGcT
…to claude/project-thread-6j0831
…xists Applied verbatim from /mnt/project-files/FIX-2421/pr1.patch so the app wiring builds against the settings option and the CURSOR_PASS export. Replaced by a merge of PR 1's branch once it is pushed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiEz7iQL5uMFfnRQd9A
…ntions load with hooks off (FIX-2421) Kitchen Sink reads two new settings beside KITCHEN_SINK_HARNESS_WORKSPACE, in its one reader: KITCHEN_SINK_HARNESS_TRUSTED=1 and KITCHEN_SINK_HARNESS_PASS. Trusted, Claude Code mode loads the repository's project settings, CLAUDE.md and skills with every hook off; Codex keeps the operator's MCP servers; Cursor still loads nothing. Every harness is handed the named keys. Each session's header says "Repo conventions: …" from the options its run gets, and names the keys. Only the server's environment sets trust. Shift Manager's fsd coder and error reporter, the Teammates lab and the Claude Code-style lab keep loading the checkout's conventions, now with hooks off and never the operator's user settings (D2). The two app copies of CURSOR_PASS go; both import the cursor package's. Goal check goals/kitchen-sink-harness/a-trusted-session-follows-the-repo passes on real Claude Code; its hooks-on and untrusted controls fail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiEz7iQL5uMFfnRQd9A
…to claude/project-thread-6j0831
|
The latest updates on your projects. Learn more about Vercel for GitHub. 4 Skipped Deployments
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Second look + architecture pass (FIX-2421)Reviewed against the approved spec direction (D1/D2), not the direction itself. Overall the approach is sound and lean: one reader, header derived from options, trust from server env only. Findings below, ranked. Nothing blocks on the design; #1 needs a check before merge. 1. Hooks-off may not cover the other self-executing project config (correctness / security, verify)
The PR's POC ( 2. The "trusted repo options" pair is copied four times (reuse / drift)
3.
|
There was a problem hiding this comment.
Simplify review (FIX-2421)
Verdict: The product shape looks right — server-only trust via readHarnessTrust, D1 through Claude Code’s settings layer, per-harness differences (Codex MCP on/off, Cursor still no project settings), D2 rollouts, and goal controls are all spec-aligned. I don’t see a materially simpler approach that still meets the verification bar (anti-game goals, hooks-off control legs, BP-031).
What did add complexity is mostly copy-paste and parallel helpers, not wrong architecture. ~half the line count is retained spec/figures/goals/tests, which is expected for this repo.
What I’d simplify (non-blocking)
-
One D1 bundle, many hosts —
{ settingSources: ["project"], settings: { disableAllHooks: true } }is duplicated in Kitchen Sink, Shift Manager, and both labs. Export something likeTRUSTED_PROJECT_REPO_OPTIONS(ortrustedProjectRepoOptions()) from@flow-state-dev/claude-code/sdk, document it next to thesettingsoption, and spread it everywhere D2 applies. Kitchen Sink still gates ontrust.trusted; hosts that always trust just spread the constant. This is the highest-leverage cleanup and reduces drift if D1 ever changes. -
Header line vs run options — Claude derives the header from
claudeCodeRepoOptions(good). Codex/Cursor use hand-written strings in*RepoLine()while MCP/env behavior lives elsewhere; over time those can disagree with what the block actually gets. Consider a single “run policy” object per mode used for both block wiring andRepoLine, or derive Codex’s conventions string from the same flagscodexClientOptionsuses (trust.trusted→ empty MCP disable list). -
Kitchen Sink trust surface —
harness-trust.tsis a thin wrapper overreadHarnessTrust+goalControl; merging intoharness-workspace.tswould match “one reader” and cut cross-imports. The three*Env()helpers are the sameharnessEnv({ pass: [...PACKAGE_PASS, ...trust.pass] })pattern — a sharedtrustedHarnessEnv(packagePass, trust, env)would be enough. -
Codex trust threading —
codexClient()closes overtruston the trusted path but untrusted MCP-discovery paths callcodexEnv()/codexClientOptions(process.env)without passing the closed-overtrust(lines called out inline). Works today via defaultharnessTrust(); passingtrustthrough makes refactors safer. -
PR breadth (process, not code) — package slice + Kitchen Sink + Shift Manager + labs + full retained spec + two goals in one PR is a lot to review. If this thread is meant to land atomically, fine; otherwise a package-first merge with a thin app follow-up can shrink review surface without changing behavior.
What looks good / keep
readHarnessTrustco-located with workspace gate (invalid pass names fail closed).settingsplumbing + argv tests inpackages/claude-code— minimal, tested merge withmcpTools.CURSOR_PASSmoved into@flow-state-dev/cursor— matches upstream-first / removes host duplication.- Trusted Codex skipping
codex mcp listis simpler and faster.
Performance
No blockers. Uncached readHarnessTrust on each harness page request is micro-cost; trusted Claude Code loading project settings per turn is the intentional dominant cost.
Skipped (needs product call, not simplify-only)
- Unifying Claude “nothing until trusted” vs Codex “AGENTS.md always” into one abstraction — behavior differs by design.
- Removing D2 hosts from this PR — spec D2 explicitly includes them.
Sent by Cursor Automation: Review For Best Approach
| * into `.claude/settings.json` for the next turn. The run works only in a | ||
| * checkout its operator named, so the conventions load with no setting. | ||
| */ | ||
| export const CLAUDE_CODE_REPO_OPTIONS = { |
There was a problem hiding this comment.
Reuse / simplify: This is the same D1 pair as Kitchen Sink (claudeCodeRepoOptions), labs/teammates/host.mts, and labs/.../harness-thread.mts. Consider exporting a single constant or factory from @flow-state-dev/claude-code/sdk (documented next to settings / settingSources in agent.ts) so D2 hosts spread one definition. Shift Manager would keep its comment about why; the literal would live in one place.
There was a problem hiding this comment.
Keeping it as it is. PR 1 deliberately ships no hooks-off default or bundle in the package. Its engineering call is that settingSources is plumbing, not policy, and that each host applies D1/D2 itself. A shared constant would put that policy back in claude-code, and it would have to change in PR 1, not here. Today the literal is four copies of two keys, and the goal check and the Shift Manager test catch a host that drifts.
Generated by Claude Code
| */ | ||
| export function claudeCodeEnv(env: Record<string, string | undefined> = process.env): Record<string, string> { | ||
| return harnessEnv({ pass: CLAUDE_CODE_PASS, env }); | ||
| export function claudeCodeRepoOptions(trust: HarnessTrust = harnessTrust()): ClaudeCodeRepoOptions { |
There was a problem hiding this comment.
Reuse: Same bundle as CLAUDE_CODE_REPO_OPTIONS in Shift Manager and the labs. If the package exports TRUSTED_PROJECT_REPO_OPTIONS, untrusted stays { settingSources: [] }, trusted spreads the export, and hooks-on goal control only omits settings — less duplication and less chance hosts diverge.
There was a problem hiding this comment.
Same answer as on the Shift Manager thread: the package keeps no policy bundle (PR 1's call), so each host writes its own two keys. Keeping it as it is.
Generated by Claude Code
| /** The header's line for a Claude Code session, read off the options its run gets. */ | ||
| export function claudeCodeRepoLine(trust: HarnessTrust = harnessTrust()): RepoLine { | ||
| const options = claudeCodeRepoOptions(trust); | ||
| const conventions = |
There was a problem hiding this comment.
Derived state: The nested ternary re-derives header text from options (spec wants header = what the run got). That’s correct for Claude Code; Codex/Cursor still hand-write strings in *RepoLine(). If you consolidate D1 in the package, consider a tiny shared helper like conventionsLabelFromRepoOptions(options) so header logic isn’t duplicated across modes with different shapes.
There was a problem hiding this comment.
Keeping it as it is. Each harness's options have a different shape, and Claude Code is the only one whose line depends on more than trusted. A shared label helper would have one caller.
Generated by Claude Code
| import { readHarnessTrust, type HarnessTrust } from "./harness-workspace"; | ||
|
|
||
| /** The server's trust, as every harness mode builds its run from it. */ | ||
| export function harnessTrust(): HarnessTrust { |
There was a problem hiding this comment.
Organization (optional): This file is mostly harnessTrust() + RepoLine. Merging into harness-workspace.ts would keep “one reader” for workspace + trust and avoid modes importing trust types from workspace and harnessTrust from a second module. Not required for merge.
There was a problem hiding this comment.
Keeping it separate on purpose. harness-workspace.ts imports nothing from Kitchen Sink and is pure over its env argument. harnessTrust() adds the goal control, which reads process.env through goal-control. The one reader of the settings is still readHarnessTrust, in harness-workspace.ts.
Generated by Claude Code
| } | ||
|
|
||
| /** The header's line for a Codex session: `AGENTS.md` always, and whether your MCP servers stay on. */ | ||
| export function codexRepoLine(trust: HarnessTrust = harnessTrust()): RepoLine { |
There was a problem hiding this comment.
Header vs block: This string is maintained separately from codexClientOptions / codexClient (trusted → skip MCP disable list). Today they align, but a single policy object (or deriving the label from trust.trusted in one helper used by both block and page) would match the Claude Code pattern and reduce drift risk.
There was a problem hiding this comment.
Keeping it as it is. Codex's line and its client options both branch on the same trust.trusted, and a test covers each side: harness-trust.test.ts for the line, and the trusted case in codex-session.test.ts for the options. Codex has no options object to derive the line from the way Claude Code does: the MCP list is read at run time.
Generated by Claude Code
| let resolver: Promise<ResolveCodexClient> | undefined; | ||
| return async (ctx) => { | ||
| if (trust.trusted) resolver ??= Promise.resolve(createDefaultResolveCodexClient(codexClientOptions(process.env, [], trust))); | ||
| resolver ??= listMcpServers(codexEnv()).then( |
There was a problem hiding this comment.
Trust threading: Trusted path passes trust into codexClientOptions (good). On the untrusted path, listMcpServers(codexEnv()) and the error fallback codexClientOptions(process.env) rely on default harnessTrust() instead of the trust closed over at factory time. Consider passing the same trust argument everywhere for consistency and safer future refactors (e.g. tests injecting trust).
There was a problem hiding this comment.
Agreed, that's a fair consistency fix. Today both paths read the same server environment, so the behaviour is the same. Passing the closed-over trust through will ride my next code push on this PR. It doesn't justify a push of its own.
Generated by Claude Code
There was a problem hiding this comment.
Code Snob — already tight. No POC.
I read the trust reader, the three Kitchen Sink mode builders, the header thread, the claude-code settings forward, Shift Manager's repo options, and the two lab call sites.
The contract is already the small shape:
readHarnessTrustis the one environment reader.harnessTrustis the test-mode override on top of it.RepoLineis what the header renders.- Each mode's
*Envis the existingharnessEnv({ pass: [...X_PASS, ...trust.pass] })call. A pass-list helper is the shape Decisions already dropped. - Claude's header line is read off
claudeCodeRepoOptions, so thehooks-oncontrol says "loaded, hooks on". Codex and Cursor report different sentences from the same trust value. One formatter would be a branch table the same length. { settingSources: ["project"], settings: { disableAllHooks: true } }is one option per host (D2). Shift Manager'sCLAUDE_CODE_REPO_OPTIONSis already shared by the coder and the error reporter. The labs are separate hosts; a shared constant needs the package policy that was dropped.settingsis one optional object, spread when set, and merged undermcpToolssodisableClaudeAiConnectorsstays last. That is the SDK's one settings bag.repoLinefollows the existing page → view → session path.SessionRepoLineis the header.
CURSOR_PASS matches the sibling env-pass.ts files. The Kitchen Sink and Teammates copies are gone. The READMEs and the changeset are that option's public surface.
Files: apps/kitchen-sink/lib/harness-workspace.ts, harness-trust.ts, claude-code-mode.ts, codex-mode.ts, cursor-mode.ts, components/harness-mode-page.tsx, harness-mode-view.tsx, harness-session.tsx, packages/claude-code/src/sdk/agent.ts, packages/shift-manager/teams/devteam/harness.mts, labs/claude-code-style/workforce/flows/harness-thread.mts, labs/teammates/host.mts, packages/cursor/src/env-pass.ts.
Sent by Cursor Automation: Code Snob
…ame the fake Claude CLI as an entry; thread Codex trust through (FIX-2421) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiEz7iQL5uMFfnRQd9A
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 67971b2304
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "@flow-state-dev/claude-code": minor | ||
| "@flow-state-dev/cursor": minor |
There was a problem hiding this comment.
Use patch bumps for the additive package APIs
Both packages are pre-1.0, and these changes only add an optional settings parameter and the CURSOR_PASS export; existing callers retain their behavior. The BP-022 release policy mandated by AGENTS.md requires patch for additive APIs and reserves minor for breaking changes. Marking both as minor unnecessarily moves them outside consumers' existing caret-compatible version ranges. Change both entries to patch.
AGENTS.md reference: AGENTS.md:L30-L30
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Right. BP-022 (docs/contributing/best-practices.md) says pre-1.0 additive API is patch. Both entries are now patch.
Generated by Claude Code
… patch bumps pre-1.0 (BP-022, FIX-2421) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiEz7iQL5uMFfnRQd9A
…to claude/project-thread-6j0831
… (FIX-2421) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiEz7iQL5uMFfnRQd9A
…to claude/project-thread-6j0831
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiEz7iQL5uMFfnRQd9A
…to claude/project-thread-6j0831
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiEz7iQL5uMFfnRQd9A
…to claude/project-thread-6j0831
…to claude/project-thread-6j0831
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiEz7iQL5uMFfnRQd9A
…to claude/project-thread-6j0831
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiEz7iQL5uMFfnRQd9A
…to claude/project-thread-6j0831
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiEz7iQL5uMFfnRQd9A
…to claude/project-thread-6j0831
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiEz7iQL5uMFfnRQd9A
…to claude/project-thread-6j0831
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiEz7iQL5uMFfnRQd9A
…to claude/project-thread-6j0831
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiEz7iQL5uMFfnRQd9A
…to claude/project-thread-6j0831
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiEz7iQL5uMFfnRQd9A
…to claude/project-thread-6j0831
|
Changesets name their Linear issue fails here on
Generated by Claude Code |
…to claude/project-thread-6j0831


Requested by Jake · project thread
The problem
A Kitchen Sink session on flow-state-dev sees no
CLAUDE.md, no skills and no Linear, so it is a worse agent than the CLI in a terminal. Shift Manager and the labs have the opposite problem: they load the repository's settings with its hooks on, and two of them also load the operator's own Claude Code settings. A hook runs by itself, shows in no transcript, and a turn can write one for the next turn.What this does
KITCHEN_SINK_HARNESS_WORKSPACE:KITCHEN_SINK_HARNESS_TRUSTED=1andKITCHEN_SINK_HARNESS_PASS=LINEAR_API_KEY,GH_TOKEN. Only the server's environment sets trust; a request that claims it changes nothing (BP-031). Off on Vercel.CLAUDE.mdand skills, withsettings: { disableAllHooks: true }above them (D1). Neverusersettings.AGENTS.mdloads either way.CURSOR_PASSare deleted. Kitchen Sink and Teammates import the cursor package's list, which is byte-identical.What's asked of you
Nothing new to decide. This applies the spec's signed decisions (D1 hooks off; D2 the same rule in Shift Manager and the labs).
Merge order. This is fifth on the
harness-session.tsxstack (2410 → 2386 → 2384 → 2398 → 2421) and is based on FIX-2398's branch. It also carries PR 1, the package slice, as one commit applied from its patch (0a4bbf2), because that branch isn't pushed yet. When PR 1's branch exists, I merge it in here. Merge this only after PR 1 and FIX-2398.Parts worth reviewing closely
apps/kitchen-sink/lib/harness-workspace.ts→readHarnessTrust: only1turns it on; names are read only when trusted; a bad name turns the harness modes off with a reason instead of being skipped.apps/kitchen-sink/lib/claude-code-mode.ts→claudeCodeRepoOptions/claudeCodeRepoLine: the header is derived from the options, so thehooks-oncontrol reads "loaded, hooks on".apps/kitchen-sink/lib/codex-mode.ts→codexClient: trusted, it never lists MCP servers, so nothing is turned off.How to review this: altitude, what's in scope, what's deliberately unsettled
Engineering calls: decided along the way, no product sign-off needed
KITCHEN_SINK_HARNESS_TRUSTED,KITCHEN_SINK_HARNESS_PASS. Only1means on. Wrong cost: one rename.service_tier: "default"when trusted. Trust is about the repository, not the account's spend.GOAL_HOST_PASS,GOAL_PERMISSION_MODE=default) let it run here. Both are ingoal.md, and neither changes what the run loads.Everything else: verification, red states, files
Goal check
goals/kitchen-sink-harness/a-trusted-session-follows-the-repo/, real Claude Code (CLI 2.1.316, Agent SDK 0.3.234), three turns throughclaudeCodeSessionFlow, each turn's input claimingtrusted: true:zebra-checklisted, named key printed, no hook marker after three turns, header "loaded, hooks off" naming the key.GOAL_CONTROL=hooks-on: FAIL (expected) onhooks:offandheaderonly. A first run of this control also missed the code word (a model miss); the rerun named it. Both are logged.GOAL_CONTROL=untrusted: FAIL (expected) on code word ("NONE"), skill ("NO"), named key and header, with every turn claiming trust.Red before green (each mutation applied, the named test failed, then reverted):
harness-session.test.ts"trusted … every hook off" fails.harness-trust.test.ts"only1turns it on" fails.harness-trust.test.tsand the Codex untrusted-key case fail.codex-session.test.tstrusted case fails.harness-session-repo-line.test.tsxcases fail.mcp-servers.test.ts"the harness a Lab runs" fails.Green
command.test.tsbecause this container has no built pages (dist-client), unrelated to this change.Known gaps
specs/issues/FIX-2421/poc/project-settings-hooks/facts.mjsdescribes the state before this PR and no longer matches it, as intended.Changeset: none. Kitchen Sink, Shift Manager's team files and the labs are private.
Files
apps/kitchen-sink/lib/harness-workspace.ts: the two settings,readHarnessTrust.apps/kitchen-sink/lib/harness-trust.ts: the server's trust (with theuntrustedgoal control) and theRepoLinetype.apps/kitchen-sink/lib/{claude-code,codex,cursor}-mode.ts: each mode's options, env and header line; Cursor'sCURSOR_PASScopy deleted.apps/kitchen-sink/components/harness-{mode-page,mode-view,session}.tsx: the header line.packages/shift-manager/teams/devteam/harness.mts,labs/teammates/host.mts(itsCURSOR_PASScopy deleted),labs/claude-code-style/workforce/flows/harness-thread.mts.apps/kitchen-sink/test/harness-trust.test.ts,harness-session-repo-line.test.tsx, additions toharness-session,codex-sessionandcursor-sessiontests;packages/shift-manager/test/mcp-servers.test.ts.apps/kitchen-sink/README.md, and the goal check.Spec:
specs/issues/FIX-2421/(spec PR #4407) · Linear FIX-2421 · epic FIX-2369.Generated by Claude Code