Skip to content

feat(chief-tools): dynamic project-chief spawn/monitor/terminate (POC Phase 0+1)#9

Merged
nnnet merged 2 commits into
prodfrom
feat/dynamic-chief-spawn
May 19, 2026
Merged

feat(chief-tools): dynamic project-chief spawn/monitor/terminate (POC Phase 0+1)#9
nnnet merged 2 commits into
prodfrom
feat/dynamic-chief-spawn

Conversation

@nnnet

@nnnet nnnet commented May 19, 2026

Copy link
Copy Markdown
Owner

Summary

POC for dynamic project-chief spawn. Implements 4 MCP tools that let
main:manager (or another chief) create an isolated kanban board +
worker for a complex/long-running project, monitor its state, and
terminate it on demand.

Design reference: plans/dynamic-chief-spawn-and-lifecycle.md

Architecture

   human ──voice──▶  Hermes main:manager
                          │ chief_spawn(brief)
                          ▼
                     Chief (own kanban board + worker process)
                          │
                          ├─ kanban_create — sub-tasks on own board
                          ├─ chief_spawn — sub-chief (separate board)
                          └─ kanban_comment — progress reports

Lifecycle policy (cascade | independent) fixed at spawn, stored in
board.json.meta_extra. Cascade implemented; independent is Phase 2 (NYI).

Tools

Tool Caller Effect
chief_spawn main + chief Creates board + initial ready task with assignee=chief-manager
chief_status main + chief Aggregates one chief's board (subtasks_open, stage, last_event)
chief_list main only All live chiefs across boards
chief_terminate main + chief Cascade: recurse into sub-chiefs; independent: NYI

Files

  • tools/chief_tools.py (+695) — all four MCP tools + slugify/lifecycle helpers
  • skills/devops/chief-manager/SKILL.md (+132) — behaviour contract for the chief worker
  • hermes_cli/kanban_db.py (+21) — meta_extra support for board metadata
  • tests/tools/test_chief_tools.py (+286) — unit-test all four tools, lifecycle paths, gating
  • tests/tools/test_kanban_tools.py (+12) — bump profile count 33 → 34 for new tool

+1144 / −2 LoC, 5 files.

Test plan

  • pytest tests/tools/test_chief_tools.py tests/tools/test_kanban_tools.py -v -o "addopts="85 passed in 7.15s
  • Live test in prod after merge: chief_spawn(brief='small test project') from main:manager session, verify board+task created, dispatcher spawns worker, worker loads chief-manager skill.

Architecture note — relation to MC (Mission Control)

This PR introduces chief-spawn as a Hermes-INTERNAL orchestration primitive.
A follow-up PR will add an mc_pipeline_run tool so a chief (or main:manager)
can delegate heavy workflows to an external Mission Control backend when the
in-Hermes path isn't enough — see _runtime-notes/merge-and-integration-plan.md
for the full Hermes ↔ MC integration roadmap. The two systems are
complementary, not competing: chief = light-weight in-Hermes coordination;
MC = multi-framework execution engine with dashboard.

Rollback

Revert this PR. New tools are additive; existing tools unchanged.

🤖 Generated with Claude Code

nnnet added 2 commits May 18, 2026 01:47
…, Phase 0+1)

Adds 4 new MCP tools for main:manager to delegate complex tasks to
dynamically-spawned chief sub-agents:

  - chief_spawn(name, brief, lifetime, terminate_policy)
      Creates an isolated kanban board + ready initial task assigned to
      'chief-manager'. Dispatcher's per-board tick spawns a worker that
      loads the chief-manager skill and owns the project end-to-end.

  - chief_status(chief_id)
      Aggregates the chief's board into a Main-friendly summary (alive,
      stage, subtask counts, last comment, runtime). Designed for
      periodic polling by main:manager without diving into ops detail.

  - chief_list(include_archived)
      Enumerates all chief boards on the host (filter: board.json has
      kind=chief). Shows parent_chief_id links so Main can see the tree.

  - chief_terminate(chief_id, force)
      Cascade policy: recursively archives every sub-chief that lists
      this chief as parent_chief_id. Independent policy returns NYI
      (Phase 2). Optional force=true SIGTERMs running workers.

Architecture & lifecycle policies documented in
plans/dynamic-chief-spawn-and-lifecycle.md (in nnnet/AiManager).

Foundational changes in kanban_db.create_board / write_board_metadata:
adds meta_extra kwarg so chief metadata (kind, lifetime, parent_chief_id,
spawned_at, terminate_policy) can be persisted in board.json without
schema migration. Reserved keys (slug, db_path) cannot be overridden.

Skill: skills/devops/chief-manager/SKILL.md — defines worker behavior:
orient → decompose → monitor → heartbeat → complete pattern, what NOT
to do (no direct user communication, no recursion past depth 3), digest
shape for progress comments.

Tests: 14 new in tests/tools/test_chief_tools.py — spawn validation,
status aggregation, list filtering, cascade termination, recursion
depth guard, independent NYI rejection.

Note: the multi_board_env fixture in test_kanban_tools.py needed
kb.create_board('alt') explicit call — connect()'s no-resurrect guard
(from earlier fix/kanban-delete-active-board branch) refuses implicit
mkdir for non-default boards.

Phase 2-5 (independent policy, GC daemon, dashboard widget, etc) — see
the plan doc.

POC verification (manual, not deployed): all 167 tests in
tests/tools/test_kanban_tools.py + tests/tools/test_chief_tools.py +
tests/hermes_cli/test_kanban_db.py pass.
# Conflicts:
#	tests/tools/test_kanban_tools.py
@nnnet nnnet merged commit 67af162 into prod May 19, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant