Skip to content

FE-881: Cook agent loads the target repo's sandbox-scoped skills#227

Open
kostandinang wants to merge 4 commits into
ka/fe-864-pi-timeout-600sfrom
ka/fe-881-cook-agent-skills
Open

FE-881: Cook agent loads the target repo's sandbox-scoped skills#227
kostandinang wants to merge 4 commits into
ka/fe-864-pi-timeout-600sfrom
ka/fe-881-cook-agent-skills

Conversation

@kostandinang

@kostandinang kostandinang commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Stack Context

Stacks on FE-864 (#224). A refinement of cook-codebase-mode + the cook-time grounding direction (D160-K intact -- this is run-time, not the emitter). FE-881.

What?

  • cookResourceLoader(sandboxDir, agentDir, systemPrompt) -- points pi's discovery at the repo's .agents/skills / .claude/skills (deduped by realpath, since brunch-style repos symlink the two), then filters the result to paths under the sandbox via sandboxScopedSkills. pi's default discovery scans <cwd>/<config>/skills + <agentDir>/skills, not the Agent-Skills dirs, so the explicit additionalSkillPaths are required.
  • sandboxScopedSkills(skills, sandboxDir) -- pure filter: keeps only skills whose path resolves under the sandbox; drops global, sibling-slice, and prefix-lookalike paths.
  • The catalog reaches the model through pi's custom-prompt path (formatSkillsForPrompt, gated on the read tool -- every cook action has it), so the task-prompt override does not suppress it.

Why?

Brownfield cook builds on the user's repo, so the agent should see that repo's own skills and conventions. buildSessionOptions previously stripped all skills for hermeticity. This narrows the guarantee from "no skills" to "no skills from outside the repo" -- the cook agent gains the target codebase's configured skills while the developer's machine-global pi config still never leaks in.

Behavior / scope

  • Greenfield worktrees have no .agents/skills, so skills resolve empty and greenfield behavior is unchanged (protecting invariant).
  • Deferred follow-ons (separate slices): loading the repo's AGENTS.md/CLAUDE.md conventions; a project-trust gate for repo-authored skills.

Tests

npm run verify green (2060 passed, 2 skipped, build OK). New unit test pins sandboxScopedSkills (under / sibling / prefix-lookalike / global); new fs-integration test pins cookResourceLoader discovering the repo's .agents/skills and excluding an agentDir (global) skill.

@kostandinang kostandinang changed the title FE-881: cook agent loads the target repo's sandbox-scoped skills FE-881: Cook agent loads the target repo's sandbox-scoped skills Jun 17, 2026
@kostandinang kostandinang marked this pull request as ready for review June 17, 2026 12:40
@cursor

cursor Bot commented Jun 17, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes cook agent context (repo skills) and slice status events that drive the UI and retry net—behavior shifts for brownfield runs and failed evaluations, though tests cover the new paths.

Overview
FE-881 — sandbox-scoped skills for brownfield cook: Replaces the “no skills” session loader with cookResourceLoader / sandboxScopedSkills, discovering .agents/skills and .claude/skills (deduped by realpath), filtering to paths under the worktree, and excluding global agentDir skills. Greenfield worktrees without those dirs stay unchanged.

Slice lifecycle / Petri net alignment: evaluate-done no longer emits terminal failed on NEEDS WORK—only passed when done—so the net can route to needs-more via reports. The run-tests handler drops an extra failed slice event on non-exhaustion retries. runVerification leaves failureKind undefined when there are zero targets.

CLI / presenter / platform: Promotion errors emit cook-done with ok: false and a reason before exit. The brigade plate phase only advances on lines matching ✓ promoted, not generic “promoted” text. Activity heartbeats respect the 56-character cap including the ellipsis. Windows directory symlinks in copyMissingTopLevelEntries use junctions. app-probe.test.ts removes a duplicated hung-probe describe block.

Reviewed by Cursor Bugbot for commit d598bb0. Bugbot is set up for automated code reviews on this repo. Configure here.

kostandinang and others added 2 commits June 17, 2026 13:50
Brownfield cook builds on the user's repo, so the agent should see that repo's
own skills. buildSessionOptions previously stripped all skills for hermeticity;
narrow that from "no skills" to "no skills from outside the repo":

- cookResourceLoader points pi's discovery at the repo's .agents/skills /
  .claude/skills (deduped by realpath; pi's defaults scan <cwd>/<config>/skills
  + <agentDir>/skills, not the Agent-Skills dirs) and filters the result to paths
  under the sandbox via sandboxScopedSkills.
- The skill catalog reaches the model through pi's custom-prompt path
  (formatSkillsForPrompt, gated on the read tool — every cook action has it).
- Greenfield worktrees have no such dir, so skills resolve empty and behavior is
  unchanged (protecting invariant).

Deferred follow-ons: AGENTS.md/conventions loading, a project-trust gate.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Keep retryable slice work non-terminal in the UI, emit completion on promotion failures, and clean up misleading verification/test signals reported by the stack review bots.

Co-authored-by: Cursor <cursoragent@cursor.com>
@kostandinang kostandinang force-pushed the ka/fe-881-cook-agent-skills branch from 433f0e2 to c7ba5fd Compare June 17, 2026 12:51
kostandinang and others added 2 commits June 17, 2026 13:52
Include the leading ellipsis in the heartbeat truncation budget so progress details respect the configured maximum length.

Co-authored-by: Cursor <cursoragent@cursor.com>
Pass a directory link type when sharing node_modules on Windows so lazy slice seeding can link folder targets reliably.

Co-authored-by: Cursor <cursoragent@cursor.com>
@kostandinang kostandinang changed the base branch from ka/fe-864-pi-timeout-600s to graphite-base/227 June 17, 2026 13:12
@kostandinang kostandinang changed the base branch from graphite-base/227 to ka/fe-864-pi-timeout-600s June 17, 2026 18:02
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