Commit Graph

1812 Commits

Author SHA1 Message Date
Dave
44bc82d23a Story 43: Unified chat UI for Claude Code and regular chat
Integrate Claude Code provider into the chat UI alongside regular
Ollama/Anthropic providers. Updates AgentPanel and Chat components.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 14:26:40 +00:00
Dave
42c21f680b Accept story 42: Deterministic Worktree Management via REST/MCP API
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 14:22:24 +00:00
Dave
a9d45bbcd5 Story 42: Deterministic worktree management via REST/MCP API
Add REST and MCP endpoints for creating, listing, and removing worktrees.
Includes worktree lifecycle management and cleanup operations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 14:22:09 +00:00
Dave
91534b4a59 Accept story 38: Auto-Open Project on Server Startup
Server detects .story_kit/ in cwd or parent directories at startup and
automatically opens the project. MCP tools work immediately without
manual project-open step. Falls back to cwd when no .story_kit/ found.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 14:11:53 +00:00
Dave
54d34d1a85 Add story 44: Agent Completion Report via MCP
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 14:09:11 +00:00
Dave
f6f4d84c54 Add coder-3 agent to project config
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 13:37:10 +00:00
Dave
ea30faff95 Move story 43 to current: Unified Chat UI
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 13:36:00 +00:00
Dave
90e90f4428 Add story 43: Unified chat UI for Claude Code and regular chat
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 13:34:10 +00:00
Dave
e23d723ac2 Move story 38 to current: Auto-Open Project on Server Startup
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 13:29:15 +00:00
Dave
c9b33b2107 Move story 42 to current: Deterministic Worktree Management
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 13:29:05 +00:00
Dave
4c5bfe9bce Accept story 40: MCP Server Obeys STORYKIT_PORT
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 13:27:18 +00:00
Dave
022ba4ed47 Accept story 33: Copy-paste diff commands for agent worktrees
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 13:26:34 +00:00
Dave
c1eaa2da2e Accept story 33: Copy-paste diff commands for agent worktrees
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 13:25:52 +00:00
Dave
a3c20eb4d4 Accept story 40: MCP Server Obeys STORYKIT_PORT
Agent worktrees now get a .mcp.json written with the correct port from
the running server. AgentPool receives the port at construction and
passes it through to create_worktree, which writes .mcp.json on both
new creation and reuse.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 13:24:35 +00:00
Dave
ce37a70f9a Archive bugs 2-3, file bug 4: Run button does not start agent
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 13:17:48 +00:00
Dave
1eae2410f3 Fix bugs 2 and 3: agent panel expand and stale worktree references
Bug 2: Expand triangle now works when no agents are started - shows
"No agents started" message. AgentPanel moved to top of panels.

Bug 3: Run `git worktree prune` before `git worktree add` to clean
stale references from externally-deleted worktree directories.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 13:17:20 +00:00
Dave
c6a04f5e53 Accept story 41: Agent Completion Notification via MCP
Add wait_for_agent MCP tool that blocks until an agent reaches a terminal
state (completed, failed, stopped). Returns final status with session_id,
worktree_path, and git commits made by the agent.

