From 9864e0a9e661d25076bf36f675768ba3e795ba63 Mon Sep 17 00:00:00 2001 From: Dave Date: Thu, 19 Feb 2026 14:53:44 +0000 Subject: [PATCH] Finished a few more stories --- .gitignore | 1 + .../29_backfill_tests_high_coverage.md | 0 .../32_worktree_agent_orchestration.md | 46 +++++++++++++++++++ 3 files changed, 47 insertions(+) rename .story_kit/stories/{upcoming => archived}/29_backfill_tests_high_coverage.md (100%) create mode 100644 .story_kit/stories/upcoming/32_worktree_agent_orchestration.md diff --git a/.gitignore b/.gitignore index 0f7523f..5690467 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ yarn-error.log* pnpm-debug.log* lerna-debug.log* +node_modules frontend/node_modules frontend/dist frontend/dist-ssr diff --git a/.story_kit/stories/upcoming/29_backfill_tests_high_coverage.md b/.story_kit/stories/archived/29_backfill_tests_high_coverage.md similarity index 100% rename from .story_kit/stories/upcoming/29_backfill_tests_high_coverage.md rename to .story_kit/stories/archived/29_backfill_tests_high_coverage.md diff --git a/.story_kit/stories/upcoming/32_worktree_agent_orchestration.md b/.story_kit/stories/upcoming/32_worktree_agent_orchestration.md new file mode 100644 index 0000000..c7f3ae1 --- /dev/null +++ b/.story_kit/stories/upcoming/32_worktree_agent_orchestration.md @@ -0,0 +1,46 @@ +# Story 32: Worktree-Based Agent Orchestration + +## User Story +As a user, I want to press a button in the frontend to spin up an agent that works on a story in its own git worktree, so that multiple stories can be worked on concurrently without branch conflicts. + +## Acceptance Criteria +- [ ] The Rust binary can create a git worktree for a given story, on a new feature branch. +- [ ] The Rust binary can remove a git worktree and clean up the feature branch after story completion. +- [ ] Project-specific setup commands (e.g., dependency install) are configurable per-project, not hardcoded to any language or framework. +- [ ] The Rust binary can spawn an agent process (e.g., Claude Code CLI) pointed at the worktree directory. +- [ ] The backend exposes an API endpoint to start an agent for a given story (creates worktree, runs setup, spawns agent). +- [ ] The backend exposes an API endpoint to stop a running agent and optionally tear down its worktree. +- [ ] The backend tracks running agents and their status (idle/running/done/error). +- [ ] The frontend displays a "Run" button on stories that are ready to be worked on. +- [ ] The frontend shows agent status (running/done/error) for active stories. +- [ ] Agent stdout/stderr is streamed to the frontend in real time (via WebSocket or SSE). + +## Configuration +Agent and worktree behavior is driven by a project-level config file (e.g., `.story_kit/config.toml`), keeping the Rust binary language-agnostic. Projects can define multiple components, each with their own working directory and setup/teardown commands: + +```toml +[[component]] +name = "server" +path = "." # relative to worktree root +setup = ["cargo check"] +teardown = [] + +[[component]] +name = "frontend" +path = "frontend" +setup = ["pnpm install"] +teardown = [] + +[agent] +command = "claude" +args = ["--print", "--directory", "{{worktree_path}}"] +prompt = "Read .story_kit/README.md, then pick up story {{story_id}}" +``` + +Components are set up in order. Each `path` is relative to the worktree root. + +## Out of Scope +- Coordinating merges to master when multiple agents finish simultaneously (see Story 31). +- Lock file implementation for multi-agent conflict prevention (see Story 31). +- Port management for dev servers within worktrees. +- Agent-to-agent communication.