421 Commits

Author SHA1 Message Date
Dave
7451cb7170 story-kit: done 290_story_show_agent_output_stream_in_expanded_work_item_detail_panel 2026-03-18 15:32:01 +00:00
Dave
83ccfece81 story-kit: merge 290_story_show_agent_output_stream_in_expanded_work_item_detail_panel 2026-03-18 15:31:58 +00:00
Dave
68bf179407 story-kit: create 292_story_show_server_logs_in_web_ui 2026-03-18 15:27:56 +00:00
Dave
c35c05d02c story-kit: done 289_bug_rebuild_and_restart_mcp_tool_does_not_rebuild 2026-03-18 15:27:37 +00:00
Dave
3adae6c475 story-kit: merge 289_bug_rebuild_and_restart_mcp_tool_does_not_rebuild 2026-03-18 15:27:29 +00:00
Dave
c4753b51de story-kit: accept 281_story_matrix_bot_announces_itself_when_it_comes_online 2026-03-18 15:26:36 +00:00
Dave
e7a73e7322 story-kit: done 284_story_matrix_bot_status_command_shows_pipeline_and_agent_availability 2026-03-18 15:22:34 +00:00
Dave
e8ec84668f story-kit: merge 284_story_matrix_bot_status_command_shows_pipeline_and_agent_availability 2026-03-18 15:22:19 +00:00
Dave
8d9cf4b283 story-kit: create 291_story_show_test_results_in_work_item_detail_panel 2026-03-18 15:18:47 +00:00
Dave
a8cb38fe27 story-kit: done 273_story_matrix_bot_sends_typing_indicator_while_waiting_for_claude_response 2026-03-18 15:17:50 +00:00
Dave
dd83e0f4ee fix: biome formatting in Chat.test.tsx and ChatInput.tsx
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 15:07:49 +00:00
Dave
3923aafb71 story-kit: done 288_bug_ambient_mode_state_lost_on_server_restart 2026-03-18 15:01:44 +00:00
Dave
8fcfadcb04 story-kit: merge 288_bug_ambient_mode_state_lost_on_server_restart 2026-03-18 15:01:40 +00:00
Dave
7c023c6beb story-kit: done 285_story_matrix_bot_help_command_lists_available_bot_commands 2026-03-18 14:57:30 +00:00
Dave
e7bb8db7c1 story-kit: merge 285_story_matrix_bot_help_command_lists_available_bot_commands 2026-03-18 14:57:27 +00:00
Dave
727da0c6d0 story-kit: create 290_story_show_agent_output_stream_in_expanded_work_item_detail_panel 2026-03-18 14:50:35 +00:00
Dave
257ee05ac6 story-kit: accept 266_story_matrix_bot_structured_conversation_history 2026-03-18 14:49:40 +00:00
Dave
b9f3505738 story-kit: create 289_bug_rebuild_and_restart_mcp_tool_does_not_rebuild 2026-03-18 14:42:24 +00:00
Dave
be56792c6e story-kit: create 289_bug_rebuild_and_restart_mcp_tool_does_not_rebuild 2026-03-18 14:41:46 +00:00
Dave
9daaae2d43 story-kit: create 288_bug_ambient_mode_state_lost_on_server_restart 2026-03-18 14:37:16 +00:00
Dave
c85d02a3ef story-kit: done 287_story_rename_upcoming_pipeline_stage_to_backlog 2026-03-18 14:33:11 +00:00
Dave
df6f792214 story-kit: merge 287_story_rename_upcoming_pipeline_stage_to_backlog 2026-03-18 14:33:08 +00:00
Dave
967ebd7a84 story-kit: accept 271_story_show_assigned_agent_in_expanded_work_item_view 2026-03-18 14:30:43 +00:00
Dave
3bc44289b9 story-kit: accept 279_story_auto_assign_should_respect_agent_stage_when_front_matter_specifies_agent 2026-03-18 14:18:28 +00:00
Dave
17f6bae573 story-kit: done 286_story_server_self_rebuild_and_restart_via_mcp_tool 2026-03-18 14:09:13 +00:00
Dave
baa8bdcfda story-kit: merge 286_story_server_self_rebuild_and_restart_via_mcp_tool 2026-03-18 14:09:09 +00:00
Dave
33492c49fa fix: QA agents must not pkill -f story-kit (kills vite dev server)
Change pkill pattern to 'target.*story-kit' to only match the Rust
binary, not any process with story-kit in its working directory.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 14:08:07 +00:00
Dave
63a90195e7 Update Cargo.lock version to 0.3.1
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-18 14:06:58 +00:00
Dave
7bd390c762 story-kit: accept 92_spike_stop_auto_committing_intermediate_pipeline_moves 2026-03-18 14:06:26 +00:00
Dave
0d581ab459 story-kit: accept 278_story_auto_assign_agents_to_pipeline_items_on_server_startup 2026-03-18 14:02:46 +00:00
Dave
42f88cc172 story-kit: create 287_story_rename_upcoming_pipeline_stage_to_backlog 2026-03-18 13:52:06 +00:00
Dave
945648bf6e story-kit: create 280_story_long_running_supervisor_agent_with_periodic_pipeline_polling 2026-03-18 13:51:32 +00:00
Dave
bc5a3da2c0 story-kit: create 286_story_server_self_rebuild_and_restart_via_mcp_tool 2026-03-18 13:43:54 +00:00
Dave
04e841643e story-kit: accept 274_story_mcp_pipeline_status_tool_with_agent_assignments 2026-03-18 13:25:50 +00:00
Dave
3d97b0b95a story-kit: done 285_story_matrix_bot_help_command_lists_available_bot_commands 2026-03-18 13:07:48 +00:00
Dave
8f4cb9475c story-kit: done 284_story_matrix_bot_status_command_shows_pipeline_and_agent_availability 2026-03-18 13:01:51 +00:00
Dave
8f63cfda07 story-kit: done 279_story_auto_assign_should_respect_agent_stage_when_front_matter_specifies_agent 2026-03-18 12:58:08 +00:00
Dave
1b3843d913 story-kit: done 278_story_auto_assign_agents_to_pipeline_items_on_server_startup 2026-03-18 12:50:48 +00:00
Dave
4c898996a2 story-kit: done 274_story_mcp_pipeline_status_tool_with_agent_assignments 2026-03-18 12:50:21 +00:00
Dave
281531624d story-kit: done 283_bug_pipeline_does_not_check_manual_qa_flag_before_advancing_from_qa_to_merge 2026-03-18 12:34:46 +00:00
Dave
b09a2cbdf9 story-kit: done 273_story_matrix_bot_sends_typing_indicator_while_waiting_for_claude_response 2026-03-18 12:30:30 +00:00
Dave
a0c1457757 story-kit: done 92_spike_stop_auto_committing_intermediate_pipeline_moves 2026-03-18 12:16:09 +00:00
Dave
e818ac986d story-kit: create 92_spike_stop_auto_committing_intermediate_pipeline_moves 2026-03-18 12:15:09 +00:00
Dave
b29f6628f8 story-kit: create 278_story_auto_assign_agents_to_pipeline_items_on_server_startup 2026-03-18 12:15:02 +00:00
Dave
4dc4fef83b story-kit: create 247_story_human_qa_gate_with_rejection_flow 2026-03-18 12:14:54 +00:00
Dave
7ef85c459c story-kit: create 279_story_auto_assign_should_respect_agent_stage_when_front_matter_specifies_agent 2026-03-18 12:13:36 +00:00
Dave
f6058a50b9 story-kit: create 274_story_mcp_pipeline_status_tool_with_agent_assignments 2026-03-18 12:13:20 +00:00
Dave
d347ba084d story-kit: done 282_story_matrix_bot_ambient_mode_toggle_via_chat_command 2026-03-18 12:12:26 +00:00
Dave
b50d007b40 story-kit: merge 282_story_matrix_bot_ambient_mode_toggle_via_chat_command 2026-03-18 12:12:19 +00:00
Dave
ed3d7311d1 story-kit: create 285_story_matrix_bot_help_command_lists_available_bot_commands 2026-03-18 12:06:34 +00:00
Dave
e7aef3edc7 story-kit: create 284_story_matrix_bot_status_command_shows_pipeline_and_agent_availability 2026-03-18 12:06:02 +00:00
Dave
d5a93fe726 story-kit: create 283_bug_pipeline_does_not_check_manual_qa_flag_before_advancing_from_qa_to_merge 2026-03-18 12:00:08 +00:00
Dave
7e45a1fba0 Bump version to 0.3.1
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 11:49:22 +00:00
Dave
ad348e813f Update Cargo.lock
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 11:49:02 +00:00
Dave
de5dcceeaf story-kit: done 281_story_matrix_bot_announces_itself_when_it_comes_online 2026-03-18 11:48:19 +00:00
Dave
53fdcfec75 story-kit: merge 281_story_matrix_bot_announces_itself_when_it_comes_online 2026-03-18 11:48:15 +00:00
Dave
bad680cf24 story-kit: create 282_story_matrix_bot_ambient_mode_toggle_via_chat_command 2026-03-18 11:47:51 +00:00
Dave
a5e64ded83 fix: unused system_prompt variable warning
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 11:44:16 +00:00
Dave
77e368d354 fix: --system is not a valid Claude Code CLI flag
Removed the --system argument from the PTY runner — Claude Code CLI
doesn't support it. Bot name instruction is now prepended to the user
prompt instead of passed as a system prompt argument.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 11:42:39 +00:00
Dave
db92a78d2b story-kit: accept 276_story_detect_and_log_when_root_mcp_json_port_is_modified 2026-03-18 11:40:54 +00:00
Dave
420deebdb4 story-kit: done 276_story_detect_and_log_when_root_mcp_json_port_is_modified 2026-03-18 11:39:47 +00:00
Dave
0a6de3717a fix: Chat.test.tsx type errors from 271 merge
Cast lastSendChatArgs through unknown to satisfy TypeScript's
strict type narrowing on the nullable union type.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 11:33:54 +00:00
Dave
15645a2a3e Bump version to 0.3.0
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 11:31:19 +00:00
Dave
eab65de723 story-kit: create 281_story_matrix_bot_announces_itself_when_it_comes_online 2026-03-18 11:26:29 +00:00
Dave
81a5660f11 story-kit: merge 277 - bot uses configured display_name
Adds system_prompt parameter to chat_stream so the Matrix bot
passes "Your name is {name}" to Claude Code. Reads display_name
from bot.toml config. Resolved conflicts by integrating bot_name
into master's permission-handling code structure.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 11:23:50 +00:00
Dave
4bf01c6cca fix: session_id wiped on every trim, breaking --resume
The history trimming logic cleared session_id = None whenever entries
exceeded history_size. Since the history was always at capacity, every
new message wiped the session_id immediately after storing it. This
meant --resume was never passed to Claude Code, making every turn a
fresh conversation.

Fix: preserve session_id on trim. Claude Code's --resume loads the
full conversation from its own session transcript on disk, so trimming
our local tracking entries doesn't invalidate the session.

Also adds debug logging for session_id capture/storage (temporary).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 11:19:00 +00:00
Dave
a799009720 story-kit: done 279_story_auto_assign_should_respect_agent_stage_when_front_matter_specifies_agent 2026-03-18 11:10:41 +00:00
Dave
549c23bd77 story-kit: done 278_story_auto_assign_agents_to_pipeline_items_on_server_startup 2026-03-18 11:05:14 +00:00
Dave
34be4d1e75 story-kit: done 277_story_matrix_bot_uses_its_configured_name_instead_of_claude 2026-03-18 11:00:39 +00:00
Dave
a390861520 story-kit: done 273_story_matrix_bot_sends_typing_indicator_while_waiting_for_claude_response 2026-03-18 10:55:58 +00:00
Dave
ce9bdbbb9d story-kit: done 266_story_matrix_bot_structured_conversation_history 2026-03-18 10:48:55 +00:00
Dave
5f4591f496 fix: update should_commit_stage test to match 5_done in COMMIT_WORTHY_STAGES
The test was asserting 5_done should NOT trigger commits, but commit 74dc42c
added 5_done to COMMIT_WORTHY_STAGES. Updated test to match.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-18 10:46:11 +00:00
Dave
dc7968ffbc story-kit: mergemaster conflict resolution, vite proxy fix, bug 279
- Upgrade mergemaster prompt to resolve complex conflicts itself
  instead of just reporting failure. Includes instructions to check
  git history and story files for context before resolving.
- Add proxy error handler to vite config to prevent crashes on
  backend ECONNREFUSED.
- Fix bug 279: auto-assign now checks that preferred agent's stage
  matches the pipeline stage. Coders won't be assigned to QA/merge.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:44:10 +00:00
Dave
5fedd9130a story-kit: create 280_story_long_running_supervisor_agent_with_periodic_pipeline_polling 2026-03-18 10:39:51 +00:00
Dave
c7e371c124 story-kit: create 280_story_long_running_supervisor_agent_with_periodic_pipeline_polling 2026-03-18 10:36:20 +00:00
Dave
8748d7d49a story-kit: create 280_story_long_running_supervisor_agent_with_periodic_pipeline_polling 2026-03-18 10:34:18 +00:00
Dave
825d36c204 fix: remove stale 266 from archived (came from 271 branch history)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:30:47 +00:00
Dave
65a8feff17 story-kit: done 271_story_show_assigned_agent_in_expanded_work_item_view 2026-03-18 10:29:45 +00:00
Dave
60dabae795 story-kit: merge 271_story_show_assigned_agent_in_expanded_work_item_view
Adds assigned agent display to the expanded work item detail panel.
Resolved conflicts by keeping master versions of bot.rs (permission
handling), ChatInput.tsx, and fs.rs. Removed duplicate list_project_files
endpoint and tests from io.rs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:29:37 +00:00
Dave
1bae7bd223 story-kit: create 266_story_matrix_bot_structured_conversation_history 2026-03-18 10:21:55 +00:00
Dave
a0091e81f9 story-kit: create 266_story_matrix_bot_structured_conversation_history 2026-03-18 10:21:33 +00:00
Dave
beb5ea9f53 fix: revert broken auto-merge of 266 in bot.rs
The mergemaster's auto-resolver inserted a duplicate chat_stream call
inside the tokio::select! permission loop, producing mismatched braces.
The 266 merge didn't contribute useful code changes to bot.rs — the
session_id handling was already present.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:20:40 +00:00
Dave
89e96dc0a6 story-kit: done 266_story_matrix_bot_structured_conversation_history 2026-03-18 10:18:50 +00:00
Dave
0c686ba170 story-kit: merge 266_story_matrix_bot_structured_conversation_history 2026-03-18 10:18:49 +00:00
Dave
74dc42c1fc story-kit: add 5_done to commit-worthy stages
Keep done stage committed so accepted work is in git history.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:13:35 +00:00
Dave
a3d22fd874 story-kit: gitignore intermediate pipeline stages (spike 92 follow-up)
Ignore 2_current/, 3_qa/, and 4_merge/ in git since spike 92 stopped
committing intermediate pipeline moves. Keep 5_done/ tracked so
accepted work is in git history before sweep to archived.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:13:10 +00:00
Dave
8561910cd8 story-kit: start 266_story_matrix_bot_structured_conversation_history 2026-03-18 10:09:26 +00:00
Dave
e569c1bcad story-kit: start 266_story_matrix_bot_structured_conversation_history 2026-03-18 10:08:19 +00:00
Dave
4dcb24d5dd story-kit: queue 273_story_matrix_bot_sends_typing_indicator_while_waiting_for_claude_response for merge 2026-03-18 10:07:12 +00:00
Dave
59f37e13b9 story-kit: done 92_spike_stop_auto_committing_intermediate_pipeline_moves 2026-03-18 10:07:05 +00:00
Dave
3a1d7012b4 spike(92): stop auto-committing intermediate pipeline moves
Filter flush_pending() to only git-commit for terminal stages
(1_upcoming and 6_archived) while still broadcasting WatcherEvents
for all stages so the frontend stays in sync.

Reduces pipeline commits from 5+ to 2 per story run. No system
dependencies on intermediate commits were found.

