feat(ws0+ws2+ws4): Sea Haven plugin scaffold + Slack /new-task + auto-delegate hook #46

Merged
amoussa1229 merged 2 commits from feat/ws0-plugin-slack-intake-autodelegate into main 2026-06-23 19:48:30 +00:00
amoussa1229 commented 2026-06-23 01:39:43 +00:00 (Migrated from github.com)

Summary

  • sea-haven-claude-plugin/CLAUDE.md (WS0): Claude Code context file for Sea Haven sessions — pipeline overview, development rules, /new-task and /delegate usage guide, phase reference table.

  • sea-haven-claude-plugin/settings.template.json (WS0): Template .claude/settings.json wiring the UserPromptSubmit hook. Copy to ~/.claude/settings.json (or merge) and set SEA_HAVEN_PLUGIN_DIR to activate.

  • sea-haven-claude-plugin/hooks/user_prompt_submit.py (WS4): UserPromptSubmit Claude Code hook. Prompts prefixed with /delegate or DELEGATE: are forwarded to POST /tasks on the agent-team HTTP API (WS1) and blocked — the task runs in the pipeline; Claude doesn't answer locally. Graceful on missing token, HTTP errors, and network failures (shows a human-readable block reason). run() is a pure function; tests inject a fake _call_api.

  • agent_team/transport/slack_listener.py (WS2): Add NewTaskCallback type alias + new_task_callback injected param to SlackListener. A /new-task <description> slash command from an allowlisted owner calls new_task_callback(text, "slack") after AUTHZ-01 and before the answer path — so new-task commands are never misrouted as answers. Callback exception is caught (listen loop stays alive).

All 1066 tests passing. ruff check clean.

Test plan

  • cd agent-team && python3 -m pytest -q → 1066 passed, 0 failed
  • python3 -m ruff check . → all checks passed
  • Review _is_new_task_command + _handle_new_task_command in slack_listener.py
  • Review run() in hooks/user_prompt_submit.py (all delegate/error paths)
  • Review CLAUDE.md content accuracy

OUTSTANDING (attended — do NOT merge until done)

  • Wire new_task_callback in run-team.py: at serve startup, inject new_task_callback=coordinator.start_task into SlackListener (via default_slack_listener_factory or the listener factory). Currently the default SlackListener has new_task_callback=None (ignores /new-task).

  • Install the plugin on the Mac: copy sea-haven-claude-plugin/settings.template.json to ~/.claude/settings.json (or merge the hooks section), then set SEA_HAVEN_PLUGIN_DIR to the path of sea-haven-claude-plugin/ in the shell env or .envrc.

  • Provision AGENT_TEAM_API_TOKEN: export the token that run-team.py serve prints so the auto-delegate hook can authenticate. Set AGENT_TEAM_API_URL if the API is not at the default http://127.0.0.1:8765.

  • Smoke-test /delegate: start run-team.py serve, then in a Claude Code session type /delegate Add a test file for the new dispatch node. Confirm the hook blocks with a thread_id and the coordinator picks up the task.

  • Smoke-test /new-task in Slack: post /new-task Fix the flaky CI test in #agent-team. Confirm the listener calls start_task and the bot replies with a clarifying question.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QYp761G9HojkmLqLZrASVi


Generated by Claude Code

## Summary - **`sea-haven-claude-plugin/CLAUDE.md`** (WS0): Claude Code context file for Sea Haven sessions — pipeline overview, development rules, `/new-task` and `/delegate` usage guide, phase reference table. - **`sea-haven-claude-plugin/settings.template.json`** (WS0): Template `.claude/settings.json` wiring the `UserPromptSubmit` hook. Copy to `~/.claude/settings.json` (or merge) and set `SEA_HAVEN_PLUGIN_DIR` to activate. - **`sea-haven-claude-plugin/hooks/user_prompt_submit.py`** (WS4): `UserPromptSubmit` Claude Code hook. Prompts prefixed with `/delegate ` or `DELEGATE: ` are forwarded to `POST /tasks` on the agent-team HTTP API (WS1) and blocked — the task runs in the pipeline; Claude doesn't answer locally. Graceful on missing token, HTTP errors, and network failures (shows a human-readable block reason). `run()` is a pure function; tests inject a fake `_call_api`. - **`agent_team/transport/slack_listener.py`** (WS2): Add `NewTaskCallback` type alias + `new_task_callback` injected param to `SlackListener`. A `/new-task <description>` slash command from an allowlisted owner calls `new_task_callback(text, "slack")` after AUTHZ-01 and before the answer path — so new-task commands are never misrouted as answers. Callback exception is caught (listen loop stays alive). All 1066 tests passing. `ruff check` clean. ## Test plan - [ ] `cd agent-team && python3 -m pytest -q` → 1066 passed, 0 failed - [ ] `python3 -m ruff check .` → all checks passed - [ ] Review `_is_new_task_command` + `_handle_new_task_command` in `slack_listener.py` - [ ] Review `run()` in `hooks/user_prompt_submit.py` (all delegate/error paths) - [ ] Review `CLAUDE.md` content accuracy ## OUTSTANDING (attended — do NOT merge until done) - [ ] **Wire `new_task_callback` in `run-team.py`**: at serve startup, inject `new_task_callback=coordinator.start_task` into `SlackListener` (via `default_slack_listener_factory` or the listener factory). Currently the default `SlackListener` has `new_task_callback=None` (ignores `/new-task`). - [ ] **Install the plugin on the Mac**: copy `sea-haven-claude-plugin/settings.template.json` to `~/.claude/settings.json` (or merge the `hooks` section), then set `SEA_HAVEN_PLUGIN_DIR` to the path of `sea-haven-claude-plugin/` in the shell env or `.envrc`. - [ ] **Provision `AGENT_TEAM_API_TOKEN`**: export the token that `run-team.py serve` prints so the auto-delegate hook can authenticate. Set `AGENT_TEAM_API_URL` if the API is not at the default `http://127.0.0.1:8765`. - [ ] **Smoke-test `/delegate`**: start `run-team.py serve`, then in a Claude Code session type `/delegate Add a test file for the new dispatch node`. Confirm the hook blocks with a `thread_id` and the coordinator picks up the task. - [ ] **Smoke-test `/new-task` in Slack**: post `/new-task Fix the flaky CI test` in `#agent-team`. Confirm the listener calls `start_task` and the bot replies with a clarifying question. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01QYp761G9HojkmLqLZrASVi --- _Generated by [Claude Code](https://claude.ai/code/session_01QYp761G9HojkmLqLZrASVi)_
This repo is archived. You cannot comment on pull requests.
No description provided.