- Subscribe-before-check pattern avoids race conditions
- Handles lagged receivers, channel closure, and configurable timeout
- Default timeout 5 minutes, includes git log of agent commits in response
- 11 new tests covering all paths

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 13:16:04 +00:00
Dave
fa5d013fe2 Add auto-commit criterion to story 42
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 13:13:55 +00:00
Dave
665d27b779 Add story 42: Deterministic worktree management via REST/MCP API
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 13:02:35 +00:00
Dave
0d48370ac0 Move story 41 to current: Agent Completion Notification via MCP
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 12:54:07 +00:00
Dave
4605db13de Add story 41: Agent Completion Notification via MCP
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 12:52:10 +00:00
Dave
39b67ff754 Story 33: Copy-paste diff commands for agent worktrees
- Add base_branch detection to WorktreeInfo (from project root HEAD)
- Expose base_branch in AgentInfo API response
- Add {{base_branch}} template variable to agent config rendering
- Show git difftool command with copy-to-clipboard in AgentPanel UI
- Add diff command instruction to coder agent prompts
- Add AgentPanel tests for diff command rendering and clipboard

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 12:48:50 +00:00
Dave
1cd1d318d3 Log bugs 2 and 3: agent panel expand and stale worktree issues
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 12:47:01 +00:00
Dave
1064b50f86 Update agent prompts: read README, commit work, tiered acceptance
- Supervisor reads CLAUDE.md and README before coordinating
- Coders commit their work before finishing
- All agents stop at "gates green" - never accept or merge
- Human always does final acceptance and merge to master

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 12:42:19 +00:00
Dave
00f8d16bb0 Move story 33 to current
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 12:26:57 +00:00
Dave
b3800beb61 Move story 40 to current: MCP Server Obeys STORYKIT_PORT
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 12:25:54 +00:00
Dave
dcc254f9aa Add story 40: MCP Server Obeys STORYKIT_PORT
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 12:24:03 +00:00
Dave
6e359c6bfe Rewrite story 33: copy-paste diff commands using git difftool
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 12:15:08 +00:00
Dave
db2d055f60 Spike 3: Sub-agent infrastructure fixes for multi-agent coordination
- Fix CLAUDECODE env var blocking nested Claude Code sessions
- Add drain-based event_log for reliable get_agent_output polling
- Add non-SSE get_agent_output fallback (critical for MCP tool calls)
- Preserve worktrees on agent stop instead of destroying work
- Reap zombie processes with child.wait() after kill
- Increase broadcast buffer from 256 to 1024
- Engineer supervisor and coder prompts in project.toml
- Point .mcp.json to test port 3002

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 12:14:36 +00:00
Dave
b089d314ba Add user testing step to bug workflow before merge
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 12:03:22 +00:00
Dave
3e99929d03 Fix bug 1: Only fetch Anthropic models when API key exists
getAnthropicModels() was called unconditionally on mount, causing a
console error when no API key was set. Now chains the call after
getAnthropicApiKeyExists() confirms a key is present.

Includes regression test added before the fix per bug workflow.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 12:01:47 +00:00
Dave
e12985f40c Add bugs directory structure to .story_kit
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 11:57:18 +00:00
Dave
44fdaf4fd6 Update bug workflow: require failing test first and worktree
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 11:54:55 +00:00
Dave
cde75bd7fb Accept story 39: Persistent Claude Code Sessions in Web UI
Use --resume <session_id> with claude -p so the web UI claude-code-pty
provider maintains full conversation context across messages, identical
to a long-running terminal Claude Code session.

Changes:
- Capture session_id from claude -p stream-json system event
- Pass --resume on subsequent messages in same chat session
- Thread session_id through ProviderConfig, ChatResult, WsResponse
- Frontend stores sessionId per chat, clears on New Session
- Unset CLAUDECODE env to allow nested spawning from server
- Wait for clean process exit to ensure transcript flush to disk

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 11:51:19 +00:00
Dave
cff7f5fe7f Add worktree port configuration docs to STACK.md
Documents STORYKIT_PORT env var for running multiple instances
in parallel worktrees without port conflicts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 11:37:29 +00:00
Dave
8724ec1cbc Move Claude Code permissions to committed settings for worktree sharing
Agents running in git worktrees weren't inheriting permissions from
settings.local.json since it's path-specific. Moving the allowlist to
the committed settings.json ensures all worktrees get pre-approved
permissions automatically.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 11:30:28 +00:00
Dave
b2d0267f23 Updated portable-pty 2026-02-20 11:19:01 +00:00
Dave
a6ea64cca7 Add story 39: Persistent Claude Code Sessions in Web UI
Use --resume <session-id> with claude -p to maintain conversation
context across messages in the web UI claude-code-pty provider.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 11:16:17 +00:00
Dave
94d05c905b Noting existence of mcp server 2026-02-19 19:46:48 +00:00
Dave
6ea44fb5c4 Add story 38: Auto-Open Project on Server Startup
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 19:37:07 +00:00
Dave
45f1234a06 Accept spike 2: MCP HTTP endpoint for workflow and agent tools
Adds POST /mcp endpoint speaking MCP Streamable HTTP (JSON-RPC 2.0)
with 12 tools for workflow management and agent orchestration.
Supports both JSON and SSE response modes. Includes real-time agent
output streaming over SSE, Content-Type validation, and 15 integration
tests (134 total).