Preserves merge_failure front matter cleanup from master.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:06:58 +00:00
Dave
41b24e4b7a story-kit: queue 266_story_matrix_bot_structured_conversation_history for merge 2026-03-18 10:05:09 +00:00
Dave
06948dae74 story-kit: queue 273_story_matrix_bot_sends_typing_indicator_while_waiting_for_claude_response for QA 2026-03-18 10:03:09 +00:00
Dave
bbd4aee828 story-kit: start 271_story_show_assigned_agent_in_expanded_work_item_view 2026-03-18 10:03:06 +00:00
Dave
d40f007818 story-kit: start 278_story_auto_assign_agents_to_pipeline_items_on_server_startup 2026-03-18 10:01:54 +00:00
Dave
3819a02159 story-kit: start 278_story_auto_assign_agents_to_pipeline_items_on_server_startup 2026-03-18 10:01:54 +00:00
Dave
9b65845c90 story-kit: start 277_story_matrix_bot_uses_its_configured_name_instead_of_claude 2026-03-18 10:01:52 +00:00
Dave
28176727d7 story-kit: queue 271_story_show_assigned_agent_in_expanded_work_item_view for merge 2026-03-18 10:00:38 +00:00
Dave
1d59cdcc25 story-kit: start 273_story_matrix_bot_sends_typing_indicator_while_waiting_for_claude_response 2026-03-18 10:00:28 +00:00
Dave
edc6b9ea05 story-kit: queue 271_story_show_assigned_agent_in_expanded_work_item_view for merge 2026-03-18 09:57:30 +00:00
Dave
8e4a8ce57a story-kit: queue 279_story_auto_assign_should_respect_agent_stage_when_front_matter_specifies_agent for merge 2026-03-18 09:54:32 +00:00
Dave
c863ee4135 story-kit: queue 279_story_auto_assign_should_respect_agent_stage_when_front_matter_specifies_agent for merge 2026-03-18 09:53:48 +00:00
Dave
dd4a1140fe story-kit: queue 278_story_auto_assign_agents_to_pipeline_items_on_server_startup for merge 2026-03-18 09:49:53 +00:00
Dave
895317330b story-kit: queue 278_story_auto_assign_agents_to_pipeline_items_on_server_startup for merge 2026-03-18 09:48:57 +00:00
Dave
11e32f9802 story-kit: queue 277_story_matrix_bot_uses_its_configured_name_instead_of_claude for merge 2026-03-18 09:44:22 +00:00
Dave
8b7ff6383f story-kit: queue 277_story_matrix_bot_uses_its_configured_name_instead_of_claude for merge 2026-03-18 09:43:30 +00:00
Dave
964a8bfcff story-kit: queue 273_story_matrix_bot_sends_typing_indicator_while_waiting_for_claude_response for merge 2026-03-18 09:41:34 +00:00
Dave
978b84893c story-kit: queue 266_story_matrix_bot_structured_conversation_history for merge 2026-03-18 09:39:58 +00:00
Dave
7dd6821dc5 story-kit: queue 273_story_matrix_bot_sends_typing_indicator_while_waiting_for_claude_response for merge 2026-03-18 09:38:05 +00:00
Dave
6abf5c87b2 story-kit: done 247_story_human_qa_gate_with_rejection_flow 2026-03-18 09:37:38 +00:00
Dave
b682c67f97 story-kit: queue 278_story_auto_assign_agents_to_pipeline_items_on_server_startup for QA 2026-03-18 09:35:50 +00:00
Dave
81309a5559 story-kit: queue 277_story_matrix_bot_uses_its_configured_name_instead_of_claude for QA 2026-03-18 09:35:49 +00:00
Dave
2006ad6d8c story-kit: queue 279_story_auto_assign_should_respect_agent_stage_when_front_matter_specifies_agent for QA 2026-03-18 09:35:45 +00:00
Dave
41bafb80e4 story-kit: accept 275_story_matrix_bot_surfaces_claude_code_permission_prompts_to_chat 2026-03-18 09:33:21 +00:00
Dave
569380e133 story-kit: done 275_story_matrix_bot_surfaces_claude_code_permission_prompts_to_chat 2026-03-18 09:32:20 +00:00
Dave
10a5bea2b1 story-kit: merge 275_story_matrix_bot_surfaces_claude_code_permission_prompts_to_chat 2026-03-18 09:32:17 +00:00
Dave
110815c1c5 story-kit: queue 247_story_human_qa_gate_with_rejection_flow for merge 2026-03-18 09:31:02 +00:00
Dave
29fc761980 fix: skip frontend tests when frontend dir absent in sparse worktrees
script/test unconditionally cd'd into frontend/ and ran npm test, which
failed in sparse-checkout worktrees that only contain the server/ subtree.
Guard the frontend step with a directory existence check so acceptance
gates pass for worktrees that have no frontend checkout.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 09:30:51 +00:00
Dave
d537aceb63 story-kit: start 278_story_auto_assign_agents_to_pipeline_items_on_server_startup 2026-03-18 09:29:43 +00:00
Dave
72b89c8ccc story-kit: start 277_story_matrix_bot_uses_its_configured_name_instead_of_claude 2026-03-18 09:29:27 +00:00
Dave
e19de02967 story-kit: start 279_story_auto_assign_should_respect_agent_stage_when_front_matter_specifies_agent 2026-03-18 09:29:00 +00:00
Dave
1c5f13e7eb story-kit: create 279_story_auto_assign_should_respect_agent_stage_when_front_matter_specifies_agent 2026-03-18 09:28:33 +00:00
Dave
816c771a2a story-kit: queue 275_story_matrix_bot_surfaces_claude_code_permission_prompts_to_chat for merge 2026-03-18 09:28:30 +00:00
Dave
642a8486cd story-kit: queue 266_story_matrix_bot_structured_conversation_history for QA 2026-03-18 09:25:33 +00:00
Dave
605bcadea7 story-kit: done 274_story_mcp_pipeline_status_tool_with_agent_assignments 2026-03-18 09:25:29 +00:00
Dave
ccc1ead8c9 story-kit: remove 274_story_mcp_pipeline_status_tool_with_agent_assignments 2026-03-18 09:25:07 +00:00
Dave
8bbbe8fbdd story-kit: start 274_story_mcp_pipeline_status_tool_with_agent_assignments 2026-03-18 09:25:01 +00:00
Dave
d9775834ed story-kit: queue 275_story_matrix_bot_surfaces_claude_code_permission_prompts_to_chat for QA 2026-03-18 09:22:43 +00:00
Dave
c32f0dce45 story-kit: queue 274_story_mcp_pipeline_status_tool_with_agent_assignments for merge 2026-03-18 09:22:39 +00:00
Dave
d864941665 story-kit: start 266_story_matrix_bot_structured_conversation_history 2026-03-18 09:21:40 +00:00
Dave
9c2d831c65 story-kit: create 266_story_matrix_bot_structured_conversation_history 2026-03-18 09:21:26 +00:00
Dave
2ab91f933f story-kit: create 266_story_matrix_bot_structured_conversation_history 2026-03-18 09:21:00 +00:00
Dave
1fcb8cb332 story-kit: create 266_story_matrix_bot_structured_conversation_history 2026-03-18 09:20:36 +00:00
Dave
3439c16e66 story-kit: create 278_story_auto_assign_agents_to_pipeline_items_on_server_startup 2026-03-18 09:18:23 +00:00
Dave
ce93987da8 story-kit: queue 274_story_mcp_pipeline_status_tool_with_agent_assignments for merge 2026-03-18 09:15:01 +00:00
Dave
bd7b7cc34a story-kit: create 277_story_matrix_bot_uses_its_configured_name_instead_of_claude 2026-03-18 09:09:49 +00:00
Dave
855452b4a2 story-kit: queue 274_story_mcp_pipeline_status_tool_with_agent_assignments for merge 2026-03-18 09:09:06 +00:00
Dave
1fcfa9123f story-kit: queue 274_story_mcp_pipeline_status_tool_with_agent_assignments for merge 2026-03-18 09:07:42 +00:00
Dave
e66b811436 story-kit: queue 273_story_matrix_bot_sends_typing_indicator_while_waiting_for_claude_response for merge 2026-03-18 09:06:00 +00:00
Dave
8d5fa85a3a story-kit: accept 264_bug_claude_code_session_id_not_persisted_across_browser_refresh 2026-03-18 09:05:30 +00:00
Dave
a4e7a23ca6 story-kit: queue 274_story_mcp_pipeline_status_tool_with_agent_assignments for QA 2026-03-17 18:43:05 +00:00
Dave
b67eea7b9a story-kit: queue 273_story_matrix_bot_sends_typing_indicator_while_waiting_for_claude_response for QA 2026-03-17 18:42:03 +00:00
Dave
4a89b46857 story-kit: start 275_story_matrix_bot_surfaces_claude_code_permission_prompts_to_chat 2026-03-17 18:33:23 +00:00
Dave
047bf83b76 story-kit: start 274_story_mcp_pipeline_status_tool_with_agent_assignments 2026-03-17 18:32:43 +00:00
Dave
62aa142409 story-kit: start 273_story_matrix_bot_sends_typing_indicator_while_waiting_for_claude_response 2026-03-17 18:32:37 +00:00
Dave
c93a2e80f9 story-kit: queue 92_spike_stop_auto_committing_intermediate_pipeline_moves for QA 2026-03-17 18:32:30 +00:00
Dave
9176fe3303 story-kit: create 276_story_detect_and_log_when_root_mcp_json_port_is_modified 2026-03-17 18:26:07 +00:00
Dave
296a59def3 story-kit: create 275_story_matrix_bot_surfaces_claude_code_permission_prompts_to_chat 2026-03-17 18:23:52 +00:00
Dave
90bb2fb137 story-kit: done 272_story_clear_merge_error_front_matter_when_story_leaves_merge_stage 2026-03-17 18:21:59 +00:00
Dave
bc0bb91a83 story-kit: merge 272_story_clear_merge_error_front_matter_when_story_leaves_merge_stage 2026-03-17 18:21:56 +00:00
Dave
0b39b2acfc story-kit: create 275_story_matrix_bot_surfaces_claude_code_permission_prompts_to_chat 2026-03-17 18:21:40 +00:00
Dave
75c27f5853 story-kit: create 273_story_matrix_bot_sends_typing_indicator_while_waiting_for_claude_response 2026-03-17 18:18:29 +00:00
Dave
349866606c story-kit: done 270_bug_qa_test_server_overwrites_root_mcp_json_with_wrong_port 2026-03-17 18:16:30 +00:00
Dave
901f7a65d3 story-kit: merge 270_bug_qa_test_server_overwrites_root_mcp_json_with_wrong_port 2026-03-17 18:16:13 +00:00
Dave
c52b41b99c story-kit: queue 272_story_clear_merge_error_front_matter_when_story_leaves_merge_stage for merge 2026-03-17 18:15:18 +00:00
Dave
ec76005c63 story-kit: create 274_story_mcp_pipeline_status_tool_with_agent_assignments 2026-03-17 18:10:26 +00:00
Dave
1736f8d924 story-kit: queue 92_spike_stop_auto_committing_intermediate_pipeline_moves for QA 2026-03-17 18:08:42 +00:00
Dave
f8b5e11c27 story-kit: done 269_story_file_references_in_web_ui_chat_input 2026-03-17 18:04:48 +00:00
Dave
12c500ee90 story-kit: remove 269_story_file_references_in_web_ui_chat_input 2026-03-17 18:03:21 +00:00
Dave
81c9cf797f story-kit: done 269_story_file_references_in_web_ui_chat_input 2026-03-17 18:03:10 +00:00
Dave
d18c1105c7 story-kit: start 269_story_file_references_in_web_ui_chat_input 2026-03-17 18:01:09 +00:00
Dave
ca8e6dc51c story-kit: accept 245_bug_chat_history_persistence_lost_on_page_refresh_story_145_regression 2026-03-17 17:58:30 +00:00
Dave
30ad59c6eb story-kit: queue 269_story_file_references_in_web_ui_chat_input for merge 2026-03-17 17:57:29 +00:00
Dave
123f140244 story-kit: start 269_story_file_references_in_web_ui_chat_input 2026-03-17 17:56:24 +00:00
Dave
8db23f77cd story-kit: start 92_spike_stop_auto_committing_intermediate_pipeline_moves 2026-03-17 17:55:34 +00:00
Dave
6bfa10b0e5 story-kit: queue 269_story_file_references_in_web_ui_chat_input for merge 2026-03-17 17:55:15 +00:00
Dave
65036b2ce7 story-kit: start 92_spike_stop_auto_committing_intermediate_pipeline_moves 2026-03-17 17:54:03 +00:00
Dave
76d73b2d0b story-kit: gitignore matrix_history.json
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 17:53:33 +00:00
Dave
78618a1b76 story-kit: queue 269_story_file_references_in_web_ui_chat_input for merge 2026-03-17 17:51:06 +00:00
Dave
47e07b23d1 story-kit: queue 272_story_clear_merge_error_front_matter_when_story_leaves_merge_stage for QA 2026-03-17 17:50:17 +00:00
Dave
45ae7b8f01 story-kit: queue 269_story_file_references_in_web_ui_chat_input for merge 2026-03-17 17:49:46 +00:00
Dave
e1c30b5953 story-kit: accept 262_story_bot_error_notifications_for_story_failures 2026-03-17 17:49:07 +00:00
Dave
b0d9fb4f39 story-kit: queue 269_story_file_references_in_web_ui_chat_input for merge 2026-03-17 17:47:07 +00:00
Dave
dcc11c2b0f story-kit: queue 271_story_show_assigned_agent_in_expanded_work_item_view for QA 2026-03-17 17:46:43 +00:00
Dave
7f21454880 story-kit: queue 269_story_file_references_in_web_ui_chat_input for merge 2026-03-17 17:45:44 +00:00
Dave
a893a1cef7 story-kit: merge 266_story_matrix_bot_structured_conversation_history 2026-03-17 17:42:08 +00:00
Dave
3fb48cdf51 story-kit: queue 269_story_file_references_in_web_ui_chat_input for QA 2026-03-17 17:41:55 +00:00
Dave
f1bb1216bf story-kit: done 266_story_matrix_bot_structured_conversation_history 2026-03-17 17:41:29 +00:00
Dave
b3faf7b810 story-kit: queue 247_story_human_qa_gate_with_rejection_flow for merge 2026-03-17 17:40:54 +00:00
Dave
89e4ee1c9c story-kit: queue 270_bug_qa_test_server_overwrites_root_mcp_json_with_wrong_port for merge 2026-03-17 17:37:50 +00:00
Dave
4df39eb1f2 story-kit: create 273_story_matrix_bot_sends_typing_indicator_while_waiting_for_claude_response 2026-03-17 17:37:41 +00:00
Dave
a7d23143ef story-kit: done 267_story_mcp_update_story_tool_should_support_front_matter_fields 2026-03-17 17:36:00 +00:00
Dave
f72666b39e story-kit: merge 267_story_mcp_update_story_tool_should_support_front_matter_fields 2026-03-17 17:35:57 +00:00
Dave
1f8ffee38e story-kit: start 272_story_clear_merge_error_front_matter_when_story_leaves_merge_stage 2026-03-17 17:35:23 +00:00
Dave
798f841b9a story-kit: queue 267_story_mcp_update_story_tool_should_support_front_matter_fields for merge 2026-03-17 17:34:26 +00:00
Dave
25c3dbb3d1 story-kit: start 271_story_show_assigned_agent_in_expanded_work_item_view 2026-03-17 17:33:34 +00:00
Dave
71cbc21b01 story-kit: queue 266_story_matrix_bot_structured_conversation_history for merge 2026-03-17 17:31:57 +00:00
Dave
6deeba81a8 story-kit: queue 266_story_matrix_bot_structured_conversation_history for merge 2026-03-17 17:30:53 +00:00
Dave
b862a7a6d0 story-kit: queue 267_story_mcp_update_story_tool_should_support_front_matter_fields for merge 2026-03-17 17:29:36 +00:00
Dave
fe1f76957d story-kit: queue 267_story_mcp_update_story_tool_should_support_front_matter_fields for merge 2026-03-17 17:28:38 +00:00
Dave
266e676dd4 story-kit: queue 247_story_human_qa_gate_with_rejection_flow for QA 2026-03-17 17:27:04 +00:00
Dave
402159c19a story-kit: queue 270_bug_qa_test_server_overwrites_root_mcp_json_with_wrong_port for QA 2026-03-17 17:26:23 +00:00
Dave
6d1b36e515 story-kit: start 269_story_file_references_in_web_ui_chat_input 2026-03-17 17:25:42 +00:00
Dave
81d4889cee Expand vite watch ignore list to prevent silent crashes on merge
Vite only needs to watch frontend/ sources. Ignore git objects,
Rust source, Cargo files, node_modules, and vendor directories
that change in bulk during squash merges.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-17 17:17:47 +00:00
Dave
0eb2cd8ec3 Stop tracking .mcp.json — it is generated at runtime
The server writes .mcp.json with its current port on startup and
during worktree creation. Tracking it in git causes QA gate failures
when the worktree copy diverges from master (e.g. different port).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-17 17:15:35 +00:00
Dave
b251ed7421 story-kit: create 272_story_clear_merge_error_front_matter_when_story_leaves_merge_stage 2026-03-17 17:14:19 +00:00
Dave
4a600e9954 story-kit: create 271_story_show_assigned_agent_in_expanded_work_item_view 2026-03-17 17:13:08 +00:00
Dave
cfb810b061 story-kit: start 270_bug_qa_test_server_overwrites_root_mcp_json_with_wrong_port 2026-03-17 17:10:45 +00:00
Dave
71bd999586 story-kit: create 270_bug_qa_test_server_overwrites_root_mcp_json_with_wrong_port 2026-03-17 17:10:30 +00:00
Dave
10d0cdeeae story-kit: accept 256_story_bot_must_verify_other_users_cross_signing_identity_before_checking_device_verification 2026-03-17 17:09:27 +00:00
Dave
6e375aaab5 story-kit: create 270_bug_qa_test_server_overwrites_root_mcp_json_with_wrong_port 2026-03-17 17:08:26 +00:00
Dave
e7edf9a8d5 story-kit: done 268_refactor_upgrade_tokio_tungstenite_to_0_29_0 2026-03-17 17:02:34 +00:00
Dave
20431f625b story-kit: merge 268_refactor_upgrade_tokio_tungstenite_to_0_29_0 2026-03-17 17:02:31 +00:00
Dave
d35f0f19fb story-kit: queue 268_refactor_upgrade_tokio_tungstenite_to_0_29_0 for merge 2026-03-17 16:59:54 +00:00
Dave
4303b33b90 story-kit: queue 266_story_matrix_bot_structured_conversation_history for QA 2026-03-17 16:58:19 +00:00
Dave
f9c0d24d7a story-kit: accept 259_story_move_story_kit_ignores_into_story_kit_gitignore 2026-03-17 16:57:12 +00:00
Dave
ec3277234c story-kit: queue 267_story_mcp_update_story_tool_should_support_front_matter_fields for QA 2026-03-17 16:53:12 +00:00
Dave
0a28aae041 story-kit: queue 268_refactor_upgrade_tokio_tungstenite_to_0_29_0 for QA 2026-03-17 16:47:46 +00:00
Dave
a7a8358cbb story-kit: create 269_story_file_references_in_web_ui_chat_input 2026-03-17 16:46:55 +00:00
Dave
6b6cb525a7 story-kit: start 268_refactor_upgrade_tokio_tungstenite_to_0_29_0 2026-03-17 16:43:45 +00:00
Dave
27465b1130 story-kit: create 268_refactor_upgrade_tokio_tungstenite_to_0_29_0 2026-03-17 16:43:34 +00:00
Dave
e74c370c7e Improve release changelog and fix MCP port
Generate structured changelogs from completed stories instead of raw
commit messages. Group by features, bug fixes, and refactors. Filter
out story-kit automation commits.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-17 16:42:48 +00:00
Dave
8defd5c671 story-kit: start 267_story_mcp_update_story_tool_should_support_front_matter_fields 2026-03-17 16:42:08 +00:00
Dave
a5c4fb553a story-kit: create 267_story_mcp_update_story_tool_should_support_front_matter_fields 2026-03-17 16:41:47 +00:00
Dave
a7772d1421 story-kit: start 247_story_human_qa_gate_with_rejection_flow 2026-03-17 16:41:27 +00:00
Dave
ed967403fb story-kit: start 247_story_human_qa_gate_with_rejection_flow 2026-03-17 16:40:09 +00:00
Dave
998b188ac7 story-kit: start 266_story_matrix_bot_structured_conversation_history 2026-03-17 16:39:42 +00:00
Dave
115c9fd6df story-kit: done 265_story_spikes_skip_merge_and_stop_for_human_review 2026-03-17 16:36:03 +00:00
Dave
86694a4383 story-kit: merge 265_story_spikes_skip_merge_and_stop_for_human_review 2026-03-17 16:36:00 +00:00
Dave
7b324ea96e story-kit: accept 257_story_rename_storkit_to_story_kit_in_header 2026-03-17 16:35:37 +00:00
Dave
744a12eeea story-kit: queue 265_story_spikes_skip_merge_and_stop_for_human_review for merge 2026-03-17 16:33:37 +00:00
Dave
cffe63680d Fix MCP server URL to match actual running port (3010)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-17 16:17:54 +00:00
Dave
f5fffd64b8 story-kit: create 266_story_matrix_bot_structured_conversation_history 2026-03-17 16:17:34 +00:00
Dave
ad68bc912f story-kit: remove 266_story_matrix_bot_structured_conversation_history 2026-03-17 16:17:20 +00:00
Dave
d02d53d112 story-kit: create 266_story_matrix_bot_structured_conversation_history 2026-03-17 16:14:07 +00:00
Dave
3ce7276e89 Fix TS narrowing errors in Chat.test.tsx
TypeScript control flow analysis can't track reassignment inside vi.mock
callbacks, causing lastSendChatArgs to narrow to never. Use non-null
assertions after the explicit toBeNull() guard.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 16:13:29 +00:00
Dave
6d87e64859 story-kit: queue 265_story_spikes_skip_merge_and_stop_for_human_review for QA 2026-03-17 16:11:52 +00:00
Dave
83db282892 Bump version to 0.2.0
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 16:08:59 +00:00
Dave
f5d5196bf5 Fix cross-signing bootstrap by passing UIA password auth
The homeserver requires User-Interactive Authentication before accepting
cross-signing keys. Pass the bot's password so bootstrap succeeds.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 16:08:39 +00:00
Dave
7ec869baa8 Fixing mcp location 2026-03-17 15:58:40 +00:00
Dave
1a257b3057 story-kit: start 265_story_spikes_skip_merge_and_stop_for_human_review 2026-03-17 15:58:28 +00:00
Dave
b9fd87ed7c story-kit: create 265_story_spikes_skip_merge_and_stop_for_human_review 2026-03-17 15:58:24 +00:00
Dave
fda763d3f0 story-kit: create 260_refactor_upgrade_libsqlite3_sys 2026-03-17 15:47:07 +00:00
Dave
77d89b17e8 story-kit: done 260_refactor_upgrade_libsqlite3_sys 2026-03-17 15:47:01 +00:00
Dave
df0fa46591 Revert "story-kit: merge 260_refactor_upgrade_libsqlite3_sys"
This reverts commit ea062400e5.
2026-03-17 15:45:52 +00:00
Dave
1f5d70ce0d story-kit: done 264_bug_claude_code_session_id_not_persisted_across_browser_refresh 2026-03-17 15:41:43 +00:00
Dave
0d46c86469 story-kit: merge 264_bug_claude_code_session_id_not_persisted_across_browser_refresh 2026-03-17 15:41:41 +00:00
Dave
a439f8fdcb story-kit: queue 264_bug_claude_code_session_id_not_persisted_across_browser_refresh for merge 2026-03-17 15:39:34 +00:00
Dave
1adddf4e4c story-kit: create 247_story_human_qa_gate_with_rejection_flow 2026-03-17 15:37:25 +00:00
Dave
23484716e2 story-kit: create 265_story_spikes_skip_merge_and_stop_for_human_review 2026-03-17 15:36:52 +00:00
Dave
92085f9071 story-kit: done 263_story_matrix_bot_self_signs_device_keys_at_startup_for_verified_encryption 2026-03-17 15:35:01 +00:00
Dave
ce899b569e story-kit: merge 263_story_matrix_bot_self_signs_device_keys_at_startup_for_verified_encryption 2026-03-17 15:34:58 +00:00
Dave
da7216630b story-kit: queue 263_story_matrix_bot_self_signs_device_keys_at_startup_for_verified_encryption for merge 2026-03-17 15:33:11 +00:00
Dave
b57c270144 story-kit: queue 263_story_matrix_bot_self_signs_device_keys_at_startup_for_verified_encryption for merge 2026-03-17 15:31:25 +00:00
Dave
230b8fdc35 story-kit: queue 263_story_matrix_bot_self_signs_device_keys_at_startup_for_verified_encryption for merge 2026-03-17 15:28:49 +00:00
Dave
75b2446801 story-kit: done 262_story_bot_error_notifications_for_story_failures 2026-03-17 15:27:51 +00:00
Dave
96779c9caf story-kit: merge 262_story_bot_error_notifications_for_story_failures 2026-03-17 15:27:48 +00:00
Dave
bf5d9ff6b1 story-kit: queue 264_bug_claude_code_session_id_not_persisted_across_browser_refresh for QA 2026-03-17 15:25:47 +00:00
Dave
c551faeea3 story-kit: queue 263_story_matrix_bot_self_signs_device_keys_at_startup_for_verified_encryption for merge 2026-03-17 15:19:41 +00:00
Dave
3f38f90a50 story-kit: queue 263_story_matrix_bot_self_signs_device_keys_at_startup_for_verified_encryption for merge 2026-03-17 15:19:33 +00:00
Dave
26a1328c89 story-kit: queue 262_story_bot_error_notifications_for_story_failures for merge 2026-03-17 15:18:57 +00:00
Dave
21b45b8dd7 story-kit: queue 263_story_matrix_bot_self_signs_device_keys_at_startup_for_verified_encryption for merge 2026-03-17 15:18:32 +00:00
Dave
3a860bd2d5 story-kit: start 264_bug_claude_code_session_id_not_persisted_across_browser_refresh 2026-03-17 15:16:14 +00:00
Dave
c2c95c18b4 story-kit: create 264_bug_claude_code_session_id_not_persisted_across_browser_refresh 2026-03-17 15:15:51 +00:00
Dave
e3a301009b story-kit: queue 263_story_matrix_bot_self_signs_device_keys_at_startup_for_verified_encryption for QA 2026-03-17 15:08:23 +00:00
Dave
c90bdc8907 story-kit: queue 262_story_bot_error_notifications_for_story_failures for QA 2026-03-17 15:07:17 +00:00
Dave
dba12a38c2 story-kit: start 263_story_matrix_bot_self_signs_device_keys_at_startup_for_verified_encryption 2026-03-17 15:00:34 +00:00
Dave
4b60452b27 story-kit: start 262_story_bot_error_notifications_for_story_failures 2026-03-17 14:57:27 +00:00
Dave
d2f677ae0c story-kit: create 263_story_matrix_bot_self_signs_device_keys_at_startup_for_verified_encryption 2026-03-17 14:56:59 +00:00
Dave
427bb6929a Ignoring some folders to keep vite running across merges 2026-03-17 14:48:37 +00:00
Dave
78c04ee576 story-kit: create 262_story_bot_error_notifications_for_story_failures 2026-03-17 14:44:04 +00:00
Dave
3309d26142 story-kit: done 245_bug_chat_history_persistence_lost_on_page_refresh_story_145_regression 2026-03-17 14:38:08 +00:00
Dave
5a4a2aaa17 story-kit: merge 245_bug_chat_history_persistence_lost_on_page_refresh_story_145_regression 2026-03-17 14:38:05 +00:00
Dave
d3786253ef story-kit: queue 245_bug_chat_history_persistence_lost_on_page_refresh_story_145_regression for merge 2026-03-17 14:35:34 +00:00
Dave
76db12a53e story-kit: queue 262_story_bot_error_notifications_for_story_failures for QA 2026-03-17 14:25:37 +00:00
Dave
4eb5a01774 story-kit: queue 245_bug_chat_history_persistence_lost_on_page_refresh_story_145_regression for QA 2026-03-17 14:20:40 +00:00
Dave
198f9ff5bf story-kit: start 262_story_bot_error_notifications_for_story_failures 2026-03-17 14:20:39 +00:00
Dave
e30773d088 story-kit: done 261_story_bot_notifications_when_stories_move_between_stages 2026-03-17 14:05:04 +00:00
Dave
a4affca9be story-kit: merge 261_story_bot_notifications_when_stories_move_between_stages 2026-03-17 14:05:02 +00:00
Dave
a067091354 story-kit: queue 261_story_bot_notifications_when_stories_move_between_stages for merge 2026-03-17 14:02:47 +00:00
Dave
da423d9c97 story-kit: queue 261_story_bot_notifications_when_stories_move_between_stages for QA 2026-03-17 13:58:47 +00:00
Dave
d6d080e30a story-kit: start 245_bug_chat_history_persistence_lost_on_page_refresh_story_145_regression 2026-03-17 13:57:34 +00:00
Dave
9098c1ba9d story-kit: done 245_bug_chat_history_persistence_lost_on_page_refresh_story_145_regression 2026-03-17 13:57:28 +00:00
Dave
511c5809f2 story-kit: remove 263_refactor_extract_common_matrix_messaging_for_story_notifications 2026-03-17 13:48:54 +00:00
Dave
ace8e59536 story-kit: create 262_story_bot_error_notifications_for_story_failures 2026-03-17 13:48:49 +00:00
Dave
fa128c52d9 story-kit: queue 262_story_bot_error_notifications_for_story_failures for merge 2026-03-17 13:48:41 +00:00
Dave
621cdea6df story-kit: start 261_story_bot_notifications_when_stories_move_between_stages 2026-03-17 13:48:31 +00:00
Dave
68233e3355 story-kit: queue 261_story_bot_notifications_when_stories_move_between_stages for merge 2026-03-17 13:48:17 +00:00
Dave
99d298035b story-kit: queue 262_story_bot_error_notifications_for_story_failures for merge 2026-03-17 13:45:56 +00:00
Dave
73b41d1c6c story-kit: queue 262_story_bot_error_notifications_for_story_failures for merge 2026-03-17 13:44:49 +00:00
Dave
1a56844661 story-kit: queue 261_story_bot_notifications_when_stories_move_between_stages for merge 2026-03-17 13:42:50 +00:00
Dave
48ff0ba205 story-kit: queue 261_story_bot_notifications_when_stories_move_between_stages for merge 2026-03-17 13:41:49 +00:00
Dave
50b29e0bed story-kit: done 260_refactor_upgrade_libsqlite3_sys 2026-03-17 13:41:35 +00:00
Dave
ea062400e5 story-kit: merge 260_refactor_upgrade_libsqlite3_sys 2026-03-17 13:41:33 +00:00
Dave
b0e4e04c9d story-kit: done 258_bug_auto_assign_not_called_after_merge_failure 2026-03-17 13:38:45 +00:00
Dave
02fe364349 story-kit: create 263_refactor_extract_common_matrix_messaging_for_story_notifications 2026-03-17 13:38:43 +00:00
Dave
3602f882d2 story-kit: merge 258_bug_auto_assign_not_called_after_merge_failure 2026-03-17 13:38:42 +00:00
Dave
730e7324ea story-kit: queue 260_refactor_upgrade_libsqlite3_sys for merge 2026-03-17 13:38:24 +00:00
Dave
ae73d95d50 story-kit: queue 262_story_bot_error_notifications_for_story_failures for QA 2026-03-17 13:36:34 +00:00
Dave
ae6dd3217b story-kit: queue 258_bug_auto_assign_not_called_after_merge_failure for merge 2026-03-17 13:35:27 +00:00
Dave
9a6f63b591 story-kit: queue 258_bug_auto_assign_not_called_after_merge_failure for QA 2026-03-17 13:32:08 +00:00
Dave
421eaec7ba story-kit: start 262_story_bot_error_notifications_for_story_failures 2026-03-17 13:27:28 +00:00
Dave
2c4e376054 story-kit: start 261_story_bot_notifications_when_stories_move_between_stages 2026-03-17 13:27:24 +00:00
Dave
1896a0ac49 story-kit: start 258_bug_auto_assign_not_called_after_merge_failure 2026-03-17 13:23:57 +00:00
Dave
b8d3978a54 story-kit: queue 260_refactor_upgrade_libsqlite3_sys for QA 2026-03-17 13:22:31 +00:00
Dave
72c50b6ffc story-kit: create 262_story_bot_error_notifications_for_story_failures 2026-03-17 13:20:14 +00:00
Dave
bab77fe105 story-kit: create 261_story_bot_notifications_when_stories_move_between_stages 2026-03-17 13:20:12 +00:00
Dave
1d935192e1 story-kit: done 259_story_move_story_kit_ignores_into_story_kit_gitignore 2026-03-17 13:15:04 +00:00
Dave
f89f78d77d story-kit: merge 259_story_move_story_kit_ignores_into_story_kit_gitignore 2026-03-17 13:15:02 +00:00
Dave
09a71b4515 story-kit: queue 259_story_move_story_kit_ignores_into_story_kit_gitignore for merge 2026-03-17 13:12:12 +00:00
Dave
988562fc82 story-kit: done 256_story_bot_must_verify_other_users_cross_signing_identity_before_checking_device_verification 2026-03-17 13:10:55 +00:00
Dave
ed0d5d9253 story-kit: merge 256_story_bot_must_verify_other_users_cross_signing_identity_before_checking_device_verification 2026-03-17 13:10:51 +00:00
Dave
bb265d7bd5 story-kit: queue 256_story_bot_must_verify_other_users_cross_signing_identity_before_checking_device_verification for merge 2026-03-17 13:08:13 +00:00
Dave
126a6f8dc3 story-kit: queue 256_story_bot_must_verify_other_users_cross_signing_identity_before_checking_device_verification for merge 2026-03-17 13:07:33 +00:00
Dave
3b66b89c90 story-kit: remove 256_story_bot_must_verify_other_users_cross_signing_identity_before_checking_device_verification 2026-03-17 13:07:03 +00:00
Dave
e9879ce1c7 story-kit: create 92_spike_stop_auto_committing_intermediate_pipeline_moves 2026-03-17 13:06:37 +00:00
Dave
d30192b6a3 story-kit: create 92_spike_stop_auto_committing_intermediate_pipeline_moves 2026-03-17 13:06:26 +00:00
Dave
93c4f06818 story-kit: queue 259_story_move_story_kit_ignores_into_story_kit_gitignore for QA 2026-03-17 13:06:24 +00:00
Dave
7dab810572 story-kit: start 260_refactor_upgrade_libsqlite3_sys 2026-03-17 13:01:20 +00:00
Dave
cb7dde9fc1 story-kit: queue 256_story_bot_must_verify_other_users_cross_signing_identity_before_checking_device_verification for merge 2026-03-17 13:01:15 +00:00
Dave
7f70d1118f story-kit: create 260_refactor_upgrade_libsqlite3_sys 2026-03-17 13:01:10 +00:00
Dave
5638402745 story-kit: create 260_refactor_upgrade_libsqlite3_sys 2026-03-17 13:01:09 +00:00
Dave
e90bf38fa2 story-kit: create 260_refactor_upgrade_libsqlite3_sys 2026-03-17 13:00:48 +00:00
Dave
46ab4cdd8a story-kit: queue 256_story_bot_must_verify_other_users_cross_signing_identity_before_checking_device_verification for merge 2026-03-17 13:00:18 +00:00
Dave
7341fca72e story-kit: start 259_story_move_story_kit_ignores_into_story_kit_gitignore 2026-03-17 12:57:20 +00:00
Dave
fdb4a4fb62 story-kit: create 259_story_move_story_kit_ignores_into_story_kit_gitignore 2026-03-17 12:56:39 +00:00
Dave
87791c755e story-kit: create 259_story_move_story_kit_ignores_into_story_kit_gitignore 2026-03-17 12:53:52 +00:00
Dave
a4ce5f8f7c story-kit: queue 256_story_bot_must_verify_other_users_cross_signing_identity_before_checking_device_verification for QA 2026-03-17 12:52:04 +00:00
Dave
a9a84bee6d story-kit: start 256_story_bot_must_verify_other_users_cross_signing_identity_before_checking_device_verification 2026-03-17 12:52:01 +00:00
Dave
34755d3f63 story-kit: start 256_story_bot_must_verify_other_users_cross_signing_identity_before_checking_device_verification 2026-03-17 12:50:00 +00:00
Dave
ec553a5b8a story-kit: start 256_story_bot_must_verify_other_users_cross_signing_identity_before_checking_device_verification 2026-03-17 12:49:40 +00:00
Dave
076324c470 Fix pipe buffer deadlock in quality gate test runner
run_command_with_timeout piped stdout/stderr but only read them after
the child exited. When test output exceeded the 64KB OS pipe buffer,
the child blocked on write() while the parent blocked on waitpid() —
a permanent deadlock that caused every merge pipeline to hang.

Drain both pipes in background threads so the buffers never fill.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-17 12:49:12 +00:00
Dave
5ed2737edc story-kit: accept 250_bug_merge_pipeline_cherry_pick_fails_with_bad_revision_on_merge_queue_branch 2026-03-17 12:48:11 +00:00
Dave
0eafddd186 story-kit: done 257_story_rename_storkit_to_story_kit_in_header 2026-03-17 12:46:33 +00:00
Dave
7d4f722942 story-kit: merge 257_story_rename_storkit_to_story_kit_in_header 2026-03-17 12:46:30 +00:00
Dave
5d80d289c4 story-kit: create 258_bug_auto_assign_not_called_after_merge_failure 2026-03-17 12:35:08 +00:00
Dave
7c6e1b445d Make merge_agent_work async to avoid MCP 60-second tool timeout
The merge pipeline (squash merge + quality gates) takes well over 60
seconds. Claude Code's MCP HTTP transport times out at 60s, causing
"completed with no output" — the mergemaster retries fruitlessly.

merge_agent_work now starts the pipeline as a background task and
returns immediately. A new get_merge_status tool lets the mergemaster
poll until the job reaches a terminal state. Also adds a double-start
guard so concurrent calls for the same story are rejected.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-17 12:15:42 +00:00
Dave
a85d1a1170 story-kit: queue 257_story_rename_storkit_to_story_kit_in_header for merge 2026-03-17 12:14:53 +00:00
Dave
afc1ab5e0e story-kit: queue 257_story_rename_storkit_to_story_kit_in_header for merge 2026-03-17 11:51:29 +00:00
Dave
32b6439f2f story-kit: create 256_story_bot_must_verify_other_users_cross_signing_identity_before_checking_device_verification 2026-03-17 11:46:28 +00:00
Dave
85e56e0ea8 story-kit: queue 257_story_rename_storkit_to_story_kit_in_header for merge 2026-03-17 11:45:29 +00:00
Dave
b63fa6be4f story-kit: queue 256_story_bot_must_verify_other_users_cross_signing_identity_before_checking_device_verification for merge 2026-03-17 11:43:23 +00:00
Dave
f012311303 story-kit: queue 257_story_rename_storkit_to_story_kit_in_header for merge 2026-03-17 11:39:28 +00:00
Dave
af0aa007ca story-kit: queue 257_story_rename_storkit_to_story_kit_in_header for merge 2026-03-17 11:36:05 +00:00
Dave
b2aec94d4c story-kit: queue 256_story_bot_must_verify_other_users_cross_signing_identity_before_checking_device_verification for QA 2026-03-17 11:35:03 +00:00
Dave
2ac550008a story-kit: start 256_story_bot_must_verify_other_users_cross_signing_identity_before_checking_device_verification 2026-03-17 11:32:49 +00:00
Dave
ebbbfed1d9 Add 10-minute timeout to test commands and disable e2e in merge pipeline
Test commands in run_project_tests now use wait-timeout to enforce a
600-second ceiling, preventing hung processes (e.g. Playwright with no
server) from blocking the merge pipeline indefinitely. Also disables
e2e tests in script/test until the merge workspace can run them safely.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-17 11:32:44 +00:00
Dave
fd6ef83f76 story-kit: queue 257_story_rename_storkit_to_story_kit_in_header for QA 2026-03-17 11:29:57 +00:00
Dave
473461b65d story-kit: start 257_story_rename_storkit_to_story_kit_in_header 2026-03-17 11:24:55 +00:00
Dave
dc8d639d02 story-kit: create 256_story_bot_must_verify_other_users_cross_signing_identity_before_checking_device_verification 2026-03-17 11:24:20 +00:00
Dave
594fc500cf story-kit: create 250_bug_merge_pipeline_cherry_pick_fails_with_bad_revision_on_merge_queue_branch 2026-03-17 11:24:15 +00:00
Dave
5448a99759 story-kit: done 245_bug_chat_history_persistence_lost_on_page_refresh_story_145_regression 2026-03-17 11:24:09 +00:00
Dave
f5524b3ae1 story-kit: accept 255_story_show_agent_logs_in_expanded_story_popup 2026-03-17 11:23:36 +00:00
Dave
4585537dd8 story-kit: create 250_bug_merge_pipeline_cherry_pick_fails_with_bad_revision_on_merge_queue_branch 2026-03-17 11:23:19 +00:00
Dave
57911fd9e7 story-kit: start 256_story_bot_must_verify_other_users_cross_signing_identity_before_checking_device_verification 2026-03-17 11:23:11 +00:00
Dave
b6f5169b56 story-kit: start 250_bug_merge_pipeline_cherry_pick_fails_with_bad_revision_on_merge_queue_branch 2026-03-17 11:23:07 +00:00
Dave
a4b99c68da story-kit: done 255_story_show_agent_logs_in_expanded_story_popup 2026-03-17 11:23:04 +00:00
Dave
85062c338f story-kit: done 254_story_add_refactor_work_item_type 2026-03-17 11:23:01 +00:00
Dave
a7f3d283ec story-kit: done 245_bug_chat_history_persistence_lost_on_page_refresh_story_145_regression 2026-03-17 11:22:57 +00:00
Dave
6cc9d1bde9 story-kit: queue 245_bug_chat_history_persistence_lost_on_page_refresh_story_145_regression for merge 2026-03-17 11:14:16 +00:00
Dave
a82fa37730 story-kit: accept 253_bug_watcher_and_auto_assign_do_not_reinitialize_when_project_root_changes 2026-03-17 03:26:24 +00:00
Dave
06ceab3e22 story-kit: merge 245_bug_chat_history_persistence_lost_on_page_refresh_story_145_regression 2026-03-17 01:02:34 +00:00
Dave
58438f3ab6 story-kit: queue 245_bug_chat_history_persistence_lost_on_page_refresh_story_145_regression for merge 2026-03-17 01:02:04 +00:00
Dave
59bb7dbc3a story-kit: queue 245_bug_chat_history_persistence_lost_on_page_refresh_story_145_regression for merge 2026-03-17 00:59:38 +00:00
Dave
9c2471fbcc story-kit: queue 250_bug_merge_pipeline_cherry_pick_fails_with_bad_revision_on_merge_queue_branch for merge 2026-03-17 00:52:34 +00:00
Dave
f383d0cb4f story-kit: queue 245_bug_chat_history_persistence_lost_on_page_refresh_story_145_regression for QA 2026-03-17 00:52:02 +00:00
Dave
be61803af0 story-kit: merge 255_story_show_agent_logs_in_expanded_story_popup 2026-03-17 00:49:43 +00:00
Dave
c132d4f5c0 story-kit: queue 255_story_show_agent_logs_in_expanded_story_popup for merge 2026-03-17 00:49:20 +00:00
Dave
263ba440dc story-kit: queue 255_story_show_agent_logs_in_expanded_story_popup for merge 2026-03-17 00:46:33 +00:00
Dave
2fae9066e2 story-kit: merge 254_story_add_refactor_work_item_type 2026-03-17 00:40:37 +00:00
Dave
3553f59078 story-kit: queue 254_story_add_refactor_work_item_type for merge 2026-03-17 00:39:55 +00:00
Dave
78ea96d0a9 story-kit: queue 255_story_show_agent_logs_in_expanded_story_popup for QA 2026-03-17 00:36:40 +00:00
Dave
79d3eccc46 story-kit: queue 254_story_add_refactor_work_item_type for merge 2026-03-17 00:34:56 +00:00
Dave
c21a087399 story-kit: queue 250_bug_merge_pipeline_cherry_pick_fails_with_bad_revision_on_merge_queue_branch for merge 2026-03-17 00:30:47 +00:00
Dave
67942d466c story-kit: done 253_bug_watcher_and_auto_assign_do_not_reinitialize_when_project_root_changes 2026-03-17 00:30:26 +00:00
Dave
1d6a4fa8c6 story-kit: queue 254_story_add_refactor_work_item_type for QA 2026-03-17 00:29:53 +00:00
Dave
250f3ff819 story-kit: accept 242_story_status_slash_command 2026-03-17 00:26:51 +00:00
Dave
a02ea3c292 story-kit: queue 253_bug_watcher_and_auto_assign_do_not_reinitialize_when_project_root_changes for merge 2026-03-17 00:25:50 +00:00
Dave
bbc5d9c90c story-kit: queue 256_story_bot_must_verify_other_users_cross_signing_identity_before_checking_device_verification for merge 2026-03-17 00:21:03 +00:00
Dave
24f6a5c7cc story-kit: queue 256_story_bot_must_verify_other_users_cross_signing_identity_before_checking_device_verification for merge 2026-03-17 00:13:44 +00:00
Dave
ab3420fa90 story-kit: queue 250_bug_merge_pipeline_cherry_pick_fails_with_bad_revision_on_merge_queue_branch for merge 2026-03-17 00:13:12 +00:00
Dave
4c6228abee story-kit: queue 253_bug_watcher_and_auto_assign_do_not_reinitialize_when_project_root_changes for QA 2026-03-17 00:12:25 +00:00
Dave
6df28d5393 story-kit: queue 250_bug_merge_pipeline_cherry_pick_fails_with_bad_revision_on_merge_queue_branch for merge 2026-03-17 00:04:39 +00:00
Dave
2ad59ba155 story-kit: accept 249_story_agent_assignment_via_story_front_matter 2026-03-17 00:04:13 +00:00
Dave
319fc3823a story-kit: queue 250_bug_merge_pipeline_cherry_pick_fails_with_bad_revision_on_merge_queue_branch for merge 2026-03-17 00:04:12 +00:00
Dave
b9f3449021 story-kit: support agent assignment via story front matter (story 249)
Adds an optional `agent:` field to story file front matter so that a
specific agent can be requested for a story. The auto-assign loop now:

1. Reads the front-matter `agent` field for each story before picking
   a free agent.
2. If a preferred agent is named, uses it when free; skips the story
   (without falling back) when that agent is busy.
3. Falls back to the existing `find_free_agent_for_stage` behaviour
   when no preference is specified.

Ported from feature branch that predated the agents.rs module refactoring.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-17 00:03:49 +00:00
Dave
cd7444ac5c story-kit: done 249_story_agent_assignment_via_story_front_matter 2026-03-17 00:03:21 +00:00
Dave
f5d9c98e74 story-kit: queue 256_story_bot_must_verify_other_users_cross_signing_identity_before_checking_device_verification for QA 2026-03-16 23:59:22 +00:00
Dave
7cd19e248c story-kit: start 245_bug_chat_history_persistence_lost_on_page_refresh_story_145_regression 2026-03-16 23:57:48 +00:00
Dave
ec5024a089 story-kit: start 255_story_show_agent_logs_in_expanded_story_popup 2026-03-16 23:57:05 +00:00
Dave
9041cd1d16 story-kit: start 256_story_bot_must_verify_other_users_cross_signing_identity_before_checking_device_verification 2026-03-16 23:53:53 +00:00
Dave
0a0624795c story-kit: create 256_story_bot_must_verify_other_users_cross_signing_identity_before_checking_device_verification 2026-03-16 23:53:26 +00:00
Dave
d8d0d7936c story-kit: queue 253_bug_watcher_and_auto_assign_do_not_reinitialize_when_project_root_changes for QA 2026-03-16 23:46:47 +00:00
Dave
55ea8e6aaf story-kit: accept 251_bug_archive_sweep_not_moving_stories_from_done_to_archived 2026-03-16 23:44:13 +00:00
Dave
1598d2a453 story-kit: done 251_bug_archive_sweep_not_moving_stories_from_done_to_archived 2026-03-16 23:44:09 +00:00
Dave
0120de5f00 story-kit: queue 249_story_agent_assignment_via_story_front_matter for QA 2026-03-16 23:44:00 +00:00
Dave
21835bc37d story-kit: queue 254_story_add_refactor_work_item_type for QA 2026-03-16 23:42:04 +00:00
Dave
f01fa6c527 story-kit: start 253_bug_watcher_and_auto_assign_do_not_reinitialize_when_project_root_changes 2026-03-16 23:41:05 +00:00
Dave
a51488a0ce story-kit: create 253_bug_watcher_and_auto_assign_do_not_reinitialize_when_project_root_changes 2026-03-16 23:40:02 +00:00
Dave
9054ac013e story-kit: accept 252_story_coder_agents_must_find_root_causes_for_bugs 2026-03-16 23:38:24 +00:00
Dave
95eea3a624 story-kit: start 254_story_add_refactor_work_item_type 2026-03-16 23:35:18 +00:00
Dave
6b9390b243 story-kit: start 255_story_show_agent_logs_in_expanded_story_popup 2026-03-16 23:34:24 +00:00
Dave
3ed9b7a185 story-kit: create 255_story_show_agent_logs_in_expanded_story_popup 2026-03-16 23:29:20 +00:00
Dave
bd7426131f story-kit: create 255_story_show_agent_logs_in_expanded_story_popup 2026-03-16 23:29:05 +00:00
Dave
e0132a7807 story-kit: create 255_bug_agent_logs_tab_shows_no_output_in_expanded_story_popup 2026-03-16 23:28:24 +00:00
Dave
b829783a84 story-kit: queue 253_bug_watcher_and_auto_assign_do_not_reinitialize_when_project_root_changes for QA 2026-03-16 23:27:28 +00:00
Dave
2f0c54150a story-kit: start 253_bug_watcher_and_auto_assign_do_not_reinitialize_when_project_root_changes 2026-03-16 23:25:56 +00:00
Dave
a716ca312a story-kit: start 253_bug_watcher_and_auto_assign_do_not_reinitialize_when_project_root_changes 2026-03-16 23:25:33 +00:00
Dave
8ff6e3963b story-kit: accept 241_story_help_slash_command 2026-03-16 23:23:45 +00:00
Dave
2e25e2a46b story-kit: queue 253_bug_watcher_and_auto_assign_do_not_reinitialize_when_project_root_changes for merge 2026-03-16 23:23:45 +00:00
Dave
7c3a756a5c Refactor agents.rs (7631 lines) into agents/ module directory
Split the monolithic agents.rs into 6 focused modules:
- mod.rs: shared types (AgentEvent, AgentStatus, etc.) and re-exports
- pool.rs: AgentPool struct, all methods, and helper free functions
- pty.rs: PTY streaming (run_agent_pty_blocking, emit_event)
- lifecycle.rs: story movement functions (move_story_to_qa, etc.)
- gates.rs: acceptance gates (clippy, tests, coverage)
- merge.rs: squash-merge, conflict resolution, quality gates

All 121 original tests are preserved and distributed across modules.
Also adds clear_front_matter_field to story_metadata.rs to strip
stale merge_failure from front matter when stories move to done.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 23:06:14 +00:00
Dave
225137fbdc story-kit: instruct coder agents to find root causes for bugs (story 252)
Add "Bug Workflow: Root Cause First" guidance to all coder agent prompts
and system prompts. Adds a test ensuring all coder-stage agents include
root cause, git bisect/log, and anti-workaround instructions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 19:33:54 +00:00
Dave
cce3ceb55b story-kit: merge 249_story_agent_assignment_via_story_front_matter 2026-03-14 21:00:52 +00:00
Dave
b54f16b945 story-kit: commit work pipeline files and package-lock
Commit untracked work pipeline files (stories, bugs in various stages)
and package-lock.json that were present on the filesystem but not yet
tracked by git.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 20:04:43 +00:00
Dave
93d5dbd92a story-kit: fix chat auto-scroll to bottom on new messages (bug 248)
Correct lastScrollTopRef assignment in scrollToBottom to read back the
browser-capped scrollTop value instead of using scrollHeight, which was
causing handleScroll to incorrectly detect upward scrolling and disable
auto-scroll.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 19:56:55 +00:00
Dave
ec652a6fe8 story-kit: enforce cryptographic identity verification for Matrix commands (story 246)
Remove the require_verified_devices config toggle. The bot now always requires
encrypted rooms and cross-signing-verified devices before executing any command.
Messages from unencrypted rooms or unverified devices are rejected.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 19:56:38 +00:00
Dave
568207687d story-kit: merge 241_story_help_slash_command 2026-03-14 18:55:30 +00:00
Dave
3abea68f9e story-kit: merge 243_bug_replace_pnpm_with_npm 2026-03-14 18:12:00 +00:00
Dave
3a430dfaa2 story-kit: done 240_story_btw_side_question_slash_command
Implement /btw side question slash command — lets users ask quick
questions from conversation context without disrupting the main chat.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 18:09:30 +00:00
Dave
6a7baa4a15 Reverting sqlite upgrade 2026-03-14 13:28:33 +00:00
Dave
5f7647cbda Dependencies upgrade 2026-03-14 11:44:51 +00:00
Dave
1dcf043c53 story-kit: accept 233_story_auto_assign_backoff_for_failed_merge_items 2026-03-13 18:38:53 +00:00
Dave
523553197d story-kit: done 233_story_auto_assign_backoff_for_failed_merge_items 2026-03-13 18:38:45 +00:00
Dave
8d0c74c7d0 story-kit: done 227_bug_thinking_traces_visible_in_agents_panel_in_release_builds_only 2026-03-13 18:38:08 +00:00
Dave
ae115599a8 story-kit: queue 233_story_auto_assign_backoff_for_failed_merge_items for merge 2026-03-13 18:36:40 +00:00
Dave
6a477de2e1 story-kit: merge 227_bug_thinking_traces_visible_in_agents_panel_in_release_builds_only 2026-03-13 18:36:29 +00:00
Dave
20a4f0c492 story-kit: queue 227_bug_thinking_traces_visible_in_agents_panel_in_release_builds_only for merge 2026-03-13 18:34:04 +00:00
Dave
9fc7aebe22 story-kit: queue 233_story_auto_assign_backoff_for_failed_merge_items for QA 2026-03-13 18:32:45 +00:00
Dave
f681d978b5 story-kit: queue 227_bug_thinking_traces_visible_in_agents_panel_in_release_builds_only for QA 2026-03-13 18:29:29 +00:00
Dave
57a02d9a2b story-kit: start 233_story_auto_assign_backoff_for_failed_merge_items 2026-03-13 18:17:26 +00:00
Dave
210d3924ff story-kit: start 227_bug_thinking_traces_visible_in_agents_panel_in_release_builds_only 2026-03-13 18:14:57 +00:00
126 changed files with 12223 additions and 11717 deletions

View File

@@ -1,5 +1,7 @@
{
"enabledMcpjsonServers": ["story-kit"],
"enabledMcpjsonServers": [
"story-kit"
],
"permissions": {
"allow": [
"Bash(./server/target/debug/story-kit:*)",
@@ -56,7 +58,9 @@
"WebSearch",
"mcp__story-kit__*",
"Edit",
"Write"
"Write",
"Bash(find *)",
"Bash(sqlite3 *)"
]
}
}

17
.gitignore vendored
View File

@@ -1,26 +1,14 @@
# Claude Code
.claude/settings.local.json
.mcp.json
# Local environment (secrets)
.env
# App specific
# App specific (root-level; story-kit subdirectory patterns live in .story_kit/.gitignore)
store.json
.story_kit_port
# Bot config (contains credentials)
.story_kit/bot.toml
# Matrix SDK state store
.story_kit/matrix_store/
# Agent worktrees and merge workspace (managed by the server, not tracked in git)
.story_kit/worktrees/
.story_kit/merge_workspace/
# Coverage reports (generated by cargo-llvm-cov, not tracked in git)
.story_kit/coverage/
# Rust stuff
target
@@ -38,6 +26,7 @@ frontend/node_modules
frontend/dist
frontend/dist-ssr
frontend/test-results
frontend/serve
frontend/*.local
server/target

19
.story_kit/.gitignore vendored Normal file
View File

@@ -0,0 +1,19 @@
# Bot config (contains credentials)
bot.toml
# Matrix SDK state store
matrix_store/
matrix_device_id
matrix_history.json
# Agent worktrees and merge workspace (managed by the server, not tracked in git)
worktrees/
merge_workspace/
# Intermediate pipeline stages (transient, not committed per spike 92)
work/2_current/
work/3_qa/
work/4_merge/
# Coverage reports (generated by cargo-llvm-cov, not tracked in git)
coverage/

View File

@@ -18,7 +18,7 @@ When you start a new session with this project:
This returns the full tool catalog (create stories, spawn agents, record tests, manage worktrees, etc.). Familiarize yourself with the available tools before proceeding. These tools allow you to directly manipulate the workflow and spawn subsidiary agents without manual file manipulation.
2. **Read Context:** Check `.story_kit/specs/00_CONTEXT.md` for high-level project goals.
3. **Read Stack:** Check `.story_kit/specs/tech/STACK.md` for technical constraints and patterns.
4. **Check Work Items:** Look at `.story_kit/work/1_upcoming/` and `.story_kit/work/2_current/` to see what work is pending.
4. **Check Work Items:** Look at `.story_kit/work/1_backlog/` and `.story_kit/work/2_current/` to see what work is pending.
---
@@ -52,7 +52,7 @@ project_root/
├── README.md # This document
├── project.toml # Agent configuration (roles, models, prompts)
├── work/ # Unified work item pipeline (stories, bugs, spikes)
│ ├── 1_upcoming/ # New work items awaiting implementation
│ ├── 1_backlog/ # New work items awaiting implementation
│ ├── 2_current/ # Work in progress
│ ├── 3_qa/ # QA review
│ ├── 4_merge/ # Ready to merge to master
@@ -78,7 +78,7 @@ All work items (stories, bugs, spikes) live in the same `work/` pipeline. Items
Items move through stages by moving the file between directories:
`1_upcoming` → `2_current` → `3_qa` → `4_merge` → `5_done` → `6_archived`
`1_backlog` → `2_current` → `3_qa` → `4_merge` → `5_done` → `6_archived`
Items in `5_done` are auto-swept to `6_archived` after 4 hours by the server.
@@ -87,7 +87,7 @@ Items in `5_done` are auto-swept to `6_archived` after 4 hours by the server.
The server watches `.story_kit/work/` for changes. When a file is created, moved, or modified, the watcher auto-commits with a deterministic message and broadcasts a WebSocket notification to the frontend. This means:
* MCP tools only need to write/move files — the watcher handles git commits
* IDE drag-and-drop works (drag a story from `1_upcoming/` to `2_current/`)
* IDE drag-and-drop works (drag a story from `1_backlog/` to `2_current/`)
* The frontend updates automatically without manual refresh
---
@@ -156,7 +156,7 @@ Not everything needs to be a full story. Simple bugs can skip the story process:
* Performance issues with known fixes
### Bug Process
1. **Document Bug:** Create a bug file in `work/1_upcoming/` named `{id}_bug_{slug}.md` with:
1. **Document Bug:** Create a bug file in `work/1_backlog/` named `{id}_bug_{slug}.md` with:
* **Symptom:** What the user observes
* **Root Cause:** Technical explanation (if known)
* **Reproduction Steps:** How to trigger the bug
@@ -186,7 +186,7 @@ Not everything needs a story or bug fix. Spikes are time-boxed investigations to
* Need to validate performance constraints
### Spike Process
1. **Document Spike:** Create a spike file in `work/1_upcoming/` named `{id}_spike_{slug}.md` with:
1. **Document Spike:** Create a spike file in `work/1_backlog/` named `{id}_spike_{slug}.md` with:
* **Question:** What you need to answer
* **Hypothesis:** What you expect to be true
* **Timebox:** Strict limit for the research
@@ -209,7 +209,7 @@ When the LLM context window fills up (or the chat gets slow/confused):
1. **Stop Coding.**
2. **Instruction:** Tell the user to open a new chat.
3. **Handoff:** The only context the new LLM needs is in the `specs/` folder and `.mcp.json`.
* *Prompt for New Session:* "I am working on Project X. Read `.mcp.json` to discover available tools, then read `specs/00_CONTEXT.md` and `specs/tech/STACK.md`. Then look at `work/1_upcoming/` and `work/2_current/` to see what is pending."
* *Prompt for New Session:* "I am working on Project X. Read `.mcp.json` to discover available tools, then read `specs/00_CONTEXT.md` and `specs/tech/STACK.md`. Then look at `work/1_backlog/` and `work/2_current/` to see what is pending."
---
@@ -221,7 +221,7 @@ If a user hands you this document and says "Apply this process to my project":
1. **Check for MCP Tools:** Look for `.mcp.json` in the project root. If it exists, you have programmatic access to workflow tools and agent spawning capabilities.
2. **Analyze the Request:** Ask for the high-level goal ("What are we building?") and the tech preferences ("Rust or Python?").
3. **Git Check:** Check if the directory is a git repository (`git status`). If not, run `git init`.
4. **Scaffold:** Run commands to create the `work/` and `specs/` folders with the 6-stage pipeline (`work/1_upcoming/` through `work/6_archived/`).
4. **Scaffold:** Run commands to create the `work/` and `specs/` folders with the 6-stage pipeline (`work/1_backlog/` through `work/6_archived/`).
5. **Draft Context:** Write `specs/00_CONTEXT.md` based on the user's answer.
6. **Draft Stack:** Write `specs/tech/STACK.md` based on best practices for that language.
7. **Wait:** Ask the user for "Story #1".

View File

@@ -13,3 +13,7 @@ enabled = false
# Maximum conversation turns to remember per room (default: 20).
# history_size = 20
# Rooms where the bot responds to all messages (not just addressed ones).
# This list is updated automatically when users toggle ambient mode at runtime.
# ambient_rooms = ["!roomid:example.com"]

7
.story_kit/problems.md Normal file
View File

@@ -0,0 +1,7 @@
# Problems
Recurring issues observed during pipeline operation. Review periodically and create stories for systemic problems.
## 2026-03-18: Agent committed directly to master instead of worktree
Commit `5f4591f` ("fix: update should_commit_stage test to match 5_done") was made directly on master by an agent (likely mergemaster). Agents should only commit to their feature branch or merge-queue branch, never to master directly. The commit content was correct but the target branch was wrong. Suspect the agent ran `git commit` in the project root instead of the merge worktree directory.

View File

@@ -1,7 +1,7 @@
[[component]]
name = "frontend"
path = "frontend"
setup = ["pnpm install", "pnpm run build"]
setup = ["npm install", "npm run build"]
teardown = []
[[component]]
@@ -34,7 +34,7 @@ You have these tools via the story-kit MCP server:
## Your Workflow
1. Read CLAUDE.md and .story_kit/README.md to understand the project and dev process
2. Read the story file from .story_kit/work/ to understand requirements
3. Move it to work/2_current/ if it is in work/1_upcoming/
3. Move it to work/2_current/ if it is in work/1_backlog/
4. Start coder-1 on the story: call start_agent with story_id="{{story_id}}" and agent_name="coder-1"
5. Wait for completion: call wait_for_agent with story_id="{{story_id}}" and agent_name="coder-1". The server automatically runs acceptance gates (cargo clippy + tests) when the coder process exits. wait_for_agent returns when the coder reaches a terminal state.
6. Check the result: inspect the "completion" field in the wait_for_agent response — if gates_passed is true, the work is done; if false, review the gate_output and decide whether to start a fresh coder.
@@ -56,8 +56,8 @@ role = "Full-stack engineer. Implements features across all components."
model = "sonnet"
max_turns = 50
max_budget_usd = 5.00
prompt = "You are working in a git worktree on story {{story_id}}. Read CLAUDE.md first, then .story_kit/README.md to understand the dev process. The story details are in your prompt above. Follow the SDTW process through implementation and verification (Steps 1-3). The worktree and feature branch already exist - do not create them. Check .mcp.json for MCP tools. Do NOT accept the story or merge - commit your work and stop. If the user asks to review your changes, tell them to run: cd \"{{worktree_path}}\" && git difftool {{base_branch}}...HEAD\n\nIMPORTANT: Commit all your work before your process exits. The server will automatically run acceptance gates (cargo clippy + tests) when your process exits and advance the pipeline based on the results."
system_prompt = "You are a full-stack engineer working autonomously in a git worktree. Follow the Story-Driven Test Workflow strictly. Run cargo clippy and biome checks before considering work complete. Commit all your work before finishing - use a descriptive commit message. Do not accept stories, move them to archived, or merge to master - a human will do that. Do not coordinate with other agents - focus on your assigned story. The server automatically runs acceptance gates when your process exits."
prompt = "You are working in a git worktree on story {{story_id}}. Read CLAUDE.md first, then .story_kit/README.md to understand the dev process. The story details are in your prompt above. Follow the SDTW process through implementation and verification (Steps 1-3). The worktree and feature branch already exist - do not create them. Check .mcp.json for MCP tools. Do NOT accept the story or merge - commit your work and stop. If the user asks to review your changes, tell them to run: cd \"{{worktree_path}}\" && git difftool {{base_branch}}...HEAD\n\nIMPORTANT: Commit all your work before your process exits. The server will automatically run acceptance gates (cargo clippy + tests) when your process exits and advance the pipeline based on the results.\n\n## Bug Workflow: Root Cause First\nWhen working on bugs:\n1. Investigate the root cause before writing any fix. Use `git bisect` to find the breaking commit or `git log` to trace history. Read the relevant code before touching anything.\n2. Fix the root cause with a surgical, minimal change. Do NOT add new abstractions, wrappers, or workarounds when a targeted fix to the original code is possible.\n3. Write commit messages that explain what broke and why, not just what was changed.\n4. If you cannot determine the root cause after thorough investigation, document what you tried and why it was inconclusive — do not guess and ship a speculative fix."
system_prompt = "You are a full-stack engineer working autonomously in a git worktree. Follow the Story-Driven Test Workflow strictly. Run cargo clippy and biome checks before considering work complete. Commit all your work before finishing - use a descriptive commit message. Do not accept stories, move them to archived, or merge to master - a human will do that. Do not coordinate with other agents - focus on your assigned story. The server automatically runs acceptance gates when your process exits. For bugs, always find and fix the root cause. Use git bisect to find breaking commits. Do not layer new code on top of existing code when a surgical fix is possible. If root cause is unclear after investigation, document what you tried rather than guessing."
[[agent]]
name = "coder-2"
@@ -66,8 +66,8 @@ role = "Full-stack engineer. Implements features across all components."
model = "sonnet"
max_turns = 50
max_budget_usd = 5.00
prompt = "You are working in a git worktree on story {{story_id}}. Read CLAUDE.md first, then .story_kit/README.md to understand the dev process. The story details are in your prompt above. Follow the SDTW process through implementation and verification (Steps 1-3). The worktree and feature branch already exist - do not create them. Check .mcp.json for MCP tools. Do NOT accept the story or merge - commit your work and stop. If the user asks to review your changes, tell them to run: cd \"{{worktree_path}}\" && git difftool {{base_branch}}...HEAD\n\nIMPORTANT: Commit all your work before your process exits. The server will automatically run acceptance gates (cargo clippy + tests) when your process exits and advance the pipeline based on the results."
system_prompt = "You are a full-stack engineer working autonomously in a git worktree. Follow the Story-Driven Test Workflow strictly. Run cargo clippy and biome checks before considering work complete. Commit all your work before finishing - use a descriptive commit message. Do not accept stories, move them to archived, or merge to master - a human will do that. Do not coordinate with other agents - focus on your assigned story. The server automatically runs acceptance gates when your process exits."
prompt = "You are working in a git worktree on story {{story_id}}. Read CLAUDE.md first, then .story_kit/README.md to understand the dev process. The story details are in your prompt above. Follow the SDTW process through implementation and verification (Steps 1-3). The worktree and feature branch already exist - do not create them. Check .mcp.json for MCP tools. Do NOT accept the story or merge - commit your work and stop. If the user asks to review your changes, tell them to run: cd \"{{worktree_path}}\" && git difftool {{base_branch}}...HEAD\n\nIMPORTANT: Commit all your work before your process exits. The server will automatically run acceptance gates (cargo clippy + tests) when your process exits and advance the pipeline based on the results.\n\n## Bug Workflow: Root Cause First\nWhen working on bugs:\n1. Investigate the root cause before writing any fix. Use `git bisect` to find the breaking commit or `git log` to trace history. Read the relevant code before touching anything.\n2. Fix the root cause with a surgical, minimal change. Do NOT add new abstractions, wrappers, or workarounds when a targeted fix to the original code is possible.\n3. Write commit messages that explain what broke and why, not just what was changed.\n4. If you cannot determine the root cause after thorough investigation, document what you tried and why it was inconclusive — do not guess and ship a speculative fix."
system_prompt = "You are a full-stack engineer working autonomously in a git worktree. Follow the Story-Driven Test Workflow strictly. Run cargo clippy and biome checks before considering work complete. Commit all your work before finishing - use a descriptive commit message. Do not accept stories, move them to archived, or merge to master - a human will do that. Do not coordinate with other agents - focus on your assigned story. The server automatically runs acceptance gates when your process exits. For bugs, always find and fix the root cause. Use git bisect to find breaking commits. Do not layer new code on top of existing code when a surgical fix is possible. If root cause is unclear after investigation, document what you tried rather than guessing."
[[agent]]
name = "qa-2"
@@ -87,12 +87,12 @@ Read CLAUDE.md first, then .story_kit/README.md to understand the dev process.
- Run `git diff master...HEAD` to review the actual changes for obvious coding mistakes (unused imports, dead code, unhandled errors, hardcoded values)
- Run `cargo clippy --all-targets --all-features` and note any warnings
- If a `frontend/` directory exists:
- Run `pnpm run build` and note any TypeScript errors
- Run `npm run build` and note any TypeScript errors
- Run `npx @biomejs/biome check src/` and note any linting issues
### 2. Test Verification
- Run `cargo test` and verify all tests pass
- If `frontend/` exists: run `pnpm test --run` and verify all frontend tests pass
- If `frontend/` exists: run `npm test` and verify all frontend tests pass
- Review test quality: look for tests that are trivial or don't assert meaningful behavior
### 3. Manual Testing Support
@@ -102,7 +102,7 @@ Read CLAUDE.md first, then .story_kit/README.md to understand the dev process.
- URL to visit in the browser
- Things to check in the UI
- curl commands to exercise relevant API endpoints
- Kill the test server when done: `pkill -f story-kit || true`
- Kill the test server when done: `pkill -f 'target.*story-kit' || true` (NEVER use `pkill -f story-kit` — it kills the vite dev server)
### 4. Produce Structured Report
Print your QA report to stdout before your process exits. The server will automatically run acceptance gates. Use this format:
@@ -118,7 +118,7 @@ Print your QA report to stdout before your process exits. The server will automa
### Test Verification
- cargo test: PASS/FAIL (N tests)
- pnpm test: PASS/FAIL/SKIP (N tests)
- npm test: PASS/FAIL/SKIP (N tests)
- Test quality issues: (list any trivial/weak tests, or "None")
### Manual Testing Plan
@@ -143,8 +143,8 @@ role = "Senior full-stack engineer for complex tasks. Implements features across
model = "opus"
max_turns = 80
max_budget_usd = 20.00
prompt = "You are working in a git worktree on story {{story_id}}. Read CLAUDE.md first, then .story_kit/README.md to understand the dev process. The story details are in your prompt above. Follow the SDTW process through implementation and verification (Steps 1-3). The worktree and feature branch already exist - do not create them. Check .mcp.json for MCP tools. Do NOT accept the story or merge - commit your work and stop. If the user asks to review your changes, tell them to run: cd \"{{worktree_path}}\" && git difftool {{base_branch}}...HEAD\n\nIMPORTANT: Commit all your work before your process exits. The server will automatically run acceptance gates (cargo clippy + tests) when your process exits and advance the pipeline based on the results."
system_prompt = "You are a senior full-stack engineer working autonomously in a git worktree. You handle complex tasks requiring deep architectural understanding. Follow the Story-Driven Test Workflow strictly. Run cargo clippy and biome checks before considering work complete. Commit all your work before finishing - use a descriptive commit message. Do not accept stories, move them to archived, or merge to master - a human will do that. Do not coordinate with other agents - focus on your assigned story. The server automatically runs acceptance gates when your process exits."
prompt = "You are working in a git worktree on story {{story_id}}. Read CLAUDE.md first, then .story_kit/README.md to understand the dev process. The story details are in your prompt above. Follow the SDTW process through implementation and verification (Steps 1-3). The worktree and feature branch already exist - do not create them. Check .mcp.json for MCP tools. Do NOT accept the story or merge - commit your work and stop. If the user asks to review your changes, tell them to run: cd \"{{worktree_path}}\" && git difftool {{base_branch}}...HEAD\n\nIMPORTANT: Commit all your work before your process exits. The server will automatically run acceptance gates (cargo clippy + tests) when your process exits and advance the pipeline based on the results.\n\n## Bug Workflow: Root Cause First\nWhen working on bugs:\n1. Investigate the root cause before writing any fix. Use `git bisect` to find the breaking commit or `git log` to trace history. Read the relevant code before touching anything.\n2. Fix the root cause with a surgical, minimal change. Do NOT add new abstractions, wrappers, or workarounds when a targeted fix to the original code is possible.\n3. Write commit messages that explain what broke and why, not just what was changed.\n4. If you cannot determine the root cause after thorough investigation, document what you tried and why it was inconclusive — do not guess and ship a speculative fix."
system_prompt = "You are a senior full-stack engineer working autonomously in a git worktree. You handle complex tasks requiring deep architectural understanding. Follow the Story-Driven Test Workflow strictly. Run cargo clippy and biome checks before considering work complete. Commit all your work before finishing - use a descriptive commit message. Do not accept stories, move them to archived, or merge to master - a human will do that. Do not coordinate with other agents - focus on your assigned story. The server automatically runs acceptance gates when your process exits. For bugs, always find and fix the root cause. Use git bisect to find breaking commits. Do not layer new code on top of existing code when a surgical fix is possible. If root cause is unclear after investigation, document what you tried rather than guessing."
[[agent]]
name = "qa"
@@ -164,12 +164,12 @@ Read CLAUDE.md first, then .story_kit/README.md to understand the dev process.
- Run `git diff master...HEAD` to review the actual changes for obvious coding mistakes (unused imports, dead code, unhandled errors, hardcoded values)
- Run `cargo clippy --all-targets --all-features` and note any warnings
- If a `frontend/` directory exists:
- Run `pnpm run build` and note any TypeScript errors
- Run `npm run build` and note any TypeScript errors
- Run `npx @biomejs/biome check src/` and note any linting issues
### 2. Test Verification
- Run `cargo test` and verify all tests pass
- If `frontend/` exists: run `pnpm test --run` and verify all frontend tests pass
- If `frontend/` exists: run `npm test` and verify all frontend tests pass
- Review test quality: look for tests that are trivial or don't assert meaningful behavior
### 3. Manual Testing Support
@@ -179,7 +179,7 @@ Read CLAUDE.md first, then .story_kit/README.md to understand the dev process.
- URL to visit in the browser
- Things to check in the UI
- curl commands to exercise relevant API endpoints
- Kill the test server when done: `pkill -f story-kit || true`
- Kill the test server when done: `pkill -f 'target.*story-kit' || true` (NEVER use `pkill -f story-kit` — it kills the vite dev server)
### 4. Produce Structured Report
Print your QA report to stdout before your process exits. The server will automatically run acceptance gates. Use this format:
@@ -195,7 +195,7 @@ Print your QA report to stdout before your process exits. The server will automa
### Test Verification
- cargo test: PASS/FAIL (N tests)
- pnpm test: PASS/FAIL/SKIP (N tests)
- npm test: PASS/FAIL/SKIP (N tests)
- Test quality issues: (list any trivial/weak tests, or "None")
### Manual Testing Plan
@@ -220,7 +220,7 @@ role = "Merges completed coder work into master, runs quality gates, archives st
model = "opus"
max_turns = 30
max_budget_usd = 5.00
prompt = """You are the mergemaster agent for story {{story_id}}. Your job is to merge the completed coder work into master using the merge_agent_work MCP tool.
prompt = """You are the mergemaster agent for story {{story_id}}. Your job is to merge the completed coder work into master.
Read CLAUDE.md first, then .story_kit/README.md to understand the dev process.
@@ -229,20 +229,43 @@ Read CLAUDE.md first, then .story_kit/README.md to understand the dev process.
2. Review the result: check success, had_conflicts, conflicts_resolved, gates_passed, and gate_output
3. If merge succeeded and gates passed: report success to the human
4. If conflicts were auto-resolved (conflicts_resolved=true) and gates passed: report success, noting which conflicts were resolved
5. If conflicts could not be auto-resolved: call report_merge_failure(story_id='{{story_id}}', reason='<conflict details>') and report to the human. Master is untouched.
6. If merge failed for any other reason: call report_merge_failure(story_id='{{story_id}}', reason='<details>') and report to the human.
7. If gates failed after merge: attempt to fix minor issues (see below), then re-trigger merge_agent_work. After 2 fix attempts, call report_merge_failure and stop.
5. If conflicts could not be auto-resolved: **resolve them yourself** in the merge worktree (see below)
6. If merge failed for any other reason: call report_merge_failure(story_id='{{story_id}}', reason='<details>') and report to the human
7. If gates failed after merge: attempt to fix the issues yourself in the merge worktree, then re-trigger merge_agent_work. After 3 fix attempts, call report_merge_failure and stop.
## How Conflict Resolution Works
The merge pipeline uses a temporary merge-queue branch and worktree to isolate merges from master. Simple additive conflicts (both branches adding code at the same location) are resolved automatically by keeping both additions. Complex conflicts (modifying the same lines differently) are reported without touching master.
## Resolving Complex Conflicts Yourself
## Fixing Minor Gate Failures
If quality gates fail (cargo clippy, cargo test, pnpm build, pnpm test), attempt to fix minor issues yourself before reporting to the human.
When the auto-resolver fails, you have access to the merge worktree at `.story_kit/merge_workspace/`. Go in there and resolve the conflicts manually:
**Fix yourself (up to 2 attempts total):**
1. Run `git diff --name-only --diff-filter=U` in the merge worktree to list conflicted files
2. **Build context before touching code.** Run `git log --oneline master...HEAD` on the feature branch to see its commits. Then run `git log --oneline --since="$(git log -1 --format=%ci <feature-branch-base-commit>)" master` to see what landed on master since the branch was created. Read the story files in `.story_kit/work/` for any recently merged stories that touch the same files — this tells you WHY master changed and what must be preserved.
3. Read each conflicted file and understand both sides of the conflict
4. **Understand intent, not just syntax.** The feature branch may be behind master — master's version of shared infrastructure is almost always correct. The feature branch's contribution is the NEW functionality it adds. Your job is to integrate the new into master's structure, not pick one side.
5. Resolve by integrating the feature's new functionality into master's code structure
5. Stage resolved files with `git add`
6. Run `cargo check` (and `npm run build` if frontend changed) to verify compilation
7. If it compiles, commit and re-trigger merge_agent_work
### Common conflict patterns in this project:
**Story file rename/rename conflicts:** Both branches moved the story .md file to different pipeline directories. Resolution: `git rm` both sides — story files in `work/2_current/`, `work/3_qa/`, `work/4_merge/` are gitignored and don't need to be committed.
**bot.rs tokio::select! conflicts:** Master has a `tokio::select!` loop in `handle_message()` that handles permission forwarding (story 275). Feature branches created before story 275 have a simpler direct `provider.chat_stream().await` call. Resolution: KEEP master's tokio::select! loop. Integrate only the feature's new logic (e.g. typing indicators, new callbacks) into the existing loop structure. Do NOT replace the loop with the old direct call.
**Duplicate functions/imports:** The auto-resolver keeps both sides, producing duplicates. Resolution: keep one copy (prefer master's version), delete the duplicate.
**Formatting-only conflicts:** Both sides reformatted the same code differently. Resolution: pick either side (prefer master).
## Fixing Gate Failures
If quality gates fail (cargo clippy, cargo test, npm run build, npm test), attempt to fix issues yourself in the merge worktree.
**Fix yourself (up to 3 attempts total):**
- Syntax errors (missing semicolons, brackets, commas)
- Duplicate definitions from merge artifacts
- Simple type annotation errors
- Unused import warnings flagged by clippy
- Mismatched braces from bad conflict resolution
- Trivial formatting issues that block compilation or linting
**Report to human without attempting a fix:**
@@ -250,17 +273,14 @@ If quality gates fail (cargo clippy, cargo test, pnpm build, pnpm test), attempt
- Missing function implementations
- Architectural changes required
- Non-trivial refactoring needed
- Anything requiring understanding of broader system context
**Max retry limit:** If gates still fail after 2 fix attempts, call report_merge_failure to record the failure, then stop immediately and report the full gate output to the human. Do not retry further.
**Max retry limit:** If gates still fail after 3 fix attempts, call report_merge_failure to record the failure, then stop immediately and report the full gate output to the human.
## CRITICAL Rules
- NEVER manually move story files between pipeline stages (e.g. from 4_merge/ to 5_done/)
- NEVER call accept_story — only merge_agent_work can move stories to done after a successful merge
- When merge fails, ALWAYS call report_merge_failure to record the failure — do NOT improvise with file moves
- Only use MCP tools (merge_agent_work, report_merge_failure) to drive the merge process
- Only attempt fixes that are clearly minor and low-risk
- When merge fails after exhausting your fix attempts, ALWAYS call report_merge_failure
- Report conflict resolution outcomes clearly
- Report gate failures with full output so the human can act if needed
- The server automatically runs acceptance gates when your process exits"""
system_prompt = "You are the mergemaster agent. Your primary responsibility is to trigger the merge_agent_work MCP tool and report the results. CRITICAL: Never manually move story files or call accept_story. When merge fails, call report_merge_failure to record the failure. For minor gate failures (syntax errors, unused imports, missing semicolons), attempt to fix them yourself — but stop after 2 attempts, call report_merge_failure, and report to the human. For complex failures or unresolvable conflicts, call report_merge_failure and report clearly so the human can act. The merge pipeline automatically resolves simple additive conflicts."
system_prompt = "You are the mergemaster agent. Your primary job is to merge feature branches to master. First try the merge_agent_work MCP tool. If the auto-resolver fails on complex conflicts, resolve them yourself in the merge worktree — you are an opus-class agent capable of understanding both sides of a conflict and producing correct merged code. Common patterns: keep master's tokio::select! permission loop in bot.rs, discard story file rename conflicts (gitignored), remove duplicate definitions. After resolving, verify compilation before re-triggering merge. CRITICAL: Never manually move story files or call accept_story. After 3 failed fix attempts, call report_merge_failure and stop."

View File

@@ -9,7 +9,7 @@ This project is a standalone Rust **web server binary** that serves a Vite/React
* **Framework:** Poem HTTP server with WebSocket support for streaming; HTTP APIs should use Poem OpenAPI (Swagger) for non-streaming endpoints.
* **Frontend:** TypeScript + React
* **Build Tool:** Vite
* **Package Manager:** pnpm (required)
* **Package Manager:** npm
* **Styling:** CSS Modules or Tailwind (TBD - Defaulting to CSS Modules)
* **State Management:** React Context / Hooks
* **Chat UI:** Rendered Markdown with syntax highlighting.
@@ -91,8 +91,8 @@ To support both Remote and Local models, the system implements a `ModelProvider`
* **Quality Gates:**
* `npx @biomejs/biome check src/` must show 0 errors, 0 warnings
* `npm run build` must succeed
* `npx vitest run` must pass
* `npx playwright test` must pass
* `npm test` must pass
* `npm run test:e2e` must pass
* No `any` types allowed (use proper types or `unknown`)
* React keys must use stable IDs, not array indices
* All buttons must have explicit `type` attribute
@@ -119,7 +119,7 @@ To support both Remote and Local models, the system implements a `ModelProvider`
Multiple instances can run simultaneously in different worktrees. To avoid port conflicts:
- **Backend:** Set `STORYKIT_PORT` to a unique port (default is 3001). Example: `STORYKIT_PORT=3002 cargo run`
- **Frontend:** Run `pnpm dev` from `frontend/`. It auto-selects the next unused port. It reads `STORYKIT_PORT` to know which backend to talk to, so export it before running: `export STORYKIT_PORT=3002 && cd frontend && pnpm dev`
- **Frontend:** Run `npm run dev` from `frontend/`. It auto-selects the next unused port. It reads `STORYKIT_PORT` to know which backend to talk to, so export it before running: `export STORYKIT_PORT=3002 && cd frontend && npm run dev`
When running in a worktree, use a port that won't conflict with the main instance (3001). Ports 3002+ are good choices.

View File

@@ -0,0 +1,24 @@
---
name: "Upgrade libsqlite3-sys"
---
# Refactor 260: Upgrade libsqlite3-sys
## Description
Upgrade the `libsqlite3-sys` dependency from `0.35.0` to `0.37.0`. The crate is used with `features = ["bundled"]` for static builds.
## Version Notes
- Current: `libsqlite3-sys 0.35.0` (pinned transitively by `matrix-sdk 0.16.0``matrix-sdk-sqlite``rusqlite 0.37.x`)
- Target: `libsqlite3-sys 0.37.0`
- Latest upstream rusqlite: `0.39.0`
- **Blocker**: `matrix-sdk 0.16.0` pins `rusqlite 0.37.x` which pins `libsqlite3-sys 0.35.0`. A clean upgrade requires either waiting for matrix-sdk to bump their rusqlite dep, or upgrading matrix-sdk itself.
- **Reverted 2026-03-17**: A previous coder vendored the entire rusqlite crate with a fake `0.37.99` version and patched its libsqlite3-sys dep. This was too hacky — reverted to clean `0.35.0`.
## Acceptance Criteria
- [ ] `libsqlite3-sys` is upgraded to `0.37.0` via a clean dependency path (no vendored forks)
- [ ] `cargo build` succeeds
- [ ] All tests pass
- [ ] No `[patch.crates-io]` hacks or vendored crates

View File

@@ -0,0 +1,32 @@
---
name: "Long-running supervisor agent with periodic pipeline polling"
agent: coder-opus
---
# Story 280: Long-running supervisor agent with periodic pipeline polling
## User Story
As a project owner, I want a long-running supervisor agent (opus) that automatically monitors the pipeline, assigns agents, resolves stuck items, and handles routine operational tasks, so that I don't have to manually check status, kick agents, or babysit the pipeline in every conversation.
## Acceptance Criteria
- [ ] Server can start a persistent supervisor agent that stays alive across the session (not per-story)
- [ ] Server prods the supervisor periodically (default 30s, configurable in project.toml) with a pipeline status update
- [ ] Supervisor auto-assigns agents to unassigned items in current/qa/merge stages
- [ ] Supervisor detects stuck agents (no progress for configurable timeout) and restarts them
- [ ] Supervisor detects merge failures and sends stories back to current for rebase when appropriate
- [ ] Supervisor can be chatted with via Matrix (timmy relays to supervisor) or via the web UI
- [ ] Supervisor logs its decisions so the human can review what it did and why
- [ ] Polling interval is configurable in project.toml (e.g. supervisor_poll_interval_secs = 30)
- [ ] Supervisor logs persistent/recurring problems to `.story_kit/problems.md` with timestamp, description, and frequency — humans review this file periodically to create stories for systemic issues
## Notes
- **2026-03-18**: Moved back to current from merge. Previous attempt went through the full pipeline but the squash-merge produced an empty diff — no code was actually implemented. Needs a real implementation.
## Out of Scope
- Supervisor accepting or merging stories to master (human job)
- Supervisor making architectural decisions
- Replacing the existing per-story agent spawning — supervisor coordinates on top of it

View File

@@ -0,0 +1,21 @@
---
name: "Show server logs in web UI"
---
# Story 292: Show server logs in web UI
## User Story
As a project owner using the web UI, I want to see live server logs in the interface, so that I can debug agent behavior and pipeline issues without needing terminal access.
## Acceptance Criteria
- [ ] Web UI has a server logs panel accessible from the main interface
- [ ] Logs stream in real-time via WebSocket or SSE
- [ ] Logs can be filtered by keyword (same as get_server_logs MCP tool's filter param)
- [ ] Log entries show timestamp and severity level
- [ ] Panel doesn't interfere with the existing pipeline board and work item views
## Out of Scope
- TBD

View File

@@ -1,55 +0,0 @@
---
name: "Stop auto-committing intermediate pipeline moves"
---
# Spike 92: Stop auto-committing intermediate pipeline moves
## Goal
Determine how to stop the filesystem watcher from auto-committing every pipeline stage move (upcoming -> current -> qa -> merge) while still committing at terminal states (creation in upcoming, acceptance in archived). This keeps git history clean while preserving cross-machine portability for completed work.
## Context
The watcher in `server/src/io/watcher.rs` currently auto-commits every file change in `.story_kit/work/`. A single story run generates 5+ commits just from pipeline moves:
- `story-kit: create 42_story_foo`
- `story-kit: start 42_story_foo`
- `story-kit: queue 42_story_foo for QA`
- `story-kit: queue 42_story_foo for merge`
- `story-kit: accept 42_story_foo`
Since story runs complete relatively quickly, the intermediate state (current/qa/merge) is transient and doesn't need to be committed. Only creation and archival are meaningful checkpoints.
## Questions to Answer
1. Can we filter `stage_metadata()` to only commit for `1_upcoming` and `5_archived` stages while still broadcasting `WatcherEvent`s for all stages (so the frontend stays in sync)?
2. Should we keep `git add -A .story_kit/work/` for the committed stages, or narrow it to only the specific file?
3. What happens if the server crashes mid-pipeline? Uncommitted moves are lost — is this acceptable given the story can just be re-run?
4. Should intermediate moves be `.gitignore`d at the directory level, or is filtering in the watcher sufficient?
5. Do any other parts of the system (agent worktree setup, merge_agent_work, sparse checkout) depend on intermediate pipeline files being committed to master?
## Approach to Investigate
### Option A: Filter in `flush_pending()`
- In `flush_pending()`, still broadcast the `WatcherEvent` for all stages
- Only call `git_add_work_and_commit()` for stages `1_upcoming` and `5_archived`
- Simplest change — ~5 lines modified in `watcher.rs`
### Option B: Two-tier watcher
- Split into "commit-worthy" events (create, archive) and "notify-only" events (start, qa, merge)
- Commit-worthy events go through git
- Notify-only events just broadcast to WebSocket clients
- More explicit but same end result as Option A
### Option C: .gitignore intermediate directories
- Add `2_current/`, `3_qa/`, `4_merge/` to `.gitignore`
- Watcher still sees events (gitignore doesn't affect filesystem watching)
- Git naturally ignores them
- Risk: harder to debug, `git status` won't show pipeline state
## Acceptance Criteria
- [ ] Spike document updated with findings and recommendation
- [ ] If Option A is viable: prototype the change and verify git log is clean during a full story run
- [ ] Confirm frontend still receives real-time pipeline updates for all stages
- [ ] Confirm no other system depends on intermediate pipeline commits being on master
- [ ] Identify any edge cases (server crash, manual git operations, multi-machine sync)

View File

@@ -0,0 +1,24 @@
---
name: "Matrix bot sends typing indicator while waiting for Claude response"
---
# Story 273: Matrix bot sends typing indicator while waiting for Claude response
## User Story
As a user chatting with the Matrix bot, I want to see a typing indicator in Element while the bot is processing my message, so that I know it received my request and is working on a response.
## Acceptance Criteria
- [ ] Bot sets m.typing on the room as soon as it starts the Claude API call
- [ ] Typing indicator is cleared when the first response chunk is sent to the room
- [ ] Typing indicator is cleared on error so it doesn't get stuck
- [ ] No visible delay between sending a message and seeing the typing indicator
## Notes
- **2026-03-18**: Moved back to current from done. Previous attempt went through the full pipeline but merged with an empty diff — no typing indicator code was actually implemented. Needs a real implementation this time.
## Out of Scope
- TBD

View File

@@ -0,0 +1,24 @@
---
name: "Matrix bot ambient mode toggle via chat command"
---
# Story 282: Matrix bot ambient mode toggle via chat command
## User Story
As a user chatting with Timmy in a Matrix room, I want to toggle between "addressed mode" (bot only responds when mentioned by name) and "ambient mode" (bot responds to all messages) via a chat command, so that I don't have to @-mention the bot on every message when I'm the only one around.
## Acceptance Criteria
- [ ] Matrix bot defaults to addressed mode — only forwards messages containing the bot's name to Claude
- [ ] Chat command "{bot_name} ambient on" switches to ambient mode — bot forwards all room messages to Claude (bot name comes from display_name in bot.toml)
- [ ] Chat command "{bot_name} ambient off" switches back to addressed mode
- [ ] Mode is persisted per-room in bot.toml so it survives bot restarts
- [ ] bot.toml.example includes the ambient_mode setting with a comment explaining it
- [ ] Bot confirms the mode switch with a short response in chat
- [ ] When other users join or are active, user can flip back to addressed mode to avoid noise
- [ ] Ambient mode applies per-room (not globally across all rooms)
## Out of Scope
- TBD

View File

@@ -0,0 +1,30 @@
---
name: "Pipeline does not check manual_qa flag before advancing from QA to merge"
---
# Bug 283: Pipeline does not check manual_qa flag before advancing from QA to merge
## Description
Story 247 added the manual_qa front matter field and the MCP tooling to set it, but the pipeline in pool.rs never actually checks the flag. After QA passes gates and coverage, stories move straight to merge regardless of manual_qa setting.
## How to Reproduce
1. Create a story with manual_qa: true in front matter
2. Let it go through the coder and QA stages
3. Observe that it moves directly to merge without waiting for human approval
## Actual Result
Stories always advance from QA to merge automatically, ignoring the manual_qa flag.
## Expected Result
Stories with manual_qa: true should pause after QA passes and wait for human approval before moving to merge. Stories with manual_qa: false (the default) should advance automatically as they do now.
## Acceptance Criteria
- [ ] Pipeline checks manual_qa front matter field after QA gates pass
- [ ] manual_qa defaults to false — stories advance automatically unless explicitly opted in
- [ ] Stories with manual_qa: true wait in 3_qa for human approval via accept_story or the UI
- [ ] Stories with manual_qa: false proceed directly from QA to merge as before

View File

@@ -0,0 +1,22 @@
---
name: "Matrix bot status command shows pipeline and agent availability"
---
# Story 284: Matrix bot status command shows pipeline and agent availability
## User Story
As a user in a Matrix room, I want to type "{bot_name} status" and get a formatted summary of the full pipeline (upcoming through done) with agent assignments, plus which agents are currently free, so that I can check project status without leaving chat.
## Acceptance Criteria
- [ ] Chat command "{bot_name} status" triggers a pipeline status display (bot name comes from display_name in bot.toml)
- [ ] Output shows all stages: upcoming, current, qa, merge, done — with story names and IDs
- [ ] Each active story shows its assigned agent name and model
- [ ] Output includes a section showing which agents are free (not currently assigned to any story)
- [ ] Response is formatted for readability in Matrix (monospace or markdown as appropriate)
- [ ] Command is handled at the bot level — does not require a full Claude invocation
## Out of Scope
- TBD

View File

@@ -0,0 +1,25 @@
---
name: "Matrix bot help command lists available bot commands"
---
# Story 285: Matrix bot help command lists available bot commands
## User Story
As a user in a Matrix room, I want to type "{bot_name} help" and get a list of all available bot commands with brief descriptions, so that I can discover what the bot can do without having to ask or remember.
## Acceptance Criteria
- [ ] Chat command "{bot_name} help" displays a list of all available bot-level commands (bot name comes from display_name in bot.toml)
- [ ] Each command is shown with a short description of what it does
- [ ] Help output is formatted for readability in Matrix
- [ ] Help command is handled at the bot level — does not require a full Claude invocation
- [ ] Help list automatically includes new commands as they are added (driven by a registry or similar, not a hardcoded string)
## Notes
- **2026-03-18**: Moved back to current from done. Previous attempt committed code directly to master (commit a32cfbd) instead of the worktree, and the help command is not functional in the running server. Needs a clean implementation this time.
## Out of Scope
- TBD

View File

@@ -0,0 +1,22 @@
---
name: "Server self-rebuild and restart via MCP tool"
---
# Story 286: Server self-rebuild and restart via MCP tool
## User Story
As a project owner away from my terminal, I want to tell the bot to restart the server so that it picks up new code changes, without needing physical access to the machine.
## Acceptance Criteria
- [ ] MCP tool `rebuild_and_restart` triggers a cargo build of the server
- [ ] If the build fails, server stays up and returns the build error
- [ ] If the build succeeds, server re-execs itself with the new binary using std::os::unix::process::CommandExt::exec()
- [ ] Server logs the restart so it's traceable
- [ ] Matrix bot reconnects automatically after the server comes back up
- [ ] Running agents are gracefully stopped before re-exec
## Out of Scope
- TBD

View File

@@ -0,0 +1,22 @@
---
name: "Rename upcoming pipeline stage to backlog"
---
# Story 287: Rename upcoming pipeline stage to backlog
## User Story
As a project owner, I want the "upcoming" pipeline stage renamed to "backlog" throughout the codebase, UI, and directory structure, so that the terminology better reflects that these items are not necessarily coming up next.
## Acceptance Criteria
- [ ] Directory renamed from 1_upcoming to 1_backlog
- [ ] All server code references updated (watcher, lifecycle, MCP tools, workflow, etc.)
- [ ] Frontend UI labels updated
- [ ] MCP tool descriptions and outputs use "backlog" instead of "upcoming"
- [ ] Existing story/bug files moved to the new directory
- [ ] Git commit messages use "backlog" for new items going forward
## Out of Scope
- TBD

View File

@@ -0,0 +1,29 @@
---
name: "Ambient mode state lost on server restart"
---
# Bug 288: Ambient mode state lost on server restart
## Description
Story 282 implemented ambient mode toggle but only in-memory. The acceptance criterion requiring persistence in bot.toml was not implemented. Every server restart (including rebuild_and_restart) clears ambient mode for all rooms.
## How to Reproduce
1. Type "timmy ambient on" — get confirmation
2. Restart server (or rebuild_and_restart)
3. Send unaddressed message — bot ignores it, ambient mode is gone
## Actual Result
Ambient mode state is lost on server restart.
## Expected Result
Ambient mode per-room state is persisted in bot.toml and restored on startup.
## Acceptance Criteria
- [ ] Ambient mode per-room state is saved to bot.toml when toggled
- [ ] Ambient mode state is restored from bot.toml on server startup
- [ ] bot.toml.example includes the ambient_rooms setting with a comment

View File

@@ -0,0 +1,28 @@
---
name: "rebuild_and_restart MCP tool does not rebuild"
agent: coder-opus
---
# Bug 289: rebuild_and_restart MCP tool does not rebuild
## Description
The rebuild_and_restart MCP tool re-execs the server binary but does not run cargo build first. It restarts with the old binary, so code changes are not picked up.
## How to Reproduce
1. Make a code change to the server
2. Call rebuild_and_restart via MCP
3. Observe the server restarts but the code change is not reflected
## Actual Result
Server re-execs with the old binary. Code changes are not compiled.
## Expected Result
Server runs cargo build --release (or cargo build) before re-execing, so the new binary includes the latest code changes.
## Acceptance Criteria
- [ ] Bug is fixed and verified

View File

@@ -0,0 +1,22 @@
---
name: "Remove agent thinking traces from agents sidebar"
---
# Story 290: Remove agent thinking traces from agents sidebar
## User Story
As a user viewing an expanded work item in the web UI, I want to see the live agent output stream (thinking traces, tool calls, progress) for the agent working on that story, so that I can monitor progress in context rather than in the agents sidebar.
## Acceptance Criteria
- [ ] Agent thinking traces are removed from the agents sidebar panel — they should only appear in the work item detail panel (which already has SSE streaming wired up in `WorkItemDetailPanel.tsx`)
## Notes
The detail panel (`WorkItemDetailPanel.tsx`) already has agent log streaming implemented — SSE subscription, real-time output, status badges, etc. The only remaining work is removing the thinking traces from the agents sidebar (`AgentPanel.tsx` or similar) so they don't appear in both places.
## Out of Scope
- Replacing the agents sidebar entirely — it still shows agent names, status, and assignments
- Historical agent output (only live stream while agent is running)

View File

@@ -0,0 +1,28 @@
---
name: /btw Side Question Slash Command
---
## User Story
As a user, I want to ask the agent a quick side question using `/btw` so that I can get a fast answer from the current conversation context without disrupting the main chat thread.
## Acceptance Criteria
- [ ] User can type `/btw <question>` in the chat input
- [ ] The agent answers using the full conversation history as context
- [ ] The question and response are displayed in a dismissible overlay, not in the main chat thread
- [ ] The question and response are not added to the conversation history
- [ ] No tool calls are made when answering a `/btw` question — the agent responds only from what is already in context
- [ ] The overlay can be dismissed with Escape, Enter, or Space
- [ ] `/btw` can be invoked while the agent is actively processing a response without interrupting it
- [ ] The slash command detection and dispatch mechanism must be reusable — build a shared parser/router so future slash commands (e.g. /help, /status) can plug in without duplicating detection logic
## Out of Scope
- Follow-up turns within the side question
- Tool usage in side question responses
- Persisting side question history
## Rejection Notes
**2026-03-14:** Previous implementation was rejected. The frontend did nothing when the user typed `/btw` — the slash command was not wired up in the UI at all. The backend may have had changes but the feature was non-functional from the user's perspective. Ensure the full end-to-end flow works: typing `/btw <question>` in the chat input must visibly trigger the overlay with a response.

View File

@@ -0,0 +1,24 @@
---
name: "/help Slash Command"
---
# Story 241: /help Slash Command
## User Story
As a user, I want to type /help in the chat input so that I can see a list of available slash commands and what they do.
## Acceptance Criteria
- [ ] User can type /help in the chat input
- [ ] A help overlay or panel displays all available slash commands with brief descriptions
- [ ] The overlay can be dismissed with Escape, Enter, or Space
- [ ] The slash command detection and dispatch mechanism is shared across all slash commands (reuse the same parser/router used by /btw and other slash commands — do not duplicate detection logic)
## Out of Scope
- TBD
## Rejection Notes
**2026-03-14:** Previous implementation was rejected. The frontend did nothing when the user typed `/help` — the slash command was not wired up in the UI at all. Ensure the full end-to-end flow works: typing `/help` in the chat input must visibly display the help overlay with slash command descriptions.

View File

@@ -0,0 +1,20 @@
---
name: "/status Slash Command"
---
# Story 242: /status Slash Command
## User Story
As a user, I want to type /status in the chat input so that I can see the current state of the agent, active story, pipeline stage, and any running processes at a glance.
## Acceptance Criteria
- [ ] User can type /status in the chat input
- [ ] A status overlay or panel shows: current story (if any), pipeline stage, agent status, and running processes
- [ ] The overlay can be dismissed with Escape, Enter, or Space
- [ ] The slash command detection and dispatch mechanism is shared across all slash commands (reuse the same parser/router used by /btw and other slash commands — do not duplicate detection logic)
## Out of Scope
- TBD

View File

@@ -0,0 +1,28 @@
---
name: "Replace pnpm with npm"
---
# Bug 243: Replace pnpm with npm
## Description
pnpm's reflink-based package import frequently fails with ERR_PNPM_ENOENT when running in git worktrees (.story_kit/merge_workspace), causing merge quality gates to fail repeatedly. No pnpm-specific features are in use.
## How to Reproduce
Move any story to merge. The mergemaster runs pnpm install in the merge worktree and it fails with ERR_PNPM_ENOENT reflink errors.
## Actual Result
pnpm install fails in merge worktrees, blocking all merges.
## Expected Result
Package installation works reliably in all worktree contexts.
## Acceptance Criteria
- [ ] pnpm-lock.yaml is removed and package-lock.json is generated
- [ ] All pnpm references in project.toml are replaced with npm equivalents
- [ ] npm install and npm run build succeed in a clean worktree
- [ ] No other pnpm references remain in project configuration

View File

@@ -0,0 +1,68 @@
---
name: "Chat history persistence lost on page refresh (story 145 regression)"
agent: coder-opus
---
## Rejection Notes
**2026-03-16:** Previous coder produced zero code changes — feature branch had no diff against master. The coder must actually use `git bisect` to find the breaking commit and produce a surgical fix. Do not submit with no code changes.
**2026-03-17:** Re-opened. Multiple fix attempts have failed. See investigation notes below for the actual root cause.
# Bug 245: Chat history persistence lost on page refresh (story 145 regression)
## Description
Story 145 implemented localStorage persistence for chat history across page reloads. This is no longer working — refreshing the page loses all conversation context. This is a regression of the feature delivered in story 145.
## How to Reproduce
1. Open the web UI and have a conversation with the agent
2. Refresh the page (F5 or Cmd+R)
3. Send a new message
4. The LLM has no knowledge of the prior conversation
## Actual Result
Chat history is gone after refresh — the UI shows a blank conversation. Even if messages appear in the UI (loaded from localStorage), the LLM does not receive them as context on the next exchange.
## Expected Result
Chat history is restored from localStorage on page load, as implemented in story 145. The LLM should receive the full conversation history when the user sends a new message after refresh.
## Acceptance Criteria
- [ ] Chat messages survive a full page refresh (visible in UI)
- [ ] Chat messages are restored from localStorage on component mount
- [ ] After refresh, the LLM receives full prior conversation history as context when the user sends the next message
- [ ] Behaviour matches the original acceptance criteria from story 145
## Investigation Notes (2026-03-17)
### Root cause analysis
The frontend correctly:
1. Persists messages to localStorage in `useChatHistory.ts` (key: `storykit-chat-history:{projectPath}`)
2. Loads them on mount
3. Sends the FULL history array to the backend via `wsRef.current?.sendChat(newHistory, config)` in `Chat.tsx` line ~558
The backend bug is in `server/src/llm/chat.rs`:
- The `chat()` function receives the full `messages: Vec<Message>` from the client
- Line ~283: `let mut current_history = messages.clone()` — correctly clones full history
- Lines ~299-318: Adds 2 system prompts at position 0 and 1
- Lines ~323-404: Main LLM loop generates new assistant/tool messages
- **Line ~407: `ChatResult { messages: new_messages }` — BUG: returns ONLY the newly generated turn, not the full `current_history`**
During streaming, the `on_update()` callbacks DO send `current_history[2..]` (full history minus system prompts), which is correct. But there may be a reconciliation issue on the frontend where the final state doesn't include the full history.
### Key files
- `frontend/src/hooks/useChatHistory.ts` — localStorage persistence
- `frontend/src/components/Chat.tsx` — sends full history, handles `onUpdate` callbacks
- `frontend/src/api/client.ts` — WebSocket client
- `server/src/http/ws.rs` — WebSocket handler, passes messages to chat()
- `server/src/llm/chat.rs`**THE BUG** at line ~407, ChatResult returns only new_messages
### What NOT to do
- Do NOT layer on a new localStorage implementation. The localStorage code works fine.
- Do NOT add server-side persistence. The "dumb pipe" architecture is correct.
- The fix should be surgical — ensure the full conversation history round-trips correctly through the backend.

View File

@@ -0,0 +1,21 @@
---
name: "Enforce cryptographic identity verification for Matrix commands"
---
# Story 246: Enforce cryptographic identity verification for Matrix commands
## User Story
As the operator of a Story Kit instance, I want the Matrix bot to always require cryptographic device verification before executing commands, so that a compromised homeserver cannot be used to execute unauthorized commands.
## Acceptance Criteria
- [ ] Bot refuses to process commands from unencrypted rooms
- [ ] Bot always verifies the sending device is cross-signing-verified by a trusted identity before executing any command
- [ ] The require_verified_devices config option is removed — verification is always on with no way to disable it
- [ ] Messages from unverified devices are rejected with a clear log message
- [ ] Existing allowed_users check remains as a first-pass filter before the cryptographic check
## Out of Scope
- TBD

View File

@@ -0,0 +1,27 @@
---
name: "Chat does not auto-scroll to new messages"
---
# Bug 248: Chat does not auto-scroll to new messages
## Description
The chat UI does not automatically scroll to the bottom when new assistant messages stream in. The user has to manually scroll down to see the response, making it appear as if the bot stopped responding.
## How to Reproduce
1. Send a message in the chat UI
2. Wait for the assistant to respond with a long message or multi-turn tool use
3. Observe that the viewport does not scroll to follow the new content
## Actual Result
The viewport stays at the current scroll position. New messages appear below the fold, invisible to the user.
## Expected Result
The chat viewport should auto-scroll to the bottom as new content streams in, keeping the latest message visible.
## Acceptance Criteria
- [ ] Bug is fixed and verified

View File

@@ -0,0 +1,25 @@
---
name: "Agent assignment via story front matter"
---
## Rejection Notes
**2026-03-16:** Previous coder only updated the serve submodule pointer — no actual implementation. Feature branch also reverted changes from stories 246 and 248. The agent front matter parsing and pipeline assignment logic was never written. Start fresh on a clean branch from master.
# Story 249: Agent assignment via story front matter
## User Story
As a project owner, I want to specify which agent should work on a story via a front matter field (e.g. agent: coder-opus) so that complex stories get assigned to the right coder automatically.
## Acceptance Criteria
- [ ] Story files support an optional agent front matter field (e.g. agent: coder-opus)
- [ ] When the pipeline auto-assigns a coder to a story, it uses the agent specified in front matter if present
- [ ] If the specified agent is busy, the story waits rather than falling back to a different coder
- [ ] If no agent is specified in front matter, the existing default assignment behaviour is used
- [ ] The supervisor agent respects the front matter assignment when starting coders
## Out of Scope
- TBD

View File

@@ -0,0 +1,34 @@
---
name: "Merge pipeline cherry-pick fails with bad revision on merge-queue branch"
---
## Rejection Notes
**2026-03-16:** Previous coder (coder-opus) produced zero code changes. The feature branch had no diff against master. Actually fix the bug this time.
# Bug 250: Merge pipeline cherry-pick fails with bad revision on merge-queue branch
## Description
The mergemaster merge pipeline consistently fails at the cherry-pick step with: fatal: bad revision merge-queue/{story_id}. The merge-queue branch is created and the squash commit succeeds, but the branch reference is not accessible during the subsequent cherry-pick onto master. This affects every story that reaches the merge stage — no stories can be automatically merged. The issue is in the git reference handling within the merge pipeline, not a code conflict.
## How to Reproduce
1. Have a completed story in 4_merge/ with a feature branch containing commits ahead of master
2. Trigger merge_agent_work via MCP or let the mergemaster agent run
3. Observe the cherry-pick failure
## Actual Result
Cherry-pick fails with fatal: bad revision merge-queue/{story_id}. The merge-queue branch was created and squash commit succeeded, but the branch reference is not found during cherry-pick. Master is untouched.
## Expected Result
The merge pipeline should successfully squash-merge the feature branch into master, run quality gates, move the story to done, and clean up the worktree and branch.
## Acceptance Criteria
- [ ] Use git bisect or git log to find when the merge pipeline broke
- [ ] Fix the root cause — do not layer on a workaround
- [ ] Merge pipeline successfully merges a story from 4_merge to master end-to-end
- [ ] Quality gates run and pass before the merge commits to master

View File

@@ -0,0 +1,32 @@
---
name: "Archive sweep not moving stories from done to archived"
---
# Bug 251: Archive sweep not moving stories from done to archived
## Description
Stories that have been in `5_done/` for well over the configured retention period (default 4 hours) are not being automatically swept to `6_archived/`. Items from March 14 are still sitting in `5_done/` as of March 16 — over 2 days past the threshold. The last items that successfully reached `6_archived/` date from Feb 23-24.
Additionally, story file moves (e.g. from one pipeline stage to another) are sometimes not being auto-committed, which used to work.
## How to Reproduce
1. Start the Story Kit server
2. Move a story to `5_done/`
3. Wait longer than `done_retention_secs` (default 14400 seconds / 4 hours)
4. Observe that the story is never moved to `6_archived/`
## Actual Result
Stories remain in `5_done/` indefinitely. No sweep log messages appear in the server output.
## Expected Result
Stories older than `done_retention_secs` are automatically moved to `6_archived/` and the move is auto-committed.
## Investigation Notes
The sweep logic lives in `server/src/io/watcher.rs` around line 208 (`sweep_done_to_archived()`). The watcher runs on a dedicated OS thread (line 310) with a timer-based sweep interval (line 441, default 60s).
**Do NOT layer new code on top of this.** Use `git bisect` or `git log` to find when the sweep stopped working. The code looks structurally correct — the watcher thread may be dying silently with no restart mechanism, or something changed in how/when the sweep is triggered. Find the root cause and fix it there.

View File

@@ -0,0 +1,22 @@
---
name: "Coder agents must find root causes for bugs"
---
# Story 252: Coder agents must find root causes for bugs
## User Story
As a project owner, I want coder agents to always investigate and fix the root cause of bugs rather than layering new code on top, so that fixes are surgical, minimal, and don't introduce unnecessary complexity.
## Acceptance Criteria
- [ ] When a coder agent picks up a bug, it must first investigate to find the root cause (e.g. using `git bisect`, `git log`, reading the relevant code history)
- [ ] The coder's commit message must explain what broke and why, not just what was changed
- [ ] Coders must not add new abstractions, wrappers, or workarounds when a targeted fix to the original code is possible
- [ ] The system prompt or agent instructions for coder agents include clear guidance: "For bugs, always find and fix the root cause. Use git bisect to find breaking commits. Do not layer new code on top of existing code when a surgical fix is possible."
- [ ] If a coder cannot determine the root cause, it must document what it tried and why it was inconclusive, rather than guessing and shipping a speculative fix
## Out of Scope
- Changes to how stories (non-bugs) are handled
- Automated enforcement (this is guidance/instruction, not a gate)

View File

@@ -0,0 +1,35 @@
---
name: "Watcher and auto-assign do not reinitialize when project root changes"
---
# Bug 253: Watcher and auto-assign do not reinitialize when project root changes
## Description
When the server starts, if the frontend opens the project at the wrong path (e.g. server/ subdirectory instead of project root), the filesystem watcher and auto-assign run against that wrong path. When the frontend corrects itself by calling DELETE /project then open_project with the right path, the watcher and auto-assign do not reinitialize. This means:
1. The filesystem watcher watches the wrong directory for the entire session
2. Auto-assign only runs once at startup (against the wrong root) and never re-runs
3. Stories placed in 2_current/ are never auto-assigned to coders
4. The archive sweep never fires (same watcher thread)
This is likely the root cause of bug 251 (archive sweep not working) and explains why coders are not being auto-assigned.
## How to Reproduce
1. Start the Story Kit server\n2. Open a project in the frontend — note the first open_project sets project_root to the wrong subdirectory\n3. Frontend corrects by calling DELETE /project then open_project with the correct path\n4. Move a story into 2_current/\n5. Observe that no coder is auto-assigned
## Actual Result
Watcher and auto-assign remain bound to the initial (wrong) project root. No filesystem events are detected for the correct project directory. Stories in 2_current/ are never picked up.
## Expected Result
When project_root changes via open_project, the watcher thread should be stopped and restarted against the new root, and auto_assign_available_work() should re-run.
## Acceptance Criteria
- [ ] When open_project is called with a new path, the filesystem watcher restarts watching the new project root
- [ ] auto_assign_available_work() re-runs after a project root change
- [ ] If DELETE /project is called, the watcher stops (no zombie watcher on a stale path)
- [ ] Stories in 2_current/ are auto-assigned after the project root is corrected

View File

@@ -0,0 +1,23 @@
---
name: "Add refactor work item type"
merge_failure: "merge_agent_work tool returned empty output on two attempts. The merge-queue branch (merge-queue/254_story_add_refactor_work_item_type) was created with squash merge commit 27d24b2, and the merge workspace worktree exists at .story_kit/merge_workspace, but the pipeline never completed (no success/failure logged after MERGE-DEBUG calls). The stale merge workspace worktree may be blocking completion. Possibly related to bug 250 (merge pipeline cherry-pick fails with bad revision on merge-queue branch). Human intervention needed to: 1) clean up the merge-queue worktree and branch, 2) investigate why the merge pipeline hangs after creating the squash merge commit, 3) retry the merge."
---
# Story 254: Add refactor work item type
## User Story
As a project owner, I want a refactor work item type so that I can track and assign code restructuring tasks separately from features and bugs.
## Acceptance Criteria
- [ ] create_refactor MCP tool creates a refactor file in work/1_upcoming/ with deterministic filename (e.g. 254_refactor_split_agents_rs.md)
- [ ] Refactor files use the naming convention {id}_refactor_{slug}.md
- [ ] Refactor items flow through the same pipeline as stories and bugs (upcoming → current → qa → merge → done → archived)
- [ ] list_refactors MCP tool lists open refactors in upcoming
- [ ] Frontend displays refactor items distinctly from stories and bugs (different label/color)
- [ ] Watcher recognizes refactor files and auto-commits moves like stories and bugs
## Out of Scope
- TBD

View File

@@ -0,0 +1,16 @@
---
name: "Show agent logs in expanded story popup"
merge_failure: "merge_agent_work tool returned empty output. The merge pipeline created the merge-queue branch (merge-queue/255_story_show_agent_logs_in_expanded_story_popup) and merge workspace worktree at .story_kit/merge_workspace, but hung without completing. This is the same issue that affected story 254 — likely related to bug 250 (merge pipeline cherry-pick fails with bad revision on merge-queue branch). The stale merge workspace worktree on the merge-queue branch may be blocking completion. Human intervention needed to: 1) clean up the merge workspace worktree and merge-queue branch, 2) investigate the root cause in the merge pipeline (possibly the cherry-pick/fast-forward step after squash merge), 3) retry the merge."
---
# Story 255: Show agent logs in expanded story popup
## Description
The expanded story popup has an "Agent Logs" tab that currently shows "No output". Implement the frontend and any necessary API wiring to display agent output in this tab. This is new functionality — agent logs have never been shown here before.
## Acceptance Criteria
- [ ] Agent Logs tab shows real-time output from running agents
- [ ] Agent Logs tab shows historical output from completed/failed agents
- [ ] Logs are associated with the correct story

View File

@@ -0,0 +1,34 @@
---
name: "Bot must verify other users' cross-signing identity before checking device verification"
agent: mergemaster
---
# Story 256: Bot must verify other users' cross-signing identity before checking device verification
## User Story
As a Matrix user messaging the bot, I want the bot to correctly recognize my cross-signing-verified devices, so that my messages are not rejected when I have a valid verified identity.
## Acceptance Criteria
- [ ] The bot's `check_sender_verified` function (or equivalent) verifies the sender's identity trust status, not just individual device verification
- [ ] When @yossarian:crashlabs.io (who has valid cross-signing keys) sends a message in an encrypted room, the bot accepts it instead of rejecting with 'no cross-signing-verified device found'
- [ ] The bot still rejects messages from users who genuinely have no cross-signing setup
- [ ] Existing tests (if any) continue to pass after the change
## Out of Scope
- TBD
## Test Results
<!-- story-kit-test-results: {"unit":[{"name":"sender_with_cross_signing_identity_is_accepted","status":"pass","details":"Verifies get_user_identity Some(_) → accepted"},{"name":"sender_without_cross_signing_identity_is_rejected","status":"pass","details":"Verifies get_user_identity None → rejected"}],"integration":[]} -->
### Unit Tests (2 passed, 0 failed)
- ✅ sender_with_cross_signing_identity_is_accepted — Verifies get_user_identity Some(_) → accepted
- ✅ sender_without_cross_signing_identity_is_rejected — Verifies get_user_identity None → rejected
### Integration Tests (0 passed, 0 failed)
*No integration tests recorded.*

View File

@@ -0,0 +1,15 @@
---
name: "Rename StorkIt to Story Kit in the header"
---
# Story 257: Rename "StorkIt" to "Story Kit" in the header
## Description
The ChatHeader component displays "StorkIt" as the app title. It should say "Story Kit" instead.
## Acceptance Criteria
- [ ] The header in `ChatHeader.tsx` displays "Story Kit" instead of "StorkIt"
- [ ] The test in `ChatHeader.test.tsx` is updated to match
- [ ] All existing tests pass

View File

@@ -0,0 +1,26 @@
---
name: "Auto-assign not called after merge failure"
---
# Bug 258: Auto-assign not called after merge failure
## Description
When the background merge pipeline fails (e.g. quality gate timeout), `auto_assign_available_work` is never called. The story stays in `4_merge/` with no agent assigned, requiring manual intervention.
### Root cause
In `pool.rs`, `start_merge_agent_work` spawns a tokio task that calls `run_merge_pipeline`. On failure, the task updates the job status to `Failed` but does NOT call `auto_assign_available_work`. The only call to `auto_assign` in the merge pipeline is inside `run_merge_pipeline` on the success path (line ~1251).
The `spawn_pipeline_advance` completion handler does call `auto_assign` after the mergemaster agent exits, but only on the success path (post-merge tests pass → move to done → auto_assign). On failure, it returns early without triggering auto-assign.
There is no periodic sweep — auto-assign is purely reactive (watcher events, agent completions, startup).
### Impact
After a merge failure, the story is permanently stuck in `4_merge/` with no agent. The only way to unstick it is to restart the server or manually trigger a watcher event.
## Acceptance Criteria
- [ ] After a merge pipeline failure, `auto_assign_available_work` is called so the mergemaster can retry
- [ ] Stories in `4_merge/` do not get permanently stuck after transient merge failures

View File

@@ -0,0 +1,20 @@
---
name: "Move story-kit ignores into .story_kit/.gitignore"
---
# Story 259: Move story-kit ignores into .story_kit/.gitignore
## User Story
As a developer using story-kit, I want story-kit-specific gitignore patterns to live inside .story_kit/.gitignore, so that the host project's root .gitignore stays clean and story-kit concerns are self-contained.
## Acceptance Criteria
- [ ] A .gitignore file exists at .story_kit/.gitignore containing all story-kit-specific ignore patterns
- [ ] The root .gitignore no longer contains story-kit-specific ignore patterns
- [ ] The deterministic project scaffold process creates .story_kit/.gitignore when initialising a new project
- [ ] Existing repos continue to work correctly after the change (no previously-ignored files become tracked)
## Out of Scope
- TBD

View File

@@ -0,0 +1,19 @@
---
name: "Bot notifications when stories move between stages"
agent: coder-opus
---
# Story 261: Bot notifications when stories move between stages
## User Story
As a user, I want to receive bot notifications in the channel whenever a story moves between pipeline stages, so that I can track progress without manually checking status.
## Acceptance Criteria
- [ ] Bot sends a notification to the channel each time a story transitions between stages (e.g. upcoming → current, current → QA, QA → merge, merge → done)
- [ ] Notification includes the story number, name, and the stage transition (from → to)
## Out of Scope
- TBD

View File

@@ -0,0 +1,24 @@
---
name: "Bot error notifications for story failures (with shared messaging)"
---
# Story 262: Bot error notifications for story failures
## User Story
As a user, I want to receive bot notifications with an error icon in the channel whenever a story errors out (e.g. merge failure), so that I'm immediately aware of problems.
## Design Constraint
Story 261 adds stage-transition notifications using the same Matrix messaging path. Extract a shared utility/module for sending Matrix messages so that both error notifications (this story) and stage-transition notifications (261) use the same code path. Do not duplicate Matrix message-sending logic.
## Acceptance Criteria
- [ ] Bot sends an error notification to the channel when a story encounters a failure (e.g. merge failure)
- [ ] Notification includes an error icon to distinguish it from normal stage-transition notifications
- [ ] Notification includes the story number, name, and a description of the error
- [ ] Matrix message-sending logic is in a shared module usable by both error and stage-transition notifications
## Out of Scope
- Stage-transition notifications (covered by story 261)

View File

@@ -0,0 +1,21 @@
---
name: "Matrix bot self-signs device keys at startup for verified encryption"
agent: mergemaster
---
# Story 263: Matrix bot self-signs device keys at startup for verified encryption
## User Story
As a Matrix room participant, I want the bot's messages to not show "encrypted by a device not verified by its owner" warnings, so that I have confidence the bot's encryption is fully verified.
## Acceptance Criteria
- [ ] At startup the bot checks whether its own device keys have been self-signed (cross-signed by its own user identity)
- [ ] If the device keys are not self-signed, the bot signs them automatically
- [ ] After signing, the bot uploads the new signatures to the homeserver
- [ ] After a clean start (fresh matrix_store / device_id) the bot's messages no longer show the 'encrypted by a device not verified by its owner' warning
## Out of Scope
- TBD

View File

@@ -0,0 +1,43 @@
---
name: "Claude Code session ID not persisted across browser refresh"
---
# Bug 264: Claude Code session ID not persisted across browser refresh
## Description
The Claude Code provider uses a session_id to resume conversations via `--resume <id>`. This session_id is stored in React state (`claudeSessionId`) but is NOT persisted to localStorage. After a browser refresh, the session_id is lost (`null`), so Claude Code cannot resume the prior session.
A fallback exists (`build_claude_code_context_prompt` in `server/src/llm/chat.rs:188`) that injects prior messages as flattened text inside a `<conversation_history>` block, but this loses structure (tool calls, tool results, reasoning) and Claude Code treats it as informational text rather than actual conversation turns. In practice, the LLM does not retain meaningful context after refresh.
This is the root cause behind bug 245 (chat history persistence regression). The localStorage message persistence from story 145 works correctly for the UI, but the LLM context is not properly restored because the session cannot be resumed.
Key files:
- `frontend/src/components/Chat.tsx:174``claudeSessionId` is ephemeral React state
- `frontend/src/components/Chat.tsx:553` — session_id only sent when non-null
- `server/src/llm/chat.rs:278` — backend branches on session_id presence
- `server/src/llm/providers/claude_code.rs:44``--resume` flag passed to Claude CLI
## How to Reproduce
1. Open the Story Kit web UI and select claude-code-pty as the model
2. Have a multi-turn conversation with the agent
3. Refresh the browser (F5 or Cmd+R)
4. Send a new message referencing the prior conversation
5. The LLM has no knowledge of the prior conversation
## Actual Result
After refresh, claudeSessionId is null. Claude Code spawns a fresh session without --resume. The fallback text injection is too lossy to provide meaningful context. The LLM behaves as if the conversation never happened.
## Expected Result
After refresh, the Claude Code session is resumed via --resume, giving the LLM full context of the prior conversation including tool calls, reasoning, and all turns.
## Acceptance Criteria
- [ ] claudeSessionId is persisted to localStorage (scoped by project path) and restored on component mount
- [ ] After browser refresh, the next chat message includes session_id in the ProviderConfig
- [ ] Claude Code receives --resume with the persisted session_id after refresh
- [ ] Clearing the session (clear button) also clears the persisted session_id
- [ ] After server restart with session files intact on disk, conversation resumes correctly

View File

@@ -0,0 +1,33 @@
---
name: "Spikes skip merge and stop for human review"
agent: coder-opus
---
# Story 265: Spikes skip merge and stop for human review
## User Story
As a user, I want spike work items to stop after QA instead of auto-advancing to the merge stage, so that I can review the spike's findings and prototype code in the worktree before deciding what to do with them.
## Context
Spikes are investigative — their value is the findings and any prototype code, not a merge to master. The user needs to:
- Read the spike document with findings
- Review prototype code in the worktree
- Optionally build and run the prototype to validate the approach
- Then manually decide: archive the spike and create follow-up stories, or reject and re-investigate
Currently all work items follow the same pipeline: coder → QA → merge → done. Spikes should diverge after QA and wait for human review instead of auto-advancing to merge.
## Acceptance Criteria
- [ ] Items with `_spike_` in the filename skip the merge stage after QA passes
- [ ] After QA, spike items remain accessible for human review (worktree preserved, not cleaned up)
- [ ] Spikes do not auto-advance to `4_merge/` — they stay in `3_qa/` or move to a review-hold state
- [ ] The human can manually archive the spike when done reviewing
- [ ] Non-spike items (stories, bugs, refactors) continue through the full pipeline as before
## Out of Scope
- New UI for spike review (manual file inspection is fine)
- Changes to the spike creation flow

View File

@@ -0,0 +1,60 @@
---
name: "Matrix bot structured conversation history"
agent: coder-opus
---
# Story 266: Matrix bot structured conversation history
## User Story
As a user chatting with the Matrix bot, I want it to remember and own its prior responses naturally, so that conversations feel like talking to one continuous entity rather than a new instance each message.
## Acceptance Criteria
- [ ] Conversation history is passed as structured API messages (user/assistant turns) rather than a flattened text prefix
- [ ] Claude recognises its prior responses as its own, maintaining consistent personality across a conversation
- [ ] Per-room history survives server restarts (persisted to disk or database)
- [ ] Rolling window trimming still applies to keep context bounded
- [ ] Multi-user rooms still attribute messages to the correct sender
## Investigation Notes (2026-03-18)
The current implementation attempts session resumption via `--resume <session_id>` but it's not working:
### Code path: how session resumption is supposed to work
1. `server/src/matrix/bot.rs:671-676``handle_message()` reads `conv.session_id` from the per-room `RoomConversation` to get the resume ID.
2. `server/src/matrix/bot.rs:717` — passes `resume_session_id` to `provider.chat_stream()`.
3. `server/src/llm/providers/claude_code.rs:57``chat_stream()` stores it as `resume_id`.
4. `server/src/llm/providers/claude_code.rs:170-173` — if `resume_session_id` is `Some`, appends `--resume <id>` to the `claude -p` command.
5. `server/src/llm/providers/claude_code.rs:348``process_json_event()` looks for `json["session_id"]` in each streamed NDJSON event and sends it via a oneshot channel (`sid_tx`).
6. `server/src/llm/providers/claude_code.rs:122` — after the PTY exits, `sid_rx.await.ok()` captures the session ID (or `None` if never sent).
7. `server/src/matrix/bot.rs:785-787` — stores `new_session_id` back into `conv.session_id` and persists via `save_history()`.
### What's broken
- **No session_id captured:** `.story_kit/matrix_history.json` contains conversation entries but no `session_id`. `RoomConversation.session_id` is always `None`.
- **Root cause:** `claude -p --output-format stream-json` may not emit a `session_id` in its NDJSON events, or the parser at step 5 isn't matching the actual event shape. The oneshot channel never fires.
- **Effect:** Every message spawns a fresh Claude Code process with no `--resume` flag. Each turn is a blank slate.
- **History persistence works fine** — serialization round-trips correctly (test at `bot.rs:1335-1339`). The problem is purely that `--resume` is never invoked.
### Debugging steps
1. Run `claude -p "hello" --output-format stream-json --verbose 2>/dev/null` manually and inspect the NDJSON for a `session_id` field. Check what event type carries it and whether the key name matches what `process_json_event()` expects.
2. If `session_id` is present but nested differently (e.g. inside an `event` wrapper), fix the JSON path at `claude_code.rs:348`.
3. If `-p` mode doesn't emit `session_id` at all, consider an alternative: pass conversation history as a structured prompt prefix, or switch to the Claude API directly.
### Previous attempt failed (2026-03-18)
A sonnet coder attempted this story but did NOT fix the root cause. It rewrote the `chat_stream()` call in `bot.rs` to look identical to what was already there — it never investigated why `session_id` isn't being captured. The merge auto-resolver then jammed the duplicate call inside the `tokio::select!` permission loop, producing mismatched braces. The broken merge was reverted.
**What the coder must actually do:**
1. **Do NOT rewrite the `chat_stream()` call or the `tokio::select!` loop in `bot.rs`.** That code is correct and handles permission forwarding (story 275). Do not touch it.
2. **The bug is in `claude_code.rs`, not `bot.rs`.** The `process_json_event()` function at line ~348 looks for `json["session_id"]` but it's likely never finding it. Start by running step 1 above to see what the actual NDJSON output looks like.
3. **If `claude -p` doesn't emit `session_id` at all**, the `--resume` approach won't work. In that case, the fix is to pass conversation history as a prompt prefix (prepend prior turns to the user message) or use `--continue` instead of `--resume`, or call the Claude API directly instead of shelling out to the CLI.
4. **Rebase onto current master before starting.** Master has changed significantly (spike 92, story 275 permission handling, gitignore changes).
## Out of Scope
- TBD

View File

@@ -0,0 +1,19 @@
---
name: "MCP update_story tool should support front matter fields"
---
# Story 267: MCP update_story tool should support front matter fields
## User Story
As an operator using the MCP tools, I want update_story to accept optional front matter fields (like agent, manual_qa, etc.) so that I can update story metadata without editing files by hand.
## Acceptance Criteria
- [ ] update_story MCP tool accepts optional agent parameter to set/change the agent front matter field
- [ ] update_story MCP tool accepts optional arbitrary front matter key-value pairs
- [ ] Front matter updates are auto-committed via the filesystem watcher like other story mutations
## Out of Scope
- TBD

View File

@@ -0,0 +1,23 @@
---
name: "Upgrade tokio-tungstenite to 0.29.0"
---
# Refactor 268: Upgrade tokio-tungstenite to 0.29.0
## Current State
- TBD
## Desired State
Upgrade tokio-tungstenite from 0.28.0 to 0.29.0 in workspace Cargo.toml and fix any breaking API changes.
## Acceptance Criteria
- [ ] tokio-tungstenite = "0.29.0" in workspace Cargo.toml
- [ ] All code compiles without errors
- [ ] All tests pass
## Out of Scope
- TBD

View File

@@ -0,0 +1,22 @@
---
name: "@ file references in web UI chat input"
---
# Story 269: @ file references in web UI chat input
## User Story
As a user chatting in the web UI, I want to type @ to get an autocomplete overlay listing project files, so that I can reference specific files in my messages the same way Zed and Claude Code do.
## Acceptance Criteria
- [ ] Typing @ in the chat input triggers a file picker overlay
- [ ] Overlay searches project files with fuzzy matching as the user types after @
- [ ] Selecting a file inserts a reference into the message (e.g. @path/to/file.rs)
- [ ] The referenced file contents are included as context when the message is sent to the LLM
- [ ] Overlay is dismissable with Escape
- [ ] Multiple @ references can be used in a single message
## Out of Scope
- TBD

View File

@@ -0,0 +1,31 @@
---
name: "QA test server overwrites root .mcp.json with wrong port"
---
# Bug 270: QA test server overwrites root .mcp.json with wrong port
## Description
When the QA agent starts a test server in a worktree (e.g. on port 3012), that server auto-detects the shared project root and calls open_project, which writes .mcp.json with the test server's port. This clobbers the root .mcp.json that should always point to the main server (port 3001).
Root cause: open_project in server/src/io/fs.rs:527 unconditionally calls write_mcp_json(&p, port) with its own port. Because worktrees share .story_kit/ with the real project, the test server resolves to the real project root and overwrites the root .mcp.json instead of writing to its own worktree directory.
Fix: Remove the write_mcp_json call from open_project entirely. Worktree .mcp.json files are already written correctly during worktree creation (worktree.rs:81,97), and the root .mcp.json is committed in git. open_project should not touch it.
## How to Reproduce
1. QA agent starts on a story\n2. QA agent starts a test server in the worktree on a non-default port (e.g. 3012)\n3. Test server auto-opens the project root\n4. Root .mcp.json is overwritten with test port
## Actual Result
Root .mcp.json contains the QA test server's port (e.g. 3012) instead of the main server's port (3001). Interactive Claude sessions lose MCP connectivity.
## Expected Result
Root .mcp.json always points to the primary server's port. Test servers started by QA agents should not overwrite it.
## Acceptance Criteria
- [ ] QA test servers do not overwrite root .mcp.json
- [ ] Root .mcp.json always reflects the primary server's port
- [ ] Worktree .mcp.json files are only written during worktree creation

View File

@@ -0,0 +1,19 @@
---
name: "Show assigned agent in expanded work item view"
---
# Story 271: Show assigned agent in expanded work item view
## User Story
As a project owner viewing an expanded work item in the web UI, I want to see which agent (e.g. coder-opus) has been assigned via front matter, so that I know which coder is working on or will pick up the story.
## Acceptance Criteria
- [ ] Expanded work item view displays the agent front matter field if set
- [ ] Shows the specific agent name (e.g. 'coder-opus') not just 'assigned'
- [ ] If no agent is set in front matter, the field is omitted or shows unassigned
## Out of Scope
- TBD

View File

@@ -0,0 +1,19 @@
---
name: "Clear merge error front matter when story leaves merge stage"
---
# Story 272: Clear merge error front matter when story leaves merge stage
## User Story
As an operator, I want merge error front matter to be automatically removed when a story is moved out of the merge stage via MCP, so that stale error metadata doesn't persist when the story is retried.
## Acceptance Criteria
- [ ] When a story with merge_error front matter is moved out of 4_merge via MCP, the merge_error field is automatically stripped
- [ ] Works for all destinations: back to 2_current, back to 1_upcoming, or forward to 5_done
- [ ] Stories without merge_error front matter are unaffected
## Out of Scope
- TBD

View File

@@ -0,0 +1,20 @@
---
name: "MCP pipeline status tool with agent assignments"
---
# Story 274: MCP pipeline status tool with agent assignments
## User Story
As a user checking pipeline status, I want an MCP tool that returns a structured status report including which agent is assigned to each work item, so that I can quickly see what's active and spot stuck items.
## Acceptance Criteria
- [ ] New MCP tool (e.g. `get_pipeline_status`) returns all work items across all active pipeline stages (current, qa, merge, done) with their stage, name, and assigned agent
- [ ] Upcoming backlog items are included with count or listing
- [ ] Agent assignment info comes from story front matter (`agent` field) and/or the running agent list
- [ ] Response is structured/deterministic (not free-form prose)
## Out of Scope
- TBD

View File

@@ -0,0 +1,22 @@
---
name: "Matrix bot surfaces Claude Code permission prompts to chat"
agent: coder-opus
---
# Story 275: Matrix bot surfaces Claude Code permission prompts to chat
## User Story
As a user chatting with the Matrix bot, I want to see permission prompts from Claude Code in the chat and be able to approve or deny them, so that headless Claude Code sessions don't silently hang when they need authorization to proceed.
## Acceptance Criteria
- [ ] When Claude Code hits a permission prompt during a bot-initiated session, the bot sends the prompt text to the Matrix room as a message
- [ ] The user can approve or deny the permission by replying in chat (e.g. yes/no or a reaction)
- [ ] The bot relays the user decision back to the Claude Code subprocess so execution continues
- [ ] If the user does not respond within a configurable timeout, the permission is denied (fail-closed)
- [ ] The bot does not hang or timeout silently when a permission prompt is pending - the user always sees what is happening
## Out of Scope
- TBD

View File

@@ -0,0 +1,17 @@
---
name: "Detect and log when root .mcp.json port is modified"
---
# Story 276: Detect and log when root .mcp.json port is modified
## User Story
As a ..., I want ..., so that ...
## Acceptance Criteria
- [ ] TODO
## Out of Scope
- TBD

View File

@@ -0,0 +1,19 @@
---
name: "Matrix bot uses its configured name instead of \"Claude\""
---
# Story 277: Matrix bot uses its configured name instead of "Claude"
## User Story
As a Matrix user, I want the bot to identify itself by its configured name (e.g., "Timmy") rather than "Claude", so that the bot feels like a distinct personality in the chat.
## Acceptance Criteria
- [ ] The Matrix bot refers to itself by its configured display name (e.g., 'Timmy') in conversations, not 'Claude'
- [ ] The bot's self-referencing name is derived from configuration, not hardcoded
- [ ] If no custom name is configured, the bot falls back to a sensible default
## Out of Scope
- TBD

View File

@@ -0,0 +1,17 @@
---
name: "Auto-assign agents to pipeline items on server startup"
---
# Story 278: Auto-assign agents to pipeline items on server startup
## User Story
As a ..., I want ..., so that ...
## Acceptance Criteria
- [ ] TODO
## Out of Scope
- TBD

View File

@@ -0,0 +1,20 @@
---
name: "Auto-assign should respect agent stage when front matter specifies agent"
---
# Story 279: Auto-assign should respect agent stage when front matter specifies agent
## User Story
As a project operator, I want auto-assign to respect the pipeline stage when a story's front matter specifies a preferred agent, so that a coder agent isn't assigned to do QA work just because the story originally requested that coder.
## Acceptance Criteria
- [ ] When a story in `3_qa/` has `agent: coder-opus` in front matter, auto-assign skips the preferred agent (stage mismatch) and assigns a free QA-stage agent instead
- [ ] When a story in `2_current/` has `agent: coder-opus` in front matter, auto-assign still respects the preference (stage matches)
- [ ] When the preferred agent's stage mismatches, auto-assign logs a message indicating the stage mismatch and fallback
## Out of Scope
- Changing the front matter `agent` field automatically when a story advances stages
- Adding per-stage agent preferences to front matter

View File

@@ -0,0 +1,20 @@
---
name: "Matrix bot announces itself when it comes online"
---
# Story 281: Matrix bot announces itself when it comes online
## User Story
As a user in the Matrix room, I want Timmy to post a message when he starts up, so that I know the bot is online and ready to accept commands.
## Acceptance Criteria
- [ ] Bot sends a brief greeting message to each configured room on startup (e.g. 'Timmy is online.')
- [ ] Message uses the configured display_name, not a hardcoded name
- [ ] Message is only sent once per startup, not on reconnects or sync resumptions
- [ ] Bot does not announce if it was already running (e.g. after a brief network blip)
## Out of Scope
- TBD

View File

@@ -0,0 +1,119 @@
---
name: "Stop auto-committing intermediate pipeline moves"
agent: "coder-opus"
review_hold: true
---
# Spike 92: Stop auto-committing intermediate pipeline moves
## Goal
Determine how to stop the filesystem watcher from auto-committing every pipeline stage move (upcoming -> current -> qa -> merge -> done -> archive) while still committing at terminal states (creation in upcoming, acceptance in done and archived). This keeps git history clean while preserving cross-machine portability for completed work.
## Context
The watcher in `server/src/io/watcher.rs` currently auto-commits every file change in `.story_kit/work/`. A single story run generates 5+ commits just from pipeline moves:
- `story-kit: create 42_story_foo`
- `story-kit: start 42_story_foo`
- `story-kit: queue 42_story_foo for QA`
- `story-kit: queue 42_story_foo for merge`
- `story-kit: accept 42_story_foo`
Since story runs complete relatively quickly, the intermediate state (current/qa/merge) is transient and doesn't need to be committed. Only creation and archival are meaningful checkpoints.
## Questions to Answer
1. Can we filter `stage_metadata()` to only commit for `1_upcoming` and `6_archived` stages while still broadcasting `WatcherEvent`s for all stages (so the frontend stays in sync)?
2. Should we keep `git add -A .story_kit/work/` for the committed stages, or narrow it to only the specific file?
3. What happens if the server crashes mid-pipeline? Uncommitted moves are lost — is this acceptable given the story can just be re-run?
4. Should intermediate moves be `.gitignore`d at the directory level, or is filtering in the watcher sufficient?
5. Do any other parts of the system (agent worktree setup, merge_agent_work, sparse checkout) depend on intermediate pipeline files being committed to master?
## Findings
### Q1: Can we filter to only commit terminal stages?
**Yes.** The fix is in `flush_pending()`, not `stage_metadata()`. We add a `should_commit_stage()` predicate that returns `true` only for `1_upcoming` and `6_archived`. The event broadcast path is decoupled from the commit path — `flush_pending()` always broadcasts a `WatcherEvent` regardless of whether it commits.
Prototype implemented: added `COMMIT_WORTHY_STAGES` constant and `should_commit_stage()` function. The change is ~15 lines including the constant, predicate, and conditional in `flush_pending()`.
### Q2: Keep `git add -A .story_kit/work/` or narrow to specific file?
**Keep `git add -A .story_kit/work/`.** When committing a terminal stage (e.g. `6_archived`), the file has been moved from a previous stage (e.g. `5_done`). Using `-A` on the whole work directory captures both the addition in the new stage and the deletion from the old stage in a single commit. Narrowing to the specific file would miss the deletion side of the move.
### Q3: Server crash mid-pipeline — acceptable?
**Yes.** If the server crashes while a story is in `2_current`, `3_qa`, or `4_merge`, the file is lost from git but:
- The story file still exists on the filesystem (it's just not committed)
- The agent's work is in its own feature branch/worktree (independent of pipeline file state)
- The story can be re-queued from `1_upcoming` which IS committed
- Pipeline state is transient by nature — it reflects "what's happening right now", not permanent record
### Q4: `.gitignore` vs watcher filtering?
**Watcher filtering is sufficient.** `.gitignore` approach (Option C) has downsides:
- `git status` won't show pipeline state, making debugging harder
- If you ever need to commit an intermediate state (e.g. for a new feature), you'd have to fight `.gitignore`
- Watcher filtering is explicit and easy to understand — a constant lists the commit-worthy stages
- No risk of accidentally ignoring files that should be tracked
### Q5: Dependencies on intermediate pipeline commits?
**None found.** Thorough investigation confirmed:
1. **`merge_agent_work`** (`agents/merge.rs`): Creates a temporary `merge-queue/` branch and worktree. Reads the feature branch, not pipeline files. After merge, calls `move_story_to_archived()` which is a filesystem operation.
2. **Agent worktree setup** (`worktree.rs`): Creates worktrees from feature branches. Sparse checkout is a no-op (disabled). Does not read pipeline file state from git.
3. **MCP tool handlers** (`agents/lifecycle.rs`): `move_story_to_current()`, `move_story_to_merge()`, `move_story_to_qa()`, `move_story_to_archived()` — all pure filesystem `fs::rename()` operations. None perform git commits.
4. **Frontend** (`http/workflow.rs`): `load_pipeline_state()` reads directories from the filesystem directly via `fs::read_dir()`. Never calls git. WebSocket events keep the frontend in sync.
5. **No git inspection commands** reference pipeline stage directories anywhere in the codebase.
### Edge Cases
- **Multi-machine sync:** Only `1_upcoming` and `6_archived` are committed. If you push/pull, you'll see story creation and archival but not intermediate pipeline state. This is correct — intermediate state is machine-local runtime state.
- **Manual git operations:** `git status` will show uncommitted files in intermediate stages. This is actually helpful for debugging — you can see what's in the pipeline without grepping git log.
- **Sweep (5_done → 6_archived):** The sweep moves files to `6_archived`, which triggers a watcher event that WILL commit (since `6_archived` is a terminal stage). This naturally captures the final state.
## Approach to Investigate
### Option A: Filter in `flush_pending()` ← **RECOMMENDED**
- In `flush_pending()`, still broadcast the `WatcherEvent` for all stages
- Only call `git_add_work_and_commit()` for stages `1_upcoming` and `6_archived`
- Simplest change — ~15 lines modified in `watcher.rs`
### Option B: Two-tier watcher
- Split into "commit-worthy" events (create, archive) and "notify-only" events (start, qa, merge)
- Commit-worthy events go through git
- Notify-only events just broadcast to WebSocket clients
- More explicit but same end result as Option A
### Option C: .gitignore intermediate directories
- Add `2_current/`, `3_qa/`, `4_merge/` to `.gitignore`
- Watcher still sees events (gitignore doesn't affect filesystem watching)
- Git naturally ignores them
- Risk: harder to debug, `git status` won't show pipeline state
## Recommendation
**Option A is viable and implemented.** The prototype is in `server/src/io/watcher.rs`:
- Added `COMMIT_WORTHY_STAGES` constant: `["1_upcoming", "6_archived"]`
- Added `should_commit_stage()` predicate
- Modified `flush_pending()` to conditionally commit based on stage, while always broadcasting events
- All 872 tests pass, clippy clean
A full story run will now produce only 2 pipeline commits instead of 5+:
- `story-kit: create 42_story_foo` (creation in `1_upcoming`)
- `story-kit: accept 42_story_foo` (archival in `6_archived`)
The intermediate moves (`start`, `queue for QA`, `queue for merge`, `done`) are still broadcast to WebSocket clients for real-time frontend updates, but no longer clutter git history.
## Acceptance Criteria
- [x] Spike document updated with findings and recommendation
- [x] If Option A is viable: prototype the change and verify git log is clean during a full story run
- [x] Confirm frontend still receives real-time pipeline updates for all stages
- [x] Confirm no other system depends on intermediate pipeline commits being on master
- [x] Identify any edge cases (server crash, manual git operations, multi-machine sync)

37
Cargo.lock generated
View File

@@ -1952,6 +1952,7 @@ version = "0.35.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "133c182a6a2c87864fe97778797e46c7e999672690dc9fa3ee8e241aa4a9c13f"
dependencies = [
"cc",
"pkg-config",
"vcpkg",
]
@@ -3996,7 +3997,7 @@ checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
[[package]]
name = "story-kit"
version = "0.1.0"
version = "0.3.1"
dependencies = [
"async-stream",
"async-trait",
@@ -4007,6 +4008,7 @@ dependencies = [
"futures",
"homedir",
"ignore",
"libsqlite3-sys",
"matrix-sdk",
"mime_guess",
"mockito",
@@ -4023,9 +4025,10 @@ dependencies = [
"strip-ansi-escapes",
"tempfile",
"tokio",
"tokio-tungstenite 0.28.0",
"toml 1.0.3+spec-1.1.0",
"tokio-tungstenite 0.29.0",
"toml 1.0.6+spec-1.1.0",
"uuid",
"wait-timeout",
"walkdir",
]
@@ -4330,14 +4333,14 @@ dependencies = [
[[package]]
name = "tokio-tungstenite"
version = "0.28.0"
version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d25a406cddcc431a75d3d9afc6a7c0f7428d4891dd973e4d54c56b46127bf857"
checksum = "8f72a05e828585856dacd553fba484c242c46e391fb0e58917c942ee9202915c"
dependencies = [
"futures-util",
"log",
"tokio",
"tungstenite 0.28.0",
"tungstenite 0.29.0",
]
[[package]]
@@ -4369,9 +4372,9 @@ dependencies = [
[[package]]
name = "toml"
version = "1.0.3+spec-1.1.0"
version = "1.0.6+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7614eaf19ad818347db24addfa201729cf2a9b6fdfd9eb0ab870fcacc606c0c"
checksum = "399b1124a3c9e16766831c6bba21e50192572cdd98706ea114f9502509686ffc"
dependencies = [
"indexmap",
"serde_core",
@@ -4559,9 +4562,9 @@ dependencies = [
[[package]]
name = "tungstenite"
version = "0.28.0"
version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8628dcc84e5a09eb3d8423d6cb682965dea9133204e8fb3efee74c2a0c259442"
checksum = "6c01152af293afb9c7c2a57e4b559c5620b421f6d133261c60dd2d0cdb38e6b8"
dependencies = [
"bytes 1.11.1",
"data-encoding",
@@ -4571,7 +4574,6 @@ dependencies = [
"rand 0.9.2",
"sha1",
"thiserror 2.0.18",
"utf-8",
]
[[package]]
@@ -4702,9 +4704,9 @@ checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
[[package]]
name = "uuid"
version = "1.21.0"
version = "1.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b672338555252d43fd2240c714dc444b8c6fb0a5c5335e65a07bba7742735ddb"
checksum = "a68d3c8f01c0cfa54a75291d83601161799e4a89a39e0929f4b0354d88757a37"
dependencies = [
"getrandom 0.4.1",
"js-sys",
@@ -4769,6 +4771,15 @@ dependencies = [
"memchr",
]
[[package]]
name = "wait-timeout"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11"
dependencies = [
"libc",
]
[[package]]
name = "walkdir"
version = "2.5.0"

View File

@@ -24,9 +24,9 @@ serde_yaml = "0.9"
strip-ansi-escapes = "0.2"
tempfile = "3"
tokio = { version = "1", features = ["rt-multi-thread", "macros", "sync"] }
toml = "1.0.3"
uuid = { version = "1.21.0", features = ["v4", "serde"] }
tokio-tungstenite = "0.28.0"
toml = "1.0.6"
uuid = { version = "1.22.0", features = ["v4", "serde"] }
tokio-tungstenite = "0.29.0"
walkdir = "2.5.0"
filetime = "0.2"
matrix-sdk = { version = "0.16.0", default-features = false, features = [
@@ -37,6 +37,3 @@ matrix-sdk = { version = "0.16.0", default-features = false, features = [
pulldown-cmark = { version = "0.13.1", default-features = false, features = [
"html",
] }
# Force bundled SQLite so static musl builds don't need a system libsqlite3
libsqlite3-sys = { version = "*", features = ["bundled"] }

View File

@@ -8,7 +8,7 @@ help:
@echo " make release V=x.y.z Build both targets and publish a Gitea release"
@echo ""
@echo "Prerequisites:"
@echo " build-macos: Rust stable toolchain, pnpm"
@echo " build-macos: Rust stable toolchain, npm"
@echo " build-linux: cargo install cross AND Docker Desktop running"
@echo ""
@echo "Output:"
@@ -16,7 +16,7 @@ help:
@echo " Linux : target/x86_64-unknown-linux-musl/release/story-kit"
## Build a native macOS release binary.
## The frontend is compiled by build.rs (pnpm build) and embedded via rust-embed.
## The frontend is compiled by build.rs (npm run build) and embedded via rust-embed.
## Verify dynamic deps afterwards: otool -L target/release/story-kit
build-macos:
cargo build --release

View File

@@ -10,10 +10,10 @@ You can also run the frontend and backend separately in development (Vite dev se
```bash
# Build the frontend
cd frontend
pnpm install
pnpm dev
npm install
npm run dev
# Run the server (serves embedded frontend/dist/)
# In another terminal - run the server (serves embedded frontend/dist/)
cargo run
```
@@ -35,7 +35,7 @@ Story Kit ships as a **single self-contained binary** with the React frontend em
### macOS
```bash
# Native build no extra tools required beyond Rust + pnpm
# Native build no extra tools required beyond Rust + npm
make build-macos
# Output: target/release/story-kit
@@ -109,10 +109,10 @@ The frontend uses **Vitest** for unit tests and **Playwright** for end-to-end te
cd frontend
# Run unit tests
pnpm test
npm test
# Run end-to-end tests
pnpm test:e2e
npm run test:e2e
```
### Backend Tests

File diff suppressed because it is too large Load Diff

View File

@@ -24,7 +24,7 @@
"@biomejs/biome": "^2.4.2",
"@playwright/test": "^1.47.2",
"@testing-library/jest-dom": "^6.0.0",
"@testing-library/react": "^14.0.0",
"@testing-library/react": "^16.0.0",
"@testing-library/user-event": "^14.4.3",
"@types/node": "^25.0.0",
"@types/react": "^19.1.8",

5673
frontend/pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -108,6 +108,14 @@ export const agentsApi = {
baseUrl,
);
},
getAgentOutput(storyId: string, agentName: string, baseUrl?: string) {
return requestJson<{ output: string }>(
`/agents/${encodeURIComponent(storyId)}/${encodeURIComponent(agentName)}/output`,
{},
baseUrl,
);
},
};
/**

View File

@@ -262,7 +262,7 @@ describe("ChatWebSocket", () => {
// Server pushes pipeline_state on fresh connection
const freshState = {
upcoming: [{ story_id: "1_story_test", name: "Test", error: null }],
backlog: [{ story_id: "1_story_test", name: "Test", error: null }],
current: [],
qa: [],
merge: [],

View File

@@ -13,7 +13,13 @@ export type WsRequest =
approved: boolean;
always_allow: boolean;
}
| { type: "ping" };
| { type: "ping" }
| {
type: "side_question";
question: string;
context_messages: Message[];
config: ProviderConfig;
};
export interface AgentAssignment {
agent_name: string;
@@ -30,7 +36,7 @@ export interface PipelineStageItem {
}
export interface PipelineState {
upcoming: PipelineStageItem[];
backlog: PipelineStageItem[];
current: PipelineStageItem[];
qa: PipelineStageItem[];
merge: PipelineStageItem[];
@@ -44,7 +50,7 @@ export type WsResponse =
| { type: "error"; message: string }
| {
type: "pipeline_state";
upcoming: PipelineStageItem[];
backlog: PipelineStageItem[];
current: PipelineStageItem[];
qa: PipelineStageItem[];
merge: PipelineStageItem[];
@@ -73,7 +79,11 @@ export type WsResponse =
/** Sent on connect when the project still needs onboarding (specs are placeholders). */
| { type: "onboarding_status"; needs_onboarding: boolean }
/** Streaming thinking token from an extended-thinking block, separate from regular text. */
| { type: "thinking_token"; content: string };
| { type: "thinking_token"; content: string }
/** Streaming token from a /btw side question response. */
| { type: "side_question_token"; content: string }
/** Final signal that the /btw side question has been fully answered. */
| { type: "side_question_done"; response: string };
export interface ProviderConfig {
provider: string;
@@ -105,6 +115,7 @@ export interface WorkItemContent {
content: string;
stage: string;
name: string | null;
agent: string | null;
}
export interface TestCaseResult {
@@ -267,6 +278,9 @@ export const api = {
getHomeDirectory(baseUrl?: string) {
return requestJson<string>("/io/fs/home", {}, baseUrl);
},
listProjectFiles(baseUrl?: string) {
return requestJson<string[]>("/io/fs/files", {}, baseUrl);
},
searchFiles(query: string, baseUrl?: string) {
return requestJson<SearchResult[]>(
"/fs/search",
@@ -324,6 +338,8 @@ export class ChatWebSocket {
private onAgentConfigChanged?: () => void;
private onAgentStateChanged?: () => void;
private onOnboardingStatus?: (needsOnboarding: boolean) => void;
private onSideQuestionToken?: (content: string) => void;
private onSideQuestionDone?: (response: string) => void;
private connected = false;
private closeTimer?: number;
private wsPath = DEFAULT_WS_PATH;
@@ -382,7 +398,7 @@ export class ChatWebSocket {
if (data.type === "error") this.onError?.(data.message);
if (data.type === "pipeline_state")
this.onPipelineState?.({
upcoming: data.upcoming,
backlog: data.backlog,
current: data.current,
qa: data.qa,
merge: data.merge,
@@ -405,6 +421,10 @@ export class ChatWebSocket {
if (data.type === "agent_state_changed") this.onAgentStateChanged?.();
if (data.type === "onboarding_status")
this.onOnboardingStatus?.(data.needs_onboarding);
if (data.type === "side_question_token")
this.onSideQuestionToken?.(data.content);
if (data.type === "side_question_done")
this.onSideQuestionDone?.(data.response);
if (data.type === "pong") {
window.clearTimeout(this.heartbeatTimeout);
this.heartbeatTimeout = undefined;
@@ -458,6 +478,8 @@ export class ChatWebSocket {
onAgentConfigChanged?: () => void;
onAgentStateChanged?: () => void;
onOnboardingStatus?: (needsOnboarding: boolean) => void;
onSideQuestionToken?: (content: string) => void;
onSideQuestionDone?: (response: string) => void;
},
wsPath = DEFAULT_WS_PATH,
) {
@@ -473,6 +495,8 @@ export class ChatWebSocket {
this.onAgentConfigChanged = handlers.onAgentConfigChanged;
this.onAgentStateChanged = handlers.onAgentStateChanged;
this.onOnboardingStatus = handlers.onOnboardingStatus;
this.onSideQuestionToken = handlers.onSideQuestionToken;
this.onSideQuestionDone = handlers.onSideQuestionDone;
this.wsPath = wsPath;
this.shouldReconnect = true;
@@ -498,6 +522,19 @@ export class ChatWebSocket {
this.send({ type: "chat", messages, config });
}
sendSideQuestion(
question: string,
contextMessages: Message[],
config: ProviderConfig,
) {
this.send({
type: "side_question",
question,
context_messages: contextMessages,
config,
});
}
cancel() {
this.send({ type: "cancel" });
}

View File

@@ -213,7 +213,7 @@ describe("RosterBadge availability state", () => {
});
});
describe("Thinking traces hidden from agent stream UI", () => {
describe("Agent output not shown in sidebar (story 290)", () => {
beforeAll(() => {
Element.prototype.scrollIntoView = vi.fn();
});
@@ -224,7 +224,51 @@ describe("Thinking traces hidden from agent stream UI", () => {
mockedSubscribeAgentStream.mockReturnValue(() => {});
});
// AC1: thinking block is never rendered even when thinking events arrive
// AC1: output events do not appear in the agents sidebar
it("does not render agent output when output event arrives", async () => {
let emitEvent: ((e: AgentEvent) => void) | null = null;
mockedSubscribeAgentStream.mockImplementation(
(_storyId, _agentName, onEvent) => {
emitEvent = onEvent;
return () => {};
},
);
const agentList: AgentInfo[] = [
{
story_id: "290_output",
agent_name: "coder-1",
status: "running",
session_id: null,
worktree_path: "/tmp/wt",
base_branch: "master",
log_session_id: null,
},
];
mockedAgents.listAgents.mockResolvedValue(agentList);
const { container } = render(<AgentPanel />);
await screen.findByTestId("roster-badge-coder-1");
await act(async () => {
emitEvent?.({
type: "output",
story_id: "290_output",
agent_name: "coder-1",
text: "doing some work...",
});
});
// No output elements in the sidebar
expect(
container.querySelector('[data-testid^="agent-output-"]'),
).not.toBeInTheDocument();
expect(
container.querySelector('[data-testid^="agent-stream-"]'),
).not.toBeInTheDocument();
});
// AC1: thinking events do not appear in the agents sidebar
it("does not render thinking block when thinking event arrives", async () => {
let emitEvent: ((e: AgentEvent) => void) | null = null;
mockedSubscribeAgentStream.mockImplementation(
@@ -236,7 +280,7 @@ describe("Thinking traces hidden from agent stream UI", () => {
const agentList: AgentInfo[] = [
{
story_id: "218_thinking",
story_id: "290_thinking",
agent_name: "coder-1",
status: "running",
session_id: null,
@@ -253,108 +297,16 @@ describe("Thinking traces hidden from agent stream UI", () => {
await act(async () => {
emitEvent?.({
type: "thinking",
story_id: "218_thinking",
story_id: "290_thinking",
agent_name: "coder-1",
text: "Let me consider the problem carefully...",
});
});
// AC1: thinking block must not be present
// No thinking block or output in sidebar
expect(screen.queryByTestId("thinking-block")).not.toBeInTheDocument();
});
// AC2: after thinking events, only regular output is rendered
it("renders regular output but not thinking block when both arrive", async () => {
let emitEvent: ((e: AgentEvent) => void) | null = null;
mockedSubscribeAgentStream.mockImplementation(
(_storyId, _agentName, onEvent) => {
emitEvent = onEvent;
return () => {};
},
);
const agentList: AgentInfo[] = [
{
story_id: "218_output",
agent_name: "coder-1",
status: "running",
session_id: null,
worktree_path: "/tmp/wt",
base_branch: "master",
log_session_id: null,
},
];
mockedAgents.listAgents.mockResolvedValue(agentList);
render(<AgentPanel />);
await screen.findByTestId("roster-badge-coder-1");
// Thinking event — must be ignored visually
await act(async () => {
emitEvent?.({
type: "thinking",
story_id: "218_output",
agent_name: "coder-1",
text: "thinking deeply",
});
});
// AC3: output event still renders correctly (no regression)
await act(async () => {
emitEvent?.({
type: "output",
story_id: "218_output",
agent_name: "coder-1",
text: "Here is the result.",
});
});
// AC1: no thinking block
expect(screen.queryByTestId("thinking-block")).not.toBeInTheDocument();
// AC2+AC3: output area renders the text
const outputArea = screen.getByTestId("agent-output-coder-1");
expect(outputArea).toBeInTheDocument();
expect(outputArea.textContent).toContain("Here is the result.");
});
// AC3: output-only event stream (no thinking) still works
it("renders output event text without a thinking block", async () => {
let emitEvent: ((e: AgentEvent) => void) | null = null;
mockedSubscribeAgentStream.mockImplementation(
(_storyId, _agentName, onEvent) => {
emitEvent = onEvent;
return () => {};
},
);
const agentList: AgentInfo[] = [
{
story_id: "218_noThink",
agent_name: "coder-1",
status: "running",
session_id: null,
worktree_path: "/tmp/wt",
base_branch: "master",
log_session_id: null,
},
];
mockedAgents.listAgents.mockResolvedValue(agentList);
render(<AgentPanel />);
await screen.findByTestId("roster-badge-coder-1");
await act(async () => {
emitEvent?.({
type: "output",
story_id: "218_noThink",
agent_name: "coder-1",
text: "plain output line",
});
});
expect(screen.queryByTestId("thinking-block")).not.toBeInTheDocument();
const outputArea = screen.getByTestId("agent-output-coder-1");
expect(outputArea.textContent).toContain("plain output line");
expect(
screen.queryByText("Let me consider the problem carefully..."),
).not.toBeInTheDocument();
});
});

View File

@@ -13,7 +13,6 @@ const { useCallback, useEffect, useRef, useState } = React;
interface AgentState {
agentName: string;
status: AgentStatusValue;
log: string[];
sessionId: string | null;
worktreePath: string | null;
baseBranch: string | null;
@@ -120,7 +119,6 @@ export function AgentPanel({
const current = prev[key] ?? {
agentName,
status: "pending" as AgentStatusValue,
log: [],
sessionId: null,
worktreePath: null,
baseBranch: null,
@@ -144,14 +142,6 @@ export function AgentPanel({
},
};
}
case "output":
return {
...prev,
[key]: {
...current,
log: [...current.log, event.text ?? ""],
},
};
case "done":
return {
...prev,
@@ -168,14 +158,12 @@ export function AgentPanel({
[key]: {
...current,
status: "failed",
log: [
...current.log,
`[ERROR] ${event.message ?? "Unknown error"}`,
],
terminalAt: current.terminalAt ?? Date.now(),
},
};
default:
// output, thinking, and other events are not displayed in the sidebar.
// Agent output streams appear in the work item detail panel instead.
return prev;
}
});
@@ -201,7 +189,6 @@ export function AgentPanel({
agentMap[key] = {
agentName: a.agent_name,
status: a.status,
log: [],
sessionId: a.session_id,
worktreePath: a.worktree_path,
baseBranch: a.base_branch,
@@ -258,9 +245,6 @@ export function AgentPanel({
}
};
// Agents that have streaming content to show
const activeAgents = Object.values(agents).filter((a) => a.log.length > 0);
return (
<div
style={{
@@ -417,35 +401,6 @@ export function AgentPanel({
</div>
)}
{/* Per-agent streaming output */}
{activeAgents.map((agent) => (
<div
key={`stream-${agent.agentName}`}
data-testid={`agent-stream-${agent.agentName}`}
style={{
display: "flex",
flexDirection: "column",
gap: "4px",
}}
>
{agent.log.length > 0 && (
<div
data-testid={`agent-output-${agent.agentName}`}
style={{
fontSize: "0.8em",
fontFamily: "monospace",
color: "#ccc",
whiteSpace: "pre-wrap",
wordBreak: "break-word",
lineHeight: "1.5",
}}
>
{agent.log.join("")}
</div>
)}
</div>
))}
{actionError && (
<div
style={{

View File

@@ -26,6 +26,8 @@ type WsHandlers = {
) => void;
};
let capturedWsHandlers: WsHandlers | null = null;
// Captures the last sendChat call's arguments for assertion.
let lastSendChatArgs: { messages: Message[]; config: unknown } | null = null;
vi.mock("../api/client", () => {
const api = {
@@ -36,13 +38,17 @@ vi.mock("../api/client", () => {
setModelPreference: vi.fn(),
cancelChat: vi.fn(),
setAnthropicApiKey: vi.fn(),
readFile: vi.fn(),
listProjectFiles: vi.fn(),
};
class ChatWebSocket {
connect(handlers: WsHandlers) {
capturedWsHandlers = handlers;
}
close() {}
sendChat() {}
sendChat(messages: Message[], config: unknown) {
lastSendChatArgs = { messages, config };
}
cancel() {}
}
return { api, ChatWebSocket };
@@ -56,6 +62,8 @@ const mockedApi = {
setModelPreference: vi.mocked(api.setModelPreference),
cancelChat: vi.mocked(api.cancelChat),
setAnthropicApiKey: vi.mocked(api.setAnthropicApiKey),
readFile: vi.mocked(api.readFile),
listProjectFiles: vi.mocked(api.listProjectFiles),
};
function setupMocks() {
@@ -64,6 +72,8 @@ function setupMocks() {
mockedApi.getAnthropicModels.mockResolvedValue([]);
mockedApi.getModelPreference.mockResolvedValue(null);
mockedApi.setModelPreference.mockResolvedValue(true);
mockedApi.readFile.mockResolvedValue("");
mockedApi.listProjectFiles.mockResolvedValue([]);
mockedApi.cancelChat.mockResolvedValue(true);
mockedApi.setAnthropicApiKey.mockResolvedValue(true);
}
@@ -529,6 +539,117 @@ describe("Chat localStorage persistence (Story 145)", () => {
confirmSpy.mockRestore();
});
it("Bug 245: messages survive unmount/remount cycle (page refresh)", async () => {
// Step 1: Render Chat and populate messages via WebSocket onUpdate
const { unmount } = render(
<Chat projectPath={PROJECT_PATH} onCloseProject={vi.fn()} />,
);
await waitFor(() => expect(capturedWsHandlers).not.toBeNull());
const history: Message[] = [
{ role: "user", content: "Persist me across refresh" },
{ role: "assistant", content: "I should survive a reload" },
];
act(() => {
capturedWsHandlers?.onUpdate(history);
});
// Verify messages are persisted to localStorage
expect(localStorage.getItem(STORAGE_KEY)).not.toBeNull();
const storedBefore = JSON.parse(localStorage.getItem(STORAGE_KEY) ?? "[]");
expect(storedBefore).toEqual(history);
// Step 2: Unmount the Chat component (simulates page unload)
unmount();
// Verify localStorage was NOT cleared by unmount
expect(localStorage.getItem(STORAGE_KEY)).not.toBeNull();
const storedAfterUnmount = JSON.parse(
localStorage.getItem(STORAGE_KEY) ?? "[]",
);
expect(storedAfterUnmount).toEqual(history);
// Step 3: Remount the Chat component (simulates page reload)
capturedWsHandlers = null;
render(<Chat projectPath={PROJECT_PATH} onCloseProject={vi.fn()} />);
// Verify messages are restored from localStorage
expect(
await screen.findByText("Persist me across refresh"),
).toBeInTheDocument();
expect(
await screen.findByText("I should survive a reload"),
).toBeInTheDocument();
// Verify localStorage still has the messages
const storedAfterRemount = JSON.parse(
localStorage.getItem(STORAGE_KEY) ?? "[]",
);
expect(storedAfterRemount).toEqual(history);
});
it("Bug 245: after refresh, sendChat includes full prior history", async () => {
// Step 1: Render, populate messages via onUpdate, then unmount (simulate refresh)
const { unmount } = render(
<Chat projectPath={PROJECT_PATH} onCloseProject={vi.fn()} />,
);
await waitFor(() => expect(capturedWsHandlers).not.toBeNull());
const priorHistory: Message[] = [
{ role: "user", content: "What is Rust?" },
{ role: "assistant", content: "Rust is a systems programming language." },
];
act(() => {
capturedWsHandlers?.onUpdate(priorHistory);
});
// Verify localStorage has the prior history
const stored = JSON.parse(localStorage.getItem(STORAGE_KEY) ?? "[]");
expect(stored).toEqual(priorHistory);
unmount();
// Step 2: Remount (simulates page reload) — messages load from localStorage
capturedWsHandlers = null;
lastSendChatArgs = null;
render(<Chat projectPath={PROJECT_PATH} onCloseProject={vi.fn()} />);
await waitFor(() => expect(capturedWsHandlers).not.toBeNull());
// Verify prior messages are displayed
expect(await screen.findByText("What is Rust?")).toBeInTheDocument();
// Step 3: Send a new message — sendChat should include the full prior history
const input = screen.getByPlaceholderText("Send a message...");
await act(async () => {
fireEvent.change(input, { target: { value: "Tell me more" } });
});
await act(async () => {
fireEvent.keyDown(input, { key: "Enter", shiftKey: false });
});
// Verify sendChat was called with ALL prior messages + the new one
expect(lastSendChatArgs).not.toBeNull();
const args = lastSendChatArgs as unknown as {
messages: Message[];
config: unknown;
};
expect(args.messages).toHaveLength(3);
expect(args.messages[0]).toEqual({
role: "user",
content: "What is Rust?",
});
expect(args.messages[1]).toEqual({
role: "assistant",
content: "Rust is a systems programming language.",
});
expect(args.messages[2]).toEqual({
role: "user",
content: "Tell me more",
});
});
it("AC5: uses project-scoped storage key", async () => {
const otherKey = "storykit-chat-history:/other/project";
localStorage.setItem(
@@ -1164,3 +1285,175 @@ describe("Remove bubble styling from streaming messages (Story 163)", () => {
expect(styleAttr).not.toContain("background: transparent");
});
});
describe("Bug 264: Claude Code session ID persisted across browser refresh", () => {
const PROJECT_PATH = "/tmp/project";
const SESSION_KEY = `storykit-claude-session-id:${PROJECT_PATH}`;
const STORAGE_KEY = `storykit-chat-history:${PROJECT_PATH}`;
beforeEach(() => {
capturedWsHandlers = null;
lastSendChatArgs = null;
localStorage.clear();
setupMocks();
});
afterEach(() => {
localStorage.clear();
});
it("AC1: session_id is persisted to localStorage when onSessionId fires", async () => {
render(<Chat projectPath={PROJECT_PATH} onCloseProject={vi.fn()} />);
await waitFor(() => expect(capturedWsHandlers).not.toBeNull());
act(() => {
capturedWsHandlers?.onSessionId("test-session-abc");
});
await waitFor(() => {
expect(localStorage.getItem(SESSION_KEY)).toBe("test-session-abc");
});
});
it("AC2: after remount, next sendChat includes session_id from localStorage", async () => {
// Step 1: Render, receive a session ID, then unmount (simulate refresh)
localStorage.setItem(SESSION_KEY, "persisted-session-xyz");
localStorage.setItem(
STORAGE_KEY,
JSON.stringify([
{ role: "user", content: "Prior message" },
{ role: "assistant", content: "Prior reply" },
]),
);
const { unmount } = render(
<Chat projectPath={PROJECT_PATH} onCloseProject={vi.fn()} />,
);
await waitFor(() => expect(capturedWsHandlers).not.toBeNull());
unmount();
// Step 2: Remount (simulates page reload)
capturedWsHandlers = null;
lastSendChatArgs = null;
render(<Chat projectPath={PROJECT_PATH} onCloseProject={vi.fn()} />);
await waitFor(() => expect(capturedWsHandlers).not.toBeNull());
// Prior messages should be visible
expect(await screen.findByText("Prior message")).toBeInTheDocument();
// Step 3: Send a new message — config should include session_id
const input = screen.getByPlaceholderText("Send a message...");
await act(async () => {
fireEvent.change(input, { target: { value: "Continue" } });
});
await act(async () => {
fireEvent.keyDown(input, { key: "Enter", shiftKey: false });
});
expect(lastSendChatArgs).not.toBeNull();
expect(
(
(
lastSendChatArgs as unknown as {
messages: Message[];
config: unknown;
}
)?.config as Record<string, unknown>
).session_id,
).toBe("persisted-session-xyz");
});
it("AC3: clearing the session also clears the persisted session_id", async () => {
localStorage.setItem(SESSION_KEY, "session-to-clear");
const confirmSpy = vi.spyOn(window, "confirm").mockReturnValue(true);
render(<Chat projectPath={PROJECT_PATH} onCloseProject={vi.fn()} />);
await waitFor(() => expect(capturedWsHandlers).not.toBeNull());
const newSessionBtn = screen.getByText(/New Session/);
await act(async () => {
fireEvent.click(newSessionBtn);
});
expect(localStorage.getItem(SESSION_KEY)).toBeNull();
confirmSpy.mockRestore();
});
it("AC1: storage key is scoped to project path", async () => {
const otherPath = "/other/project";
const otherKey = `storykit-claude-session-id:${otherPath}`;
localStorage.setItem(otherKey, "other-session");
render(<Chat projectPath={PROJECT_PATH} onCloseProject={vi.fn()} />);
await waitFor(() => expect(capturedWsHandlers).not.toBeNull());
act(() => {
capturedWsHandlers?.onSessionId("my-session");
});
await waitFor(() => {
expect(localStorage.getItem(SESSION_KEY)).toBe("my-session");
});
// Other project's session should be untouched
expect(localStorage.getItem(otherKey)).toBe("other-session");
});
});
describe("File reference expansion (Story 269 AC4)", () => {
beforeEach(() => {
vi.clearAllMocks();
capturedWsHandlers = null;
lastSendChatArgs = null;
setupMocks();
});
it("includes file contents as context when message contains @file reference", async () => {
mockedApi.readFile.mockResolvedValue('fn main() { println!("hello"); }');
render(<Chat projectPath="/tmp/project" onCloseProject={vi.fn()} />);
await waitFor(() => expect(capturedWsHandlers).not.toBeNull());
const input = screen.getByPlaceholderText("Send a message...");
await act(async () => {
fireEvent.change(input, { target: { value: "explain @src/main.rs" } });
});
await act(async () => {
fireEvent.keyDown(input, { key: "Enter", shiftKey: false });
});
await waitFor(() => expect(lastSendChatArgs).not.toBeNull());
const sentMessages = (
lastSendChatArgs as NonNullable<typeof lastSendChatArgs>
).messages;
const userMsg = sentMessages[sentMessages.length - 1];
expect(userMsg.content).toContain("explain @src/main.rs");
expect(userMsg.content).toContain("[File: src/main.rs]");
expect(userMsg.content).toContain("fn main()");
});
it("sends message without modification when no @file references are present", async () => {
render(<Chat projectPath="/tmp/project" onCloseProject={vi.fn()} />);
await waitFor(() => expect(capturedWsHandlers).not.toBeNull());
const input = screen.getByPlaceholderText("Send a message...");
await act(async () => {
fireEvent.change(input, { target: { value: "hello world" } });
});
await act(async () => {
fireEvent.keyDown(input, { key: "Enter", shiftKey: false });
});
await waitFor(() => expect(lastSendChatArgs).not.toBeNull());
const sentMessages = (
lastSendChatArgs as NonNullable<typeof lastSendChatArgs>
).messages;
const userMsg = sentMessages[sentMessages.length - 1];
expect(userMsg.content).toBe("hello world");
expect(mockedApi.readFile).not.toHaveBeenCalled();
});
});

View File

@@ -10,8 +10,10 @@ import { AgentPanel } from "./AgentPanel";
import { ChatHeader } from "./ChatHeader";
import type { ChatInputHandle } from "./ChatInput";
import { ChatInput } from "./ChatInput";
import { HelpOverlay } from "./HelpOverlay";
import { LozengeFlyProvider } from "./LozengeFlyContext";
import { MessageItem } from "./MessageItem";
import { SideQuestionOverlay } from "./SideQuestionOverlay";
import { StagePanel } from "./StagePanel";
import { WorkItemDetailPanel } from "./WorkItemDetailPanel";
@@ -163,13 +165,22 @@ export function Chat({ projectPath, onCloseProject }: ChatProps) {
const [apiKeyInput, setApiKeyInput] = useState("");
const [hasAnthropicKey, setHasAnthropicKey] = useState(false);
const [pipeline, setPipeline] = useState<PipelineState>({
upcoming: [],
backlog: [],
current: [],
qa: [],
merge: [],
done: [],
});
const [claudeSessionId, setClaudeSessionId] = useState<string | null>(null);
const [claudeSessionId, setClaudeSessionId] = useState<string | null>(() => {
try {
return (
localStorage.getItem(`storykit-claude-session-id:${projectPath}`) ??
null
);
} catch {
return null;
}
});
const [activityStatus, setActivityStatus] = useState<string | null>(null);
const [permissionQueue, setPermissionQueue] = useState<
{
@@ -197,6 +208,12 @@ export function Chat({ projectPath, onCloseProject }: ChatProps) {
const [queuedMessages, setQueuedMessages] = useState<
{ id: string; text: string }[]
>([]);
const [sideQuestion, setSideQuestion] = useState<{
question: string;
response: string;
loading: boolean;
} | null>(null);
const [showHelp, setShowHelp] = useState(false);
// Ref so stale WebSocket callbacks can read the current queued messages
const queuedMessagesRef = useRef<{ id: string; text: string }[]>([]);
const queueIdCounterRef = useRef(0);
@@ -239,6 +256,21 @@ export function Chat({ projectPath, onCloseProject }: ChatProps) {
};
}, [messages, streamingContent, model]);
useEffect(() => {
try {
if (claudeSessionId !== null) {
localStorage.setItem(
`storykit-claude-session-id:${projectPath}`,
claudeSessionId,
);
} else {
localStorage.removeItem(`storykit-claude-session-id:${projectPath}`);
}
} catch {
// Ignore — quota or security errors.
}
}, [claudeSessionId, projectPath]);
useEffect(() => {
api
.getOllamaModels()
@@ -360,6 +392,16 @@ export function Chat({ projectPath, onCloseProject }: ChatProps) {
onOnboardingStatus: (onboarding: boolean) => {
setNeedsOnboarding(onboarding);
},
onSideQuestionToken: (content) => {
setSideQuestion((prev) =>
prev ? { ...prev, response: prev.response + content } : prev,
);
},
onSideQuestionDone: (response) => {
setSideQuestion((prev) =>
prev ? { ...prev, response, loading: false } : prev,
);
},
});
return () => {
@@ -372,7 +414,11 @@ export function Chat({ projectPath, onCloseProject }: ChatProps) {
const element = scrollContainerRef.current;
if (element) {
element.scrollTop = element.scrollHeight;
lastScrollTopRef.current = element.scrollHeight;
// Read scrollTop back after assignment: the browser caps it at
// (scrollHeight - clientHeight), so storing scrollHeight would
// make handleScroll incorrectly interpret the next scroll event
// as an upward scroll and disable auto-scrolling.
lastScrollTopRef.current = element.scrollTop;
}
}, []);
@@ -459,6 +505,34 @@ export function Chat({ projectPath, onCloseProject }: ChatProps) {
const sendMessage = async (messageText: string) => {
if (!messageText.trim()) return;
// /help — show available slash commands overlay
if (/^\/help\s*$/i.test(messageText)) {
setShowHelp(true);
return;
}
// /btw <question> — answered from context without disrupting main chat
const btwMatch = messageText.match(/^\/btw\s+(.+)/s);
if (btwMatch) {
const question = btwMatch[1].trim();
setSideQuestion({ question, response: "", loading: true });
const isClaudeCode = model === "claude-code-pty";
const provider = isClaudeCode
? "claude-code"
: model.startsWith("claude-")
? "anthropic"
: "ollama";
const config: ProviderConfig = {
provider,
model,
base_url: "http://localhost:11434",
enable_tools: false,
};
wsRef.current?.sendSideQuestion(question, messages, config);
return;
}
// Agent is busy — queue the message instead of dropping it
if (loading) {
const newItem = {
@@ -480,7 +554,26 @@ export function Chat({ projectPath, onCloseProject }: ChatProps) {
}
}
const userMsg: Message = { role: "user", content: messageText };
// Expand @file references: append file contents as context
const fileRefs = [...messageText.matchAll(/(^|[\s\n])@([^\s@]+)/g)].map(
(m) => m[2],
);
let expandedText = messageText;
if (fileRefs.length > 0) {
const expansions = await Promise.allSettled(
fileRefs.map(async (ref) => {
const contents = await api.readFile(ref);
return { ref, contents };
}),
);
for (const result of expansions) {
if (result.status === "fulfilled") {
expandedText += `\n\n[File: ${result.value.ref}]\n\`\`\`\n${result.value.contents}\n\`\`\``;
}
}
}
const userMsg: Message = { role: "user", content: expandedText };
const newHistory = [...messages, userMsg];
setMessages(newHistory);
@@ -614,6 +707,11 @@ export function Chat({ projectPath, onCloseProject }: ChatProps) {
setLoading(false);
setActivityStatus(null);
setClaudeSessionId(null);
try {
localStorage.removeItem(`storykit-claude-session-id:${projectPath}`);
} catch {
// Ignore — quota or security errors.
}
}
};
@@ -919,8 +1017,8 @@ export function Chat({ projectPath, onCloseProject }: ChatProps) {
onItemClick={(item) => setSelectedWorkItemId(item.story_id)}
/>
<StagePanel
title="Upcoming"
items={pipeline.upcoming}
title="Backlog"
items={pipeline.backlog}
onItemClick={(item) => setSelectedWorkItemId(item.story_id)}
/>
</>
@@ -1154,6 +1252,17 @@ export function Chat({ projectPath, onCloseProject }: ChatProps) {
</div>
</div>
)}
{showHelp && <HelpOverlay onDismiss={() => setShowHelp(false)} />}
{sideQuestion && (
<SideQuestionOverlay
question={sideQuestion.question}
response={sideQuestion.response}
loading={sideQuestion.loading}
onDismiss={() => setSideQuestion(null)}
/>
)}
</div>
);
}

View File

@@ -136,9 +136,9 @@ describe("ChatHeader", () => {
expect(screen.getByText("Built: 2026-01-01 00:00")).toBeInTheDocument();
});
it("displays StorkIt branding in the header", () => {
it("displays Story Kit branding in the header", () => {
render(<ChatHeader {...makeProps()} />);
expect(screen.getByText("StorkIt")).toBeInTheDocument();
expect(screen.getByText("Story Kit")).toBeInTheDocument();
});
it("labels the claude-pty optgroup as 'Claude Code'", () => {

View File

@@ -82,7 +82,7 @@ export function ChatHeader({
letterSpacing: "0.02em",
}}
>
StorkIt
Story Kit
</span>
<div
title={projectPath}

View File

@@ -1,6 +1,14 @@
import * as React from "react";
import { api } from "../api/client";
const { forwardRef, useEffect, useImperativeHandle, useRef, useState } = React;
const {
forwardRef,
useCallback,
useEffect,
useImperativeHandle,
useRef,
useState,
} = React;
export interface ChatInputHandle {
appendToInput(text: string): void;
@@ -14,6 +22,97 @@ interface ChatInputProps {
onRemoveQueuedMessage: (id: string) => void;
}
/** Fuzzy-match: returns true if all chars of `query` appear in order in `str`. */
function fuzzyMatch(str: string, query: string): boolean {
if (!query) return true;
const lower = str.toLowerCase();
const q = query.toLowerCase();
let qi = 0;
for (let i = 0; i < lower.length && qi < q.length; i++) {
if (lower[i] === q[qi]) qi++;
}
return qi === q.length;
}
/** Score a fuzzy match: lower is better. Exact prefix match wins, then shorter paths. */
function fuzzyScore(str: string, query: string): number {
const lower = str.toLowerCase();
const q = query.toLowerCase();
// Prefer matches where query appears as a contiguous substring
if (lower.includes(q)) return lower.indexOf(q);
return str.length;
}
interface FilePickerOverlayProps {
query: string;
files: string[];
selectedIndex: number;
onSelect: (file: string) => void;
onDismiss: () => void;
anchorRef: React.RefObject<HTMLTextAreaElement | null>;
}
function FilePickerOverlay({
query,
files,
selectedIndex,
onSelect,
}: FilePickerOverlayProps) {
const filtered = files
.filter((f) => fuzzyMatch(f, query))
.sort((a, b) => fuzzyScore(a, query) - fuzzyScore(b, query))
.slice(0, 10);
if (filtered.length === 0) return null;
return (
<div
data-testid="file-picker-overlay"
style={{
position: "absolute",
bottom: "100%",
left: 0,
right: 0,
background: "#1e1e1e",
border: "1px solid #444",
borderRadius: "8px",
marginBottom: "6px",
overflow: "hidden",
zIndex: 100,
boxShadow: "0 4px 16px rgba(0,0,0,0.4)",
maxHeight: "240px",
overflowY: "auto",
}}
>
{filtered.map((file, idx) => (
<button
key={file}
type="button"
data-testid={`file-picker-item-${idx}`}
onClick={() => onSelect(file)}
style={{
display: "block",
width: "100%",
textAlign: "left",
padding: "8px 14px",
background: idx === selectedIndex ? "#2d4a6e" : "transparent",
border: "none",
color: idx === selectedIndex ? "#ececec" : "#aaa",
cursor: "pointer",
fontFamily: "monospace",
fontSize: "0.85rem",
whiteSpace: "nowrap",
overflow: "hidden",
textOverflow: "ellipsis",
}}
>
{file}
</button>
))}
</div>
);
}
export const ChatInput = forwardRef<ChatInputHandle, ChatInputProps>(
function ChatInput(
{ loading, queuedMessages, onSubmit, onCancel, onRemoveQueuedMessage },
@@ -22,6 +121,12 @@ export const ChatInput = forwardRef<ChatInputHandle, ChatInputProps>(
const [input, setInput] = useState("");
const inputRef = useRef<HTMLTextAreaElement>(null);
// File picker state
const [projectFiles, setProjectFiles] = useState<string[]>([]);
const [pickerQuery, setPickerQuery] = useState<string | null>(null);
const [pickerSelectedIndex, setPickerSelectedIndex] = useState(0);
const [pickerAtStart, setPickerAtStart] = useState(0);
useImperativeHandle(ref, () => ({
appendToInput(text: string) {
setInput((prev) => (prev ? `${prev}\n${text}` : text));
@@ -32,10 +137,118 @@ export const ChatInput = forwardRef<ChatInputHandle, ChatInputProps>(
inputRef.current?.focus();
}, []);
// Compute filtered files for current picker query
const filteredFiles =
pickerQuery !== null
? projectFiles
.filter((f) => fuzzyMatch(f, pickerQuery))
.sort(
(a, b) => fuzzyScore(a, pickerQuery) - fuzzyScore(b, pickerQuery),
)
.slice(0, 10)
: [];
const dismissPicker = useCallback(() => {
setPickerQuery(null);
setPickerSelectedIndex(0);
}, []);
const selectFile = useCallback(
(file: string) => {
// Replace the @query portion with @file
const before = input.slice(0, pickerAtStart);
const cursorPos = inputRef.current?.selectionStart ?? input.length;
const after = input.slice(cursorPos);
setInput(`${before}@${file}${after}`);
dismissPicker();
// Restore focus after state update
setTimeout(() => inputRef.current?.focus(), 0);
},
[input, pickerAtStart, dismissPicker],
);
const handleInputChange = useCallback(
(e: React.ChangeEvent<HTMLTextAreaElement>) => {
const val = e.target.value;
setInput(val);
const cursor = e.target.selectionStart ?? val.length;
// Find the last @ before the cursor that starts a reference token
const textUpToCursor = val.slice(0, cursor);
// Match @ not preceded by non-whitespace (i.e. @ at start or after space/newline)
const atMatch = textUpToCursor.match(/(^|[\s\n])@([^\s@]*)$/);
if (atMatch) {
const query = atMatch[2];
const atPos = textUpToCursor.lastIndexOf("@");
setPickerAtStart(atPos);
setPickerQuery(query);
setPickerSelectedIndex(0);
// Lazily load files on first trigger
if (projectFiles.length === 0) {
api
.listProjectFiles()
.then(setProjectFiles)
.catch(() => {});
}
} else {
if (pickerQuery !== null) dismissPicker();
}
},
[projectFiles.length, pickerQuery, dismissPicker],
);
const handleKeyDown = useCallback(
(e: React.KeyboardEvent<HTMLTextAreaElement>) => {
if (pickerQuery !== null && filteredFiles.length > 0) {
if (e.key === "ArrowDown") {
e.preventDefault();
setPickerSelectedIndex((i) =>
Math.min(i + 1, filteredFiles.length - 1),
);
return;
}
if (e.key === "ArrowUp") {
e.preventDefault();
setPickerSelectedIndex((i) => Math.max(i - 1, 0));
return;
}
if (e.key === "Enter" || e.key === "Tab") {
e.preventDefault();
selectFile(filteredFiles[pickerSelectedIndex] ?? filteredFiles[0]);
return;
}
if (e.key === "Escape") {
e.preventDefault();
dismissPicker();
return;
}
} else if (e.key === "Escape" && pickerQuery !== null) {
e.preventDefault();
dismissPicker();
return;
}
if (e.key === "Enter" && !e.shiftKey) {
e.preventDefault();
handleSubmit();
}
},
[
pickerQuery,
filteredFiles,
pickerSelectedIndex,
selectFile,
dismissPicker,
],
);
const handleSubmit = () => {
if (!input.trim()) return;
onSubmit(input);
setInput("");
dismissPicker();
};
return (
@@ -135,24 +348,30 @@ export const ChatInput = forwardRef<ChatInputHandle, ChatInputProps>(
</button>
</div>
))}
{/* Input row */}
{/* Input row with file picker overlay */}
<div
style={{
display: "flex",
gap: "8px",
alignItems: "center",
position: "relative",
}}
>
{pickerQuery !== null && (
<FilePickerOverlay
query={pickerQuery}
files={projectFiles}
selectedIndex={pickerSelectedIndex}
onSelect={selectFile}
onDismiss={dismissPicker}
anchorRef={inputRef}
/>
)}
<textarea
ref={inputRef}
value={input}
onChange={(e) => setInput(e.target.value)}
onKeyDown={(e) => {
if (e.key === "Enter" && !e.shiftKey) {
e.preventDefault();
handleSubmit();
}
}}
onChange={handleInputChange}
onKeyDown={handleKeyDown}
placeholder="Send a message..."
rows={1}
style={{

View File

@@ -0,0 +1,194 @@
import {
act,
fireEvent,
render,
screen,
waitFor,
} from "@testing-library/react";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { api } from "../api/client";
import { ChatInput } from "./ChatInput";
vi.mock("../api/client", () => ({
api: {
listProjectFiles: vi.fn(),
},
}));
const mockedListProjectFiles = vi.mocked(api.listProjectFiles);
const defaultProps = {
loading: false,
queuedMessages: [],
onSubmit: vi.fn(),
onCancel: vi.fn(),
onRemoveQueuedMessage: vi.fn(),
};
beforeEach(() => {
vi.clearAllMocks();
mockedListProjectFiles.mockResolvedValue([
"src/main.rs",
"src/lib.rs",
"frontend/index.html",
"README.md",
]);
});
describe("File picker overlay (Story 269 AC1)", () => {
it("shows file picker overlay when @ is typed", async () => {
render(<ChatInput {...defaultProps} />);
const textarea = screen.getByPlaceholderText("Send a message...");
await act(async () => {
fireEvent.change(textarea, { target: { value: "@" } });
});
await waitFor(() => {
expect(screen.getByTestId("file-picker-overlay")).toBeInTheDocument();
});
});
it("does not show file picker overlay for text without @", async () => {
render(<ChatInput {...defaultProps} />);
const textarea = screen.getByPlaceholderText("Send a message...");
await act(async () => {
fireEvent.change(textarea, { target: { value: "hello world" } });
});
expect(screen.queryByTestId("file-picker-overlay")).not.toBeInTheDocument();
});
});
describe("File picker fuzzy matching (Story 269 AC2)", () => {
it("filters files by query typed after @", async () => {
render(<ChatInput {...defaultProps} />);
const textarea = screen.getByPlaceholderText("Send a message...");
await act(async () => {
fireEvent.change(textarea, { target: { value: "@main" } });
});
await waitFor(() => {
expect(screen.getByTestId("file-picker-overlay")).toBeInTheDocument();
});
// main.rs should be visible, README.md should not
expect(screen.getByText("src/main.rs")).toBeInTheDocument();
expect(screen.queryByText("README.md")).not.toBeInTheDocument();
});
it("shows all files when @ is typed with no query", async () => {
render(<ChatInput {...defaultProps} />);
const textarea = screen.getByPlaceholderText("Send a message...");
await act(async () => {
fireEvent.change(textarea, { target: { value: "@" } });
});
await waitFor(() => {
expect(screen.getByTestId("file-picker-overlay")).toBeInTheDocument();
});
// All 4 files should be visible
expect(screen.getByText("src/main.rs")).toBeInTheDocument();
expect(screen.getByText("src/lib.rs")).toBeInTheDocument();
expect(screen.getByText("README.md")).toBeInTheDocument();
});
});
describe("File picker selection (Story 269 AC3)", () => {
it("clicking a file inserts @path into the message", async () => {
render(<ChatInput {...defaultProps} />);
const textarea = screen.getByPlaceholderText("Send a message...");
await act(async () => {
fireEvent.change(textarea, { target: { value: "@" } });
});
await waitFor(() => {
expect(screen.getByTestId("file-picker-item-0")).toBeInTheDocument();
});
await act(async () => {
fireEvent.click(screen.getByTestId("file-picker-item-0"));
});
// Picker should be dismissed and the file reference inserted
expect(screen.queryByTestId("file-picker-overlay")).not.toBeInTheDocument();
expect((textarea as HTMLTextAreaElement).value).toMatch(/^@\S+/);
});
it("Enter key selects highlighted file and inserts it into message", async () => {
render(<ChatInput {...defaultProps} />);
const textarea = screen.getByPlaceholderText("Send a message...");
await act(async () => {
fireEvent.change(textarea, { target: { value: "@main" } });
});
await waitFor(() => {
expect(screen.getByTestId("file-picker-overlay")).toBeInTheDocument();
});
await act(async () => {
fireEvent.keyDown(textarea, { key: "Enter" });
});
expect(screen.queryByTestId("file-picker-overlay")).not.toBeInTheDocument();
expect((textarea as HTMLTextAreaElement).value).toContain("@src/main.rs");
});
});
describe("File picker dismiss (Story 269 AC5)", () => {
it("Escape key dismisses the file picker", async () => {
render(<ChatInput {...defaultProps} />);
const textarea = screen.getByPlaceholderText("Send a message...");
await act(async () => {
fireEvent.change(textarea, { target: { value: "@" } });
});
await waitFor(() => {
expect(screen.getByTestId("file-picker-overlay")).toBeInTheDocument();
});
await act(async () => {
fireEvent.keyDown(textarea, { key: "Escape" });
});
expect(screen.queryByTestId("file-picker-overlay")).not.toBeInTheDocument();
});
});
describe("Multiple @ references (Story 269 AC6)", () => {
it("typing @ after a completed reference triggers picker again", async () => {
render(<ChatInput {...defaultProps} />);
const textarea = screen.getByPlaceholderText("Send a message...");
// First reference
await act(async () => {
fireEvent.change(textarea, { target: { value: "@main" } });
});
await waitFor(() => {
expect(screen.getByTestId("file-picker-overlay")).toBeInTheDocument();
});
// Select file
await act(async () => {
fireEvent.keyDown(textarea, { key: "Enter" });
});
// Type a second @
await act(async () => {
const current = (textarea as HTMLTextAreaElement).value;
fireEvent.change(textarea, { target: { value: `${current} @` } });
});
await waitFor(() => {
expect(screen.getByTestId("file-picker-overlay")).toBeInTheDocument();
});
});
});

View File

@@ -0,0 +1,158 @@
import * as React from "react";
const { useEffect, useRef } = React;
interface SlashCommand {
name: string;
description: string;
}
const SLASH_COMMANDS: SlashCommand[] = [
{
name: "/help",
description: "Show this list of available slash commands.",
},
{
name: "/btw <question>",
description:
"Ask a side question using the current conversation as context. The question and answer are not added to the conversation history.",
},
];
interface HelpOverlayProps {
onDismiss: () => void;
}
/**
* Dismissible overlay that lists all available slash commands.
* Dismiss with Escape, Enter, or Space.
*/
export function HelpOverlay({ onDismiss }: HelpOverlayProps) {
const dismissRef = useRef(onDismiss);
dismissRef.current = onDismiss;
useEffect(() => {
const handler = (e: KeyboardEvent) => {
if (e.key === "Escape" || e.key === "Enter" || e.key === " ") {
e.preventDefault();
dismissRef.current();
}
};
window.addEventListener("keydown", handler);
return () => window.removeEventListener("keydown", handler);
}, []);
return (
// biome-ignore lint/a11y/noStaticElementInteractions: backdrop dismiss is supplementary; keyboard handled via window keydown
// biome-ignore lint/a11y/useKeyWithClickEvents: keyboard dismiss handled via window keydown listener
<div
data-testid="help-overlay"
onClick={onDismiss}
style={{
position: "fixed",
inset: 0,
background: "rgba(0,0,0,0.55)",
display: "flex",
alignItems: "center",
justifyContent: "center",
zIndex: 1000,
}}
>
{/* biome-ignore lint/a11y/useKeyWithClickEvents: stop-propagation only; no real interaction */}
{/* biome-ignore lint/a11y/noStaticElementInteractions: stop-propagation only; no real interaction */}
<div
data-testid="help-panel"
onClick={(e) => e.stopPropagation()}
style={{
background: "#2f2f2f",
border: "1px solid #444",
borderRadius: "12px",
padding: "24px",
maxWidth: "560px",
width: "90vw",
display: "flex",
flexDirection: "column",
gap: "16px",
boxShadow: "0 8px 32px rgba(0,0,0,0.5)",
}}
>
{/* Header */}
<div
style={{
display: "flex",
alignItems: "center",
justifyContent: "space-between",
}}
>
<span
style={{
fontSize: "0.7rem",
fontWeight: 700,
letterSpacing: "0.08em",
textTransform: "uppercase",
color: "#a0d4a0",
}}
>
Slash Commands
</span>
<button
type="button"
onClick={onDismiss}
title="Dismiss (Escape, Enter, or Space)"
style={{
background: "none",
border: "none",
color: "#666",
cursor: "pointer",
fontSize: "1.1rem",
padding: "2px 6px",
borderRadius: "4px",
}}
>
</button>
</div>
{/* Command list */}
<div style={{ display: "flex", flexDirection: "column", gap: "12px" }}>
{SLASH_COMMANDS.map((cmd) => (
<div
key={cmd.name}
style={{ display: "flex", flexDirection: "column", gap: "2px" }}
>
<code
style={{
fontSize: "0.88rem",
color: "#e0e0e0",
fontFamily: "monospace",
}}
>
{cmd.name}
</code>
<span
style={{
fontSize: "0.85rem",
color: "#999",
lineHeight: "1.5",
}}
>
{cmd.description}
</span>
</div>
))}
</div>
{/* Footer hint */}
<div
style={{
fontSize: "0.75rem",
color: "#555",
textAlign: "center",
}}
>
Press Escape, Enter, or Space to dismiss
</div>
</div>
</div>
);
}

View File

@@ -9,7 +9,7 @@ import { StagePanel } from "./StagePanel";
function makePipeline(overrides: Partial<PipelineState> = {}): PipelineState {
return {
upcoming: [],
backlog: [],
current: [],
qa: [],
merge: [],

View File

@@ -115,7 +115,7 @@ export function LozengeFlyProvider({
const assignedAgentNames = useMemo(() => {
const names = new Set<string>();
for (const item of [
...pipeline.upcoming,
...pipeline.backlog,
...pipeline.current,
...pipeline.qa,
...pipeline.merge,
@@ -165,13 +165,13 @@ export function LozengeFlyProvider({
const prev = prevPipelineRef.current;
const allPrev = [
...prev.upcoming,
...prev.backlog,
...prev.current,
...prev.qa,
...prev.merge,
];
const allCurr = [
...pipeline.upcoming,
...pipeline.backlog,
...pipeline.current,
...pipeline.qa,
...pipeline.merge,

View File

@@ -0,0 +1,159 @@
import * as React from "react";
import Markdown from "react-markdown";
const { useEffect, useRef } = React;
interface SideQuestionOverlayProps {
question: string;
/** Streaming response text. Empty while loading. */
response: string;
loading: boolean;
onDismiss: () => void;
}
/**
* Dismissible overlay that shows a /btw side question and its streamed response.
* The question and response are NOT part of the main conversation history.
* Dismiss with Escape, Enter, or Space.
*/
export function SideQuestionOverlay({
question,
response,
loading,
onDismiss,
}: SideQuestionOverlayProps) {
const dismissRef = useRef(onDismiss);
dismissRef.current = onDismiss;
useEffect(() => {
const handler = (e: KeyboardEvent) => {
if (e.key === "Escape" || e.key === "Enter" || e.key === " ") {
e.preventDefault();
dismissRef.current();
}
};
window.addEventListener("keydown", handler);
return () => window.removeEventListener("keydown", handler);
}, []);
return (
// biome-ignore lint/a11y/noStaticElementInteractions: backdrop dismiss is supplementary; keyboard handled via window keydown
// biome-ignore lint/a11y/useKeyWithClickEvents: keyboard dismiss handled via window keydown listener
<div
data-testid="side-question-overlay"
onClick={onDismiss}
style={{
position: "fixed",
inset: 0,
background: "rgba(0,0,0,0.55)",
display: "flex",
alignItems: "center",
justifyContent: "center",
zIndex: 1000,
}}
>
{/* biome-ignore lint/a11y/useKeyWithClickEvents: stop-propagation only; no real interaction */}
{/* biome-ignore lint/a11y/noStaticElementInteractions: stop-propagation only; no real interaction */}
<div
data-testid="side-question-panel"
onClick={(e) => e.stopPropagation()}
style={{
background: "#2f2f2f",
border: "1px solid #444",
borderRadius: "12px",
padding: "24px",
maxWidth: "640px",
width: "90vw",
maxHeight: "60vh",
display: "flex",
flexDirection: "column",
gap: "16px",
boxShadow: "0 8px 32px rgba(0,0,0,0.5)",
}}
>
{/* Header */}
<div
style={{
display: "flex",
alignItems: "flex-start",
justifyContent: "space-between",
gap: "12px",
}}
>
<div>
<span
style={{
display: "block",
fontSize: "0.7rem",
fontWeight: 700,
letterSpacing: "0.08em",
textTransform: "uppercase",
color: "#a0d4a0",
marginBottom: "4px",
}}
>
/btw
</span>
<span
style={{
fontSize: "1rem",
color: "#ececec",
fontWeight: 500,
}}
>
{question}
</span>
</div>
<button
type="button"
onClick={onDismiss}
title="Dismiss (Escape, Enter, or Space)"
style={{
background: "none",
border: "none",
color: "#666",
cursor: "pointer",
fontSize: "1.1rem",
padding: "2px 6px",
borderRadius: "4px",
flexShrink: 0,
}}
>
</button>
</div>
{/* Response area */}
<div
style={{
overflowY: "auto",
flex: 1,
color: "#ccc",
fontSize: "0.95rem",
lineHeight: "1.6",
}}
>
{loading && !response && (
<span style={{ color: "#666", fontStyle: "italic" }}>
Thinking
</span>
)}
{response && <Markdown>{response}</Markdown>}
</div>
{/* Footer hint */}
{!loading && (
<div
style={{
fontSize: "0.75rem",
color: "#555",
textAlign: "center",
}}
>
Press Escape, Enter, or Space to dismiss
</div>
)}
</div>
</div>
);
}

View File

@@ -4,12 +4,13 @@ import { useLozengeFly } from "./LozengeFlyContext";
const { useLayoutEffect, useRef } = React;
type WorkItemType = "story" | "bug" | "spike" | "unknown";
type WorkItemType = "story" | "bug" | "spike" | "refactor" | "unknown";
const TYPE_COLORS: Record<WorkItemType, string> = {
story: "#3fb950",
bug: "#f85149",
spike: "#58a6ff",
refactor: "#a371f7",
unknown: "#444",
};
@@ -17,6 +18,7 @@ const TYPE_LABELS: Record<WorkItemType, string | null> = {
story: "STORY",
bug: "BUG",
spike: "SPIKE",
refactor: "REFACTOR",
unknown: null,
};
@@ -24,7 +26,12 @@ function getWorkItemType(storyId: string): WorkItemType {
const match = storyId.match(/^\d+_([a-z]+)_/);
if (!match) return "unknown";
const segment = match[1];
if (segment === "story" || segment === "bug" || segment === "spike") {
if (
segment === "story" ||
segment === "bug" ||
segment === "spike" ||
segment === "refactor"
) {
return segment;
}
return "unknown";

View File

@@ -25,6 +25,7 @@ vi.mock("../api/agents", () => ({
import { agentsApi, subscribeAgentStream } from "../api/agents";
import { api } from "../api/client";
const { WorkItemDetailPanel } = await import("./WorkItemDetailPanel");
const mockedGetWorkItemContent = vi.mocked(api.getWorkItemContent);
@@ -36,6 +37,7 @@ const DEFAULT_CONTENT = {
content: "# Big Title\n\nSome content here.",
stage: "current",
name: "Big Title Story",
agent: null,
};
const sampleTestResults: TestResultsResponse = {
@@ -435,6 +437,60 @@ describe("WorkItemDetailPanel - Agent Logs", () => {
});
});
describe("WorkItemDetailPanel - Assigned Agent", () => {
it("shows assigned agent name when agent front matter field is set", async () => {
mockedGetWorkItemContent.mockResolvedValue({
...DEFAULT_CONTENT,
agent: "coder-opus",
});
render(
<WorkItemDetailPanel
storyId="271_story_test"
pipelineVersion={0}
onClose={() => {}}
/>,
);
const agentEl = await screen.findByTestId("detail-panel-assigned-agent");
expect(agentEl).toHaveTextContent("coder-opus");
});
it("omits assigned agent field when no agent is set in front matter", async () => {
render(
<WorkItemDetailPanel
storyId="271_story_test"
pipelineVersion={0}
onClose={() => {}}
/>,
);
await screen.findByTestId("detail-panel-content");
expect(
screen.queryByTestId("detail-panel-assigned-agent"),
).not.toBeInTheDocument();
});
it("shows the specific agent name not just 'assigned'", async () => {
mockedGetWorkItemContent.mockResolvedValue({
...DEFAULT_CONTENT,
agent: "coder-haiku",
});
render(
<WorkItemDetailPanel
storyId="271_story_test"
pipelineVersion={0}
onClose={() => {}}
/>,
);
const agentEl = await screen.findByTestId("detail-panel-assigned-agent");
expect(agentEl).toHaveTextContent("coder-haiku");
expect(agentEl).not.toHaveTextContent("assigned");
});
});
describe("WorkItemDetailPanel - Test Results", () => {
it("shows empty test results message when no results exist", async () => {
mockedGetTestResults.mockResolvedValue(null);

View File

@@ -8,7 +8,7 @@ import { api } from "../api/client";
const { useEffect, useRef, useState } = React;
const STAGE_LABELS: Record<string, string> = {
upcoming: "Upcoming",
backlog: "Backlog",
current: "Current",
qa: "QA",
merge: "To Merge",
@@ -113,6 +113,7 @@ export function WorkItemDetailPanel({
const [content, setContent] = useState<string | null>(null);
const [stage, setStage] = useState<string>("");
const [name, setName] = useState<string | null>(null);
const [assignedAgent, setAssignedAgent] = useState<string | null>(null);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
const [agentInfo, setAgentInfo] = useState<AgentInfo | null>(null);
@@ -133,6 +134,7 @@ export function WorkItemDetailPanel({
setContent(data.content);
setStage(data.stage);
setName(data.name);
setAssignedAgent(data.agent);
})
.catch((err: unknown) => {
setError(err instanceof Error ? err.message : "Failed to load content");
@@ -278,6 +280,14 @@ export function WorkItemDetailPanel({
{stageLabel}
</div>
)}
{assignedAgent ? (
<div
data-testid="detail-panel-assigned-agent"
style={{ fontSize: "0.75em", color: "#888" }}
>
Agent: {assignedAgent}
</div>
) : null}
</div>
<button
type="button"
@@ -410,81 +420,103 @@ export function WorkItemDetailPanel({
}}
>
{/* Agent Logs section */}
<div
data-testid={
agentInfo ? "agent-logs-section" : "placeholder-agent-logs"
}
style={{
border: "1px solid #2a2a2a",
borderRadius: "8px",
padding: "10px 12px",
background: "#161616",
}}
>
{!agentInfo && (
<div
data-testid="placeholder-agent-logs"
style={{
display: "flex",
alignItems: "center",
justifyContent: "space-between",
marginBottom: agentInfo ? "6px" : "4px",
border: "1px solid #2a2a2a",
borderRadius: "8px",
padding: "10px 12px",
background: "#161616",
}}
>
<div
style={{
fontWeight: 600,
fontSize: "0.8em",
color: agentInfo ? "#888" : "#555",
color: "#555",
marginBottom: "4px",
}}
>
Agent Logs
</div>
{agentInfo && agentStatus && (
<div
data-testid="agent-status-badge"
style={{
fontSize: "0.7em",
color: STATUS_COLORS[agentStatus],
fontWeight: 600,
}}
>
{agentInfo.agent_name} {agentStatus}
</div>
)}
</div>
{agentInfo && agentLog.length > 0 ? (
<div
data-testid="agent-log-output"
style={{
fontSize: "0.75em",
fontFamily: "monospace",
color: "#ccc",
whiteSpace: "pre-wrap",
wordBreak: "break-word",
lineHeight: "1.5",
maxHeight: "200px",
overflowY: "auto",
}}
>
{agentLog.join("")}
</div>
) : agentInfo ? (
<div style={{ fontSize: "0.75em", color: "#444" }}>
{agentStatus === "running" || agentStatus === "pending"
? "Waiting for output..."
: "No output."}
</div>
) : (
<div style={{ fontSize: "0.75em", color: "#444" }}>
Coming soon
</div>
)}
</div>
</div>
)}
{agentInfo && (
<div
data-testid="agent-logs-section"
style={{
border: "1px solid #2a2a2a",
borderRadius: "8px",
padding: "10px 12px",
background: "#161616",
}}
>
<div
style={{
display: "flex",
alignItems: "center",
justifyContent: "space-between",
marginBottom: "6px",
}}
>
<div
style={{
fontWeight: 600,
fontSize: "0.8em",
color: "#888",
}}
>
Agent Logs
</div>
{agentStatus && (
<div
data-testid="agent-status-badge"
style={{
fontSize: "0.7em",
color: STATUS_COLORS[agentStatus],
fontWeight: 600,
}}
>
{agentInfo.agent_name} {agentStatus}
</div>
)}
</div>
{agentLog.length > 0 ? (
<div
data-testid="agent-log-output"
style={{
fontSize: "0.75em",
fontFamily: "monospace",
color: "#ccc",
whiteSpace: "pre-wrap",
wordBreak: "break-word",
lineHeight: "1.5",
maxHeight: "200px",
overflowY: "auto",
}}
>
{agentLog.join("")}
</div>
) : (
<div style={{ fontSize: "0.75em", color: "#444" }}>
{agentStatus === "running" || agentStatus === "pending"
? "Waiting for output..."
: "No output."}
</div>
)}
</div>
)}
{/* Placeholder sections for future content */}
{(
[
{ id: "coverage", label: "Coverage" },
] as { id: string; label: string }[]
[{ id: "coverage", label: "Coverage" }] as {
id: string;
label: string;
}[]
).map(({ id, label }) => (
<div
key={id}

View File

@@ -16,8 +16,25 @@ export default defineConfig(() => {
"/api": {
target: `http://127.0.0.1:${String(backendPort)}`,
timeout: 120000,
configure: (proxy) => {
proxy.on("error", (_err) => {
// Swallow proxy errors (e.g. ECONNREFUSED during backend restart)
// so the vite dev server doesn't crash.
});
},
},
},
watch: {
ignored: [
"**/.story_kit/**",
"**/target/**",
"**/.git/**",
"**/server/**",
"**/Cargo.*",
"**/vendor/**",
"**/node_modules/**",
],
},
},
build: {
outDir: "dist",

6
package-lock.json generated Normal file
View File

@@ -0,0 +1,6 @@
{
"name": "story-kit",
"lockfileVersion": 3,
"requires": true,
"packages": {}
}

View File

@@ -71,20 +71,93 @@ ls -lh "${DIST}"/
echo "==> Generating changelog..."
PREV_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
if [ -n "$PREV_TAG" ]; then
CHANGELOG=$(git log "${PREV_TAG}..HEAD" --pretty=format:"- %s" --no-merges)
LOG_RANGE="${PREV_TAG}..HEAD"
RANGE="${PREV_TAG}...${TAG}"
else
CHANGELOG=$(git log --pretty=format:"- %s" --no-merges)
LOG_RANGE=""
RANGE="initial...${TAG}"
fi
if [ -z "$CHANGELOG" ]; then
CHANGELOG="- No changes since last release"
# Extract completed stories/bugs/refactors from "story-kit: merge <id>" commits.
# Deduplicate (a story may have been merged more than once after reverts).
if [ -n "$LOG_RANGE" ]; then
MERGED_RAW=$(git log "$LOG_RANGE" --pretty=format:"%s" --no-merges \
| grep "^story-kit: merge " | sed 's/^story-kit: merge //' | sort -u)
else
MERGED_RAW=$(git log --pretty=format:"%s" --no-merges \
| grep "^story-kit: merge " | sed 's/^story-kit: merge //' | sort -u)
fi
RELEASE_BODY="## What's Changed
# Categorise merged work items and format names.
FEATURES=""
FIXES=""
REFACTORS=""
while IFS= read -r item; do
[ -z "$item" ] && continue
# Strip the numeric prefix and type to get the human name.
name=$(echo "$item" | sed -E 's/^[0-9]+_(story|bug|refactor|spike)_//' | tr '_' ' ')
# Capitalise first letter.
name="$(echo "${name:0:1}" | tr '[:lower:]' '[:upper:]')${name:1}"
case "$item" in
*_bug_*) FIXES="${FIXES}- ${name}\n" ;;
*_refactor_*) REFACTORS="${REFACTORS}- ${name}\n" ;;
*) FEATURES="${FEATURES}- ${name}\n" ;;
esac
done <<< "$MERGED_RAW"
${CHANGELOG}
# Collect non-automation manual commits (direct fixes, version bumps, etc).
if [ -n "$LOG_RANGE" ]; then
MANUAL=$(git log "$LOG_RANGE" --pretty=format:"%s" --no-merges \
| grep -v "^story-kit: " \
| grep -v "^Revert \"story-kit: " \
| grep -v "^Bump version" \
| sed 's/^/- /')
else
MANUAL=$(git log --pretty=format:"%s" --no-merges \
| grep -v "^story-kit: " \
| grep -v "^Revert \"story-kit: " \
| grep -v "^Bump version" \
| sed 's/^/- /')
fi
# Assemble the release body.
RELEASE_BODY="## What's Changed"
if [ -n "$FEATURES" ]; then
RELEASE_BODY="${RELEASE_BODY}
### Features
$(echo -e "$FEATURES")"
fi
if [ -n "$FIXES" ]; then
RELEASE_BODY="${RELEASE_BODY}
### Bug Fixes
$(echo -e "$FIXES")"
fi
if [ -n "$REFACTORS" ]; then
RELEASE_BODY="${RELEASE_BODY}
### Refactors
$(echo -e "$REFACTORS")"
fi
if [ -n "$MANUAL" ]; then
RELEASE_BODY="${RELEASE_BODY}
### Other Changes
${MANUAL}"
fi
if [ -z "$FEATURES" ] && [ -z "$FIXES" ] && [ -z "$REFACTORS" ] && [ -z "$MANUAL" ]; then
RELEASE_BODY="${RELEASE_BODY}
- No changes since last release"
fi
RELEASE_BODY="${RELEASE_BODY}
**Full diff:** ${GITEA_URL}/${REPO}/compare/${RANGE}"

View File

@@ -8,8 +8,16 @@ echo "=== Running Rust tests ==="
cargo test --manifest-path "$PROJECT_ROOT/Cargo.toml"
echo "=== Running frontend unit tests ==="
cd "$PROJECT_ROOT/frontend"
pnpm test
if [ -d "$PROJECT_ROOT/frontend" ]; then
cd "$PROJECT_ROOT/frontend"
npm test
else
echo "Skipping frontend tests (no frontend directory)"
fi
echo "=== Running e2e tests ==="
pnpm test:e2e
# Disabled: e2e tests may be causing merge pipeline hangs (no running server
# in merge workspace → Playwright blocks indefinitely). Re-enable once confirmed.
# Disabled: e2e tests cause merge pipeline hangs (no running server
# in merge workspace → Playwright blocks indefinitely).
# echo "=== Running e2e tests ==="
# npm run test:e2e

View File

@@ -64,7 +64,7 @@ echo "=== Running frontend tests with coverage ==="
FRONTEND_DIR="$PROJECT_ROOT/frontend"
FRONTEND_LINE_COV=0
if [ -d "$FRONTEND_DIR" ]; then
FRONTEND_REPORT=$(cd "$FRONTEND_DIR" && pnpm run test:coverage 2>&1) || true
FRONTEND_REPORT=$(cd "$FRONTEND_DIR" && npm run test:coverage 2>&1) || true
echo "$FRONTEND_REPORT"
# Parse "All files" line from vitest coverage text table.

1
serve Submodule

Submodule serve added at 1ec5c08ae7

View File

@@ -1,6 +1,6 @@
[package]
name = "story-kit"
version = "0.1.0"
version = "0.3.1"
edition = "2024"
build = "build.rs"
@@ -31,6 +31,10 @@ walkdir = { workspace = true }
matrix-sdk = { workspace = true }
pulldown-cmark = { workspace = true }
# Force bundled SQLite so static musl builds don't need a system libsqlite3
libsqlite3-sys = { version = "0.35.0", features = ["bundled"] }
wait-timeout = "0.2.1"
[dev-dependencies]
tempfile = { workspace = true }
tokio-tungstenite = { workspace = true }

Some files were not shown because too many files have changed in this diff Show More