Metadata-Version: 2.4
Name: horo-teamkit
Version: 0.2.1
Summary: Run a team of Hermes profiles on one kanban board, with a harness-run completion gate, anti-silencing, strategy checkpoints and audit.
Author: istale
License-Expression: MIT
Project-URL: Repository, https://github.com/iscodesnippet2/horo-teamkit
Keywords: hermes,agents,kanban,multi-agent,quality-gate
Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX :: Linux
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# horo-teamkit

[繁體中文](https://github.com/iscodesnippet2/horo-teamkit/blob/main/README.zh-TW.md)

Run a team of [horo-next](https://pypi.org/project/horo-next/) (Hermes) profiles on one kanban board — and make the harness, not the model, decide when work is done.

> Agents may explain a failure. They may not explain it away.
> The system must notice when the current approach has stopped working.

horo-teamkit is a horo-next plugin (horo-next 0.23.x only). It sets up roles, routes reviews, escalates stuck work to an owner, and adds deterministic controls that a model cannot talk its way past:

- **Completion gate** — `kanban_request_review` and `kanban_complete` run your checks (lint, types, tests) in the card's workspace first. A failing check blocks the call and hands back the output plus a failure fingerprint.
- **Anti-silencing** — relative to a recorded base commit, new `# noqa` / `type: ignore` / `pytest.mark.skip` markers, edits to check config files, or fewer test functions are blocked unless the owner waives that card.
- **Strategy checkpoint** — when the same command failure (same fingerprint) repeats 3 times on one card or session, the agent is told to change hypothesis or stop and report, and the owner gets a card. At 6, `terminal` is paused for that card until it is blocked or the owner decides. Works in kanban workers and in `hermes -z` oneshot sessions.
- **`teamkit audit`** — a read-only replay: did every done card pass the gate before completion, has the check list changed since, does it still pass now?

What it does **not** do, and what we could and could not measure, is in [BENCHMARK.md](https://github.com/iscodesnippet2/horo-teamkit/blob/main/BENCHMARK.md). Short version: on our local-model benchmark the baseline team did not make the mistakes these controls target, so we have no before/after evidence that teamkit improves outcomes — only tests showing the controls fire.

## Install

```bash
pip install horo-teamkit            # same environment as horo-next; no dependencies, does not touch horo-next
hermes plugins enable teamkit       # enable in the default home so `hermes teamkit` appears
hermes teamkit init --board dev --preset trio --prefix dev- --workdir ~/proj \
  --check "ruff check ." --check "python3 -m pytest -q"          # prints the plan
hermes teamkit init ... --yes                                     # applies it
```

- Do not install with `pip install -e` or from `~/Documents`, `~/Desktop`, `~/Downloads` on macOS: a launchd gateway cannot read those folders and the plugin silently fails to load (`No module named 'hermes_teamkit'` in the log).
- **Restart the gateway after installing or upgrading.** Workers — and `hermes -z` sessions, which run inside the gateway — keep the plugin version the gateway loaded at startup.

`init` only prints a plan unless you pass `--yes`. It creates the board, one profile per role with a SOUL.md (existing SOULs are kept unless `--force-soul`), sets each profile's `agent.max_turns=250`, `approvals.single_query_mode=deny`, memory on, teamkit enabled, enables teamkit in the default home (skip with `--no-default-home`), and writes the board's `teamkit.yaml`. Every overwritten file is backed up as `*.bak-teamkit-<time>`. Re-running `init` only fills in what is missing.

Then:

1. Give each profile its own `model`, `fallback_providers` and `.env` (profiles do not read the default home's `.env`).
2. `hermes teamkit doctor --board dev` and fix every FAIL.
3. Run `hermes teamkit tick --board dev` periodically (e.g. cron every 5 minutes); idle wake-ups and crash escalation depend on it.
4. Restart the gateway.

## Presets

| preset | owner | reviewer | other roles |
|---|---|---|---|
| `dev` | orchestrator | reviewer | architect, developer, qa, ops |
| `research` | pi | critic | analyst, engineer, explorer, replicator |
| `trio` | planner | verifier | coder |

Add roles with `hermes teamkit add-role --board dev --name dev-coder-b --like coder --yes` (`--creator` lets the role open cards; there is exactly one owner per board).

## Enforced rules

Only in processes where teamkit is enabled.

| Rule | How |
|---|---|
| Reviews go to the reviewer | `kanban_request_review` without a reviewer gets `teamkit.yaml`'s reviewer |
| Only the owner and `card_creators` open cards | others' `kanban_create` is blocked; they propose cards in `metadata.proposed_cards` |
| Cards use the template | with `require_template: true`, `kanban_create` is blocked in favour of `teamkit_open_card` |
| No direct commits to protected branches | `git commit` in a `terminal` command on a branch in `protected_branches` is blocked |
| Blocked cards escalate to the owner | `kanban_task_blocked` opens (or comments on) an owner card |
| Crashed workers escalate | `tick` opens an owner card for cards stopped after crashed / gave_up / timed_out |
| Idle boards wake the owner | `tick` opens one owner card per idle period longer than `idle_seconds` |
| Completion passes the gate | with `checks` set, review and complete run them first |
| Checks cannot be loosened | with `gate_base` set, silencing markers, check-config edits and test removal are blocked; owner waives via `gate_waivers` |
| The same failure is not retried forever | `checkpoint_repeats` (default 3): notice + owner card; at twice that, `terminal` pauses |

## Gate and audit

```bash
hermes teamkit init --board dev --check "ruff check ." --check "python3 -m pytest -q" --workdir ~/proj --yes
hermes teamkit audit --board dev            # exit 1 if anything is off; --no-rerun to only read records
```

- Checks run in order (put fast ones first) via the shell in `HERMES_KANBAN_WORKSPACE` — only list commands you trust. With a git `--workdir`, the current HEAD is recorded as `gate_base`.
- Every decision is appended to the board's `teamkit-events.jsonl` (`gate_pass`, `gate_fail`, `gate_silenced`, `command_fail`, `checkpoint`).
- The gate guarantees evidence exists, not that it is sufficient: code that passes its own tests but breaks the spec still passes. That still needs a reviewer reading the spec.

## Tools, UI, review

- `teamkit_open_card` (five-section cards), `teamkit_ledger_add` / `teamkit_ledger_query` (research ledger with sha256-pinned evidence; the replicator may not be the author), `teamkit_status`.
- `hermes teamkit ui --board dev` serves a local dashboard (team overview, SOUL editor, 360° review). `hermes teamkit review start|show|apply` runs a review cycle where every comment must cite a card, objective numbers flag inconsistencies, and SOUL edits are proposed line by line, never applied automatically.

## Skills

Read with `skill_view("teamkit:<name>")`: `card-writing`, `owner-ops`, `research-gates`. Optional, off by default, adapted from [obra/superpowers](https://github.com/obra/superpowers) (MIT): `verify-before-done` and `card-plans` — `hermes teamkit superpowers on --board dev --yes`.

## Limits

- Rules apply only inside processes with teamkit enabled; humans and other profiles are not constrained. `doctor` lists profiles without it.
- Commit detection only sees `git commit` in `terminal` commands.
- The strategy checkpoint fingerprints the last lines of a failing command with digits masked. A different command hitting the same wall counts separately, and a different bad idea that fails differently is not caught.
- A Hermes bug can leave a card stuck in review after rate limiting; `status` lists such cards, fix with `reassign <id> none` then `reassign <id> <reviewer>`.

## Development

```bash
pip install -e . pytest      # outside the macOS-protected folders above if a gateway must load it
python -m pytest
```

Benchmark kit and protocol: [`benchmark/`](https://github.com/iscodesnippet2/horo-teamkit/tree/main/benchmark). Release process and trust model: [SECURITY.md](https://github.com/iscodesnippet2/horo-teamkit/blob/main/SECURITY.md) and [README.zh-TW.md](https://github.com/iscodesnippet2/horo-teamkit/blob/main/README.zh-TW.md#發佈).