Tools: create_story, validate_stories, list_upcoming, get_story_todos,
record_tests, ensure_acceptance, start_agent, stop_agent, list_agents,
get_agent_config, reload_agent_config, get_agent_output.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 19:34:03 +00:00
Dave
8f095a3ec9 Renamed worktree diff story 2026-02-19 19:03:59 +00:00
Dave
6d57b06636 Accept story 34: Per-Project Agent Configuration and Role Definitions
Replace single [agent] config with multi-agent [[agent]] roster system.
Each agent has name, role, model, allowed_tools, max_turns, max_budget_usd,
and system_prompt fields that map to Claude CLI flags at spawn time.

- AgentConfig expanded with structured fields, validated at startup (panics
  on duplicate names, empty names, non-positive budgets/turns)
- Backwards-compatible: legacy [agent] format auto-wraps with deprecation warning
- AgentPool uses composite "story_id:agent_name" keys for concurrent agents
- agent_name added to AgentEvent variants, AgentInfo, start/stop/subscribe APIs
- GET /agents/config returns roster, POST /agents/config/reload hot-reloads
- POST /agents/start accepts optional agent_name, /agents/stop requires it
- SSE route updated to /agents/:story_id/:agent_name/stream
- Frontend: roster badges, agent selector dropdown, composite-key state
- Project root initialized to cwd at startup so config endpoints work immediately

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 18:46:14 +00:00
Dave
f9fc2472fd Splitting up the editor and diff stories 2026-02-19 18:22:19 +00:00
Dave
8c2dc9b6a0 Finishing agent merge 2026-02-19 18:05:21 +00:00
Dave
c94b3d4450 Accept story 36: Enforce Front Matter on All Story Files
Add POST /workflow/stories/create endpoint that auto-assigns story
numbers, generates correct front matter, and writes to upcoming/.
Add slugify_name and next_story_number helpers with full test coverage.
Add frontend createStory API method and types.
Update README to recommend creation API for agents.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 18:02:48 +00:00
Dave
5e5cdd9b2f Accept story 30: Worktree-based agent orchestration
Add git worktree isolation for concurrent story agents. Each agent now
runs in its own worktree with setup/teardown commands driven by
.story_kit/project.toml config. Agents stream output via SSE and support
start/stop lifecycle with Pending/Running/Completed/Failed statuses.

Backend: config.rs (TOML parsing), worktree.rs (git worktree lifecycle),
refactored agents.rs (broadcast streaming), agents_sse.rs (SSE endpoint).
Frontend: AgentPanel.tsx with Run/Stop buttons and streaming output log.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 17:58:53 +00:00
Dave
7e56648954 Use STORYKIT_PORT for both backend and frontend, add .story_kit_port to ignore files
Single env var STORYKIT_PORT configures backend port, frontend proxy target,
frontend dev server port (port + 2172), and WebSocket host. Added .story_kit_port
to .gitignore and .ignore to prevent git tracking and cargo watch restart loops.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 17:29:50 +00:00
Dave
f7902c3569 Merge story-32: Multi-Instance Worktree Support
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

# Conflicts:
#	.story_kit/stories/archived/32_multi_instance_worktree_support.md
#	.story_kit/stories/current/30_worktree_agent_orchestration.md
#	.story_kit/stories/current/32_multi_instance_worktree_support.md
#	.story_kit/stories/current/36_enforce_story_front_matter.md
#	.story_kit/stories/upcoming/29_directory_based_workflow_coordination.md
#	.story_kit/stories/upcoming/32_worktree_agent_orchestration.md
#	.story_kit/stories/upcoming/33_worktree_diff_and_editor_integration.md
#	.story_kit/stories/upcoming/34_agent_configuration_and_roles.md
#	.story_kit/stories/upcoming/35_agent_security_and_sandboxing.md
2026-02-19 17:17:21 +00:00
Dave
e54209eb5a Story 32: Multi-Instance Worktree Support
Add configurable port via STORYKIT_PORT env var (default 3001). Server
prints machine-readable STORYKIT_PORT=<port> on startup and writes
.story_kit_port file for discovery. Frontend proxy and WebSocket read
VITE_STORYKIT_PORT env var instead of hardcoding port 3001.

7 new tests (4 backend, 3 frontend) all passing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 17:14:33 +00:00