This repository has been archived on 2026-08-04. You can view files and clone it, but cannot push or open issues or pull requests.
orchestrator/sea-haven-claude-plugin/CLAUDE.md
Claude 2aa72d73f4
feat(ws0+ws2+ws4): plugin scaffold, Slack /new-task, auto-delegate hook
WS0 — sea-haven-claude-plugin/ scaffold:
  - CLAUDE.md: Sea Haven engineering context (pipeline overview, rules,
    /new-task + /delegate usage, available phases)
  - settings.template.json: UserPromptSubmit hook wiring template
  - hooks/user_prompt_submit.py: standalone script (WS4)

WS2 — SlackListener /new-task intake:
  - Add NewTaskCallback type alias (Callable[[str, str], str])
  - Add new_task_callback param to SlackListener.__init__
  - _is_new_task_command() helper for slash_commands+/new-task detection
  - _handle_new_task_command() method: authorized-only, calls callback,
    exception-safe (listen loop stays alive on callback errors)
  - handle_event() routes /new-task BEFORE the answer path (post-AUTHZ-01)

WS4 — UserPromptSubmit auto-delegate hook:
  - /delegate <text> and DELEGATE: <text> prefixes trigger delegation
  - Calls POST /tasks on the agent-team HTTP API (WS1)
  - Blocks the Claude Code prompt; shows thread_id + next-steps message
  - Graceful degradation: missing token, HTTP error, network error all
    produce a block with a human-readable reason
  - run() is a pure function for testability (no stdin/stdout in tests)

Tests: 22 new tests in test_ws0_ws2_ws4_plugin_slack_hook.py.
Full suite: 1066 passed. ruff clean.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QYp761G9HojkmLqLZrASVi
2026-06-23 01:39:12 +00:00

76 lines
3.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Sea Haven Industries — Claude Code Engineering Plugin
This directory is the **Sea Haven Claude Code plugin**: context and hooks for
Claude Code sessions run against the `sea-haven-industries/orchestrator` repo.
Copy `settings.template.json` into `~/.claude/settings.json` (or merge it into
an existing one) to activate the hooks.
---
## Project overview
The orchestrator is the R720-hosted Plane-2 SDLC pipeline. It runs a
multi-model multi-agent loop — **Claude Sonnet** (coordinator/clarifier/planner),
**GPT-4.1** (cross-reviewer), **DeepSeek** (fast_coder/builder), **Gemini**
(scanner) — gated by a CI trust boundary (`agent-team-apply-verify.yml`).
Key directories:
| Path | Purpose |
|------|---------|
| `agent-team/` | The pipeline package (`agent_team.*`) + tests |
| `agent-team/run-team.py` | CLI: `serve`, `start`, `answer` sub-commands |
| `agent-team/agent_team/coordinator.py` | Keystone: graph + transport wiring |
| `agent-team/agent_team/graph.py` | LangGraph state machine (P1–P3+) |
| `agent-team/agent_team/nodes/` | Pipeline node implementations |
| `agent-team/agent_team/transport/` | Slack / GitHub / Claude Code adapters |
| `.github/workflows/agent-team-apply-verify.yml` | CI trust boundary (NEVER edit directly; use a WS PR) |
| `sea-haven-claude-plugin/` | This plugin |
## Development rules
1. **Green before merge**: `cd agent-team && python3 -m ruff check . && python3 -m pytest -q` must pass.
2. **No secrets in code**: all tokens go in env vars or GitHub secrets.
3. **No SSH/AWS/infra commands**: the R720 box is VPN-only; never attempt network access from a Claude Code session.
4. **Draft PRs only**: all automated changes go out as `--draft`; humans merge.
5. **CI YAML edits** require a security review (`/sh-security-review`) and a separate WS PR — never inline.
## Delegating tasks to the pipeline
### Via Slack
Post `/new-task <description>` in any channel the Sea Haven bot is in. The
listener routes it to the coordinator's `start_task`, which begins the
CLARIFY → PLAN → REVIEW → BUILD → VERIFY pipeline. You'll receive a clarifier
question back in Slack.
### Via this Claude Code session (auto-delegate hook)
Prefix your prompt with `/delegate ` (or `DELEGATE: `) to auto-send the task
to the pipeline HTTP API instead of answering it locally:
```
/delegate Add OAuth2 to the admin portal — use PKCE, no client secret stored
```
The hook calls `POST http://127.0.0.1:8765/tasks` (requires
`AGENT_TEAM_API_TOKEN` env var) and returns the `thread_id` so you can track
the task in the coordinator.
Set `AGENT_TEAM_API_URL` to override the default `http://127.0.0.1:8765`.
Set `AGENT_TEAM_API_TOKEN` to the bearer token from `run-team.py serve`.
## Available slash commands
These are defined in `settings.template.json` (copy to `~/.claude/settings.json`):
| Command | Effect |
|---------|--------|
| _(hooks auto-detect `/delegate` prefix)_ | Auto-delegate to pipeline |
## Phases
- **P1**: INTAKE → CLARIFY (human gate) → PLAN
- **P2**: + adversarial REVIEW loop (GPT-4.1 cross-reviewer)
- **P3**: + BUILD (DeepSeek) → VERIFY (CI gate)
- **P3+**: + DISPATCH (push head branch + trigger `workflow_dispatch`)