Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ All notable user-visible changes to the TMB plugin. Versions follow [SemVer](htt

## Unreleased

### Refactored β€” all plugin-shipped skills now use `tmb_` prefix

The 7 default workflow skills (`code-quality`, `docs-conventions`, `git-conventions`, `naming-conventions`, `review-findings`, `review-protocol`, `swe-checklist`) were the only plugin-shipped skills without the `tmb_` namespace prefix β€” an inconsistency with the rule "global plugin skills use `tmb_`; the open namespace is reserved for user/`tmb_skill-creator`-generated project-local skills." Renamed to `tmb_code-quality`, `tmb_docs-conventions`, …

**Why it matters**: collision-free open namespace. Previously, if a user asked bro to create a `git-conventions` skill, it could collide with the plugin default. Now the open namespace is exclusively user-owned and the plugin-shipped namespace is fully claimed by `tmb_*`.

**Override semantics unchanged**: a project-local `<project>/.claude/skills/tmb_git-conventions/SKILL.md` still shadows the plugin's by name resolution. The "reservation" was always a social/lint convention, never a CC-enforced lock.

**Refs updated**: `agents/swe.md`, `docs/AGENTS.md`, `docs/architecture/FILES.md`, `docs/architecture/FLOWS.md`, and 6 cross-referencing SKILL.md files. `CHANGELOG.md` history entries left intact (accurate records of the un-prefixed era).

### Added β€” activation-routine UserPromptSubmit hook (#108)

Bro's activation routine (`identity_get` + `issue_resume` on every triggered message) is now fired deterministically by `scripts/hooks/activation-routine.sh` instead of relying on prompt discipline. The h4 A/B (5 paired runs Γ— 2 wording arms) showed prompt compliance was 0/10 in *both* arms β€” the strongest possible imperative ("MANDATORY on every triggered message") still didn't move the needle. With prompt-only enforcement structurally unreliable for high-frequency operations, the only honest fix is to wire it into code.
Expand Down
27 changes: 16 additions & 11 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,22 @@ Single Human entry point, planner, and task gate. You discuss, design the implem

## Before answering β€” verify context

**Don't guess. Don't fabricate. Don't be a yes-man.** Before you plan, decide, or answer a substantive question, run two checks:

1. **Context check** β€” *do I have enough?* The trajectory DB is this project's source of truth for plugin state (`file_registry`, `ledger`, `discussions`, `tasks`, plus the auto-regenerated `docs/architecture/`). Query it FIRST via MCP tools. Then branch by state:
- **Git clean** β†’ trust the trajectory DB's `file_registry` index. Don't ad-hoc-browse the codebase.
- **Git dirty** β†’ diff against the trajectory DB index; reach for `Read` / `Glob` / `Grep` only on the changed files.
- **After you Read a file for context** (#45) β†’ if its `summary` was null, follow with `file_registry_update_summaries(updates=[{path, summary: '<your fresh 1–3 sentence summary>'}])`. Costs ~5ms; the summary you'd think anyway. Keeps the index alive without an upfront scan.
- **First-time onboarding to an existing repo** OR **right after finishing system design of a new project** β†’ run `tmb_project-prescan` (then `tmb_refresh-architecture` if architecture docs need regeneration) to populate / refresh the index. Don't ad-hoc this either β€” the scan skill is the canonical way.
- **Upstream specs / external standards / library docs** β†’ web (`WebFetch` / `WebSearch`).
- **Training-data fallback** β€” last resort, flag it as such.
If context is thin after the lookup, **say so** and ask the Human. Thin context β†’ *"I'm not sure, checking…"* beats inventing.
2. **Standards check** β€” *is what I'm about to recommend the industry standard or the best way?* If you're not sure, do the lookup. If a domain expert (legal, security, perf, etc.) would handle it better than bro, propose `tmb_agent-creator` to spawn the specialist. Bro should be professional and competent across general SWE work; for genuinely specialized domains, escalate.
**Don't guess. Don't fabricate. Don't be a yes-man.** Two checks before any substantive answer:

1. **Context check** β€” *do I have enough?* The trajectory DB is the source of truth (`file_registry`, `ledger`, `discussions`, `tasks`, plus auto-regenerated `docs/architecture/`). Query it FIRST. Pick the source by state:

| Situation | Where to look |
|---|---|
| Git clean | Trust the trajectory DB's `file_registry` index. No ad-hoc browsing. |
| Git dirty | Diff against `file_registry`; `Read` / `Glob` / `Grep` only the changed files. |
| After you Read a file for context | If its `summary` was null, follow with `file_registry_update_summaries(updates=[{path, summary: '...'}])`. ~5ms; keeps the index alive. |
| First-time onboarding to an existing repo, or right after system-design of a new project | `tmb_project-prescan` (then `tmb_refresh-architecture` if arch docs need regen). Canonical scan path β€” don't ad-hoc. |
| Upstream specs / external standards / library docs | `WebFetch` / `WebSearch` |
| Training-data fallback | Last resort. Flag it. |

If context is thin after the lookup, **say so** and ask. *"I'm not sure, checking…"* beats inventing.

2. **Standards check** β€” *is this the industry standard or the best way?* If unsure, look it up. If a domain expert (legal, security, perf, etc.) would handle it better than bro, propose `tmb_agent-creator` to spawn the specialist.

When you're guessing, label it. Cite the source when relevant.

Expand Down
2 changes: 1 addition & 1 deletion agents/swe.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ Atomic close (#W4): batch in one response β€” commit (using the spec's `## Commi

Never push. Never commit secrets. Never edit outside the worktree. Never author the spec body β€” that's bro's role and the server enforces it. **Never attempt to bypass a PreToolUse hook block** β€” do not rewrite `.git/HEAD`, fabricate refs, edit `.git/` internals, or use any technique to evade a hook decision. If a hook blocks a legitimate operation, that's a plugin bug β€” STOP immediately, return the failure summary to bro with the exact hook output, and let bro decide the path forward. Bypass attempts trip CC's security guards and erode the doctrine these hooks exist to enforce.

If you need a stack-specific verification checklist, invoke the project's `swe-checklist` skill via the Skill tool **only when the spec's `## Verification` section needs interpretation** β€” not by default. Stack-specific style/pattern rules come from skills the project attaches to this agent's `skills:` list β€” never edit this file.
If you need a stack-specific verification checklist, invoke the project's `tmb_swe-checklist` skill via the Skill tool **only when the spec's `## Verification` section needs interpretation** β€” not by default. Stack-specific style/pattern rules come from skills the project attaches to this agent's `skills:` list β€” never edit this file.

**Do not read project-level `CLAUDE.md`** β€” that file is bro's persona; this agent's prompt is canonical for SWE work.
14 changes: 7 additions & 7 deletions docs/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ Never confuse layers: a "more skilled SWE" means swe.md plus added skills, not a

`skills/` holds both the `tmb_*` protocol skills (immutable, reserved by plugin) AND the default workflow skills used by global agents:

- `swe-checklist`
- `code-quality`
- `docs-conventions`
- `git-conventions`
- `naming-conventions`
- `review-protocol`
- `review-findings`
- `tmb_swe-checklist`
- `tmb_code-quality`
- `tmb_docs-conventions`
- `tmb_git-conventions`
- `tmb_naming-conventions`
- `tmb_review-protocol`
- `tmb_review-findings`

All are globally discoverable. Project-local `<project>/.claude/skills/<name>/SKILL.md` overrides by name. Onboarding does NOT copy skills into projects β€” the global ones serve every project until a customization is needed.
14 changes: 7 additions & 7 deletions docs/architecture/FILES.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ plugin/
β”‚ β”œβ”€β”€ tmb_skill-creator/ # propose & write new skill files; appends to consuming agent's skills:
β”‚ β”œβ”€β”€ tmb_swe-spawn-workflow/ # bro's protocol for spawning SWE with task_id + spec
β”‚ β”œβ”€β”€ # Default workflow skills (used by global agents; project overrides per-name)
β”‚ β”œβ”€β”€ code-quality/ # generic quality gates (error handling, security, edges)
β”‚ β”œβ”€β”€ docs-conventions/ # docs-update rules + prompt-editing discipline
β”‚ β”œβ”€β”€ git-conventions/ # emoji-prefixed commits, branch naming
β”‚ β”œβ”€β”€ naming-conventions/ # file/variable/test naming rules
β”‚ β”œβ”€β”€ review-findings/ # pr-reviewer output format
β”‚ β”œβ”€β”€ review-protocol/ # pr-reviewer full protocol
β”‚ └── swe-checklist/ # SWE pre-commit checklist (lazy-loaded by SWE on demand)
β”‚ β”œβ”€β”€ tmb_code-quality/ # generic quality gates (error handling, security, edges)
β”‚ β”œβ”€β”€ tmb_docs-conventions/ # docs-update rules + prompt-editing discipline
β”‚ β”œβ”€β”€ tmb_git-conventions/ # emoji-prefixed commits, branch naming
β”‚ β”œβ”€β”€ tmb_naming-conventions/ # file/variable/test naming rules
β”‚ β”œβ”€β”€ tmb_review-findings/ # pr-reviewer output format
β”‚ β”œβ”€β”€ tmb_review-protocol/ # pr-reviewer full protocol
β”‚ └── tmb_swe-checklist/ # SWE pre-commit checklist (lazy-loaded by SWE on demand)
β”‚
β”œβ”€β”€ # Consultant templates (opt-in β€” copied per-project on first request via tmb_agent-creator)
β”œβ”€β”€ templates/
Expand Down
8 changes: 4 additions & 4 deletions docs/architecture/FLOWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
> and are instantiated per-project on demand via `tmb_agent-creator`.
>
> All skills β€” both `tmb_*` protocol skills and the default workflow
> skills (`swe-checklist`, `code-quality`, `docs-conventions`, etc.) β€”
> skills (`tmb_swe-checklist`, `tmb_code-quality`, `tmb_docs-conventions`, etc.) β€”
> live in `plugin/skills/` and are globally discoverable. Project-local
> `<project>/.claude/skills/<name>/SKILL.md` overrides by name.

Expand All @@ -27,11 +27,11 @@ Companion docs: [`ERD.md`](ERD.md) for schema, [`FILES.md`](FILES.md) for the fi
| # | Flow | Trigger | Agents | Key skills | DB tables touched | Hooks |
|---|---|---|---|---|---|---|
| 1 | [First contact](#1-first-contact-defaults-applied-silently) | First activation in a project | bro | (none β€” inline default-write) | `plugin_config`, `ledger` | β€” |
| 2 | [Simple task](#2-simple-task) | Code change, no architecture impact | bro β†’ swe (pr-reviewer at push time only) | `tmb_planning-simple` (bro), `swe-checklist` (lazy on demand) | `issues`, `tasks`, `ledger` (per task) + `validation_attempts` (at push) | `require-task-spec`, `git-push-guard`, `git-guards` |
| 2 | [Simple task](#2-simple-task) | Code change, no architecture impact | bro β†’ swe (pr-reviewer at push time only) | `tmb_planning-simple` (bro), `tmb_swe-checklist` (lazy on demand) | `issues`, `tasks`, `ledger` (per task) + `validation_attempts` (at push) | `require-task-spec`, `git-push-guard`, `git-guards` |
| 3 | [Difficult task](#3-difficult-task) | Code change touching `docs/trustmybot/architecture/` | bro (full discussion + ADR) β†’ swe (pr-reviewer at push time) | + `tmb_planning-difficult` (env probe, Q+A, ADR) | + `discussions`, ADR file | same |
| 4 | [Agent-creator](#4-agent-creator-on-demand-domain-agent) | Routing hits a role not in `.claude/agents/` | bro β†’ human | `tmb_agent-creator` | β€” | β€” |
| 5 | [Skill creation](#5-skill-creation) | Recurring pattern needs encoding | bro | `tmb_skill-creator` | `skills` (optional, for tracking) | β€” |
| 6 | [Push gate / PR review](#6-push-gate--pr-review) | `git push` to protected branch | bro β†’ pr-reviewer (one per unsigned task, parallel) | `review-protocol`, `review-findings`, `code-quality` | `tasks` (read), `validation_attempts` (write), `discussions` (optional FAIL) | `git-push-guard` |
| 6 | [Push gate / PR review](#6-push-gate--pr-review) | `git push` to protected branch | bro β†’ pr-reviewer (one per unsigned task, parallel) | `tmb_review-protocol`, `tmb_review-findings`, `tmb_code-quality` | `tasks` (read), `validation_attempts` (write), `discussions` (optional FAIL) | `git-push-guard` |
| 7 | [Architecture regen](#7-architecture-regen) | First code-touching ask of session OR `/tmb refresh-architecture` | bro | `tmb_refresh-architecture`, `tmb_lazy-regen-check` | `regen_state`, `file_registry` | β€” |
| 8 | [SWE retry / escalation](#8-swe-retry--escalation) | Bro verification or pr-reviewer verdict='fail' | bro ↔ swe (↔ pr-reviewer when at push gate) | `tmb_feedback-loop` | `validation_attempts` (multiple rows), `discussions` | `git-push-guard` |
| 9 | [Roundtable](#9-roundtable-multi-agent-deliberation) | Multi-consultant deliberation | bro orchestrates 2-4 project-local consultants | `tmb_roundtable`, `tmb_roundtable-cleanup` | `discussions`, `ledger` (and reserved: `roundtables`, `roundtable_votes`) | β€” |
Expand Down Expand Up @@ -88,7 +88,7 @@ sequenceDiagram
**Involved:**
- Agents: `bro` (planner + task gate), `swe` (executor)
- Skills loaded by bro on demand: `tmb_planning-simple` or `tmb_planning-difficult` per triage, `tmb_swe-spawn-workflow` (right before SWE handoff)
- Skills loaded by swe: `swe-checklist` **only on demand** (when spec verification needs interpretation; not eager)
- Skills loaded by swe: `tmb_swe-checklist` **only on demand** (when spec verification needs interpretation; not eager)
- MCP tools: `issue_create`, `discussion_append`, `task_create_batch`, `task_get`, `task_update_status`, `ledger_log` (no `validation_record` per task β€” that fires at push time)
- DB tables: `issues`, `tasks`, `discussions`, `ledger`, `audit`
- Hooks: `require-task-spec` (gates SWE spawn), `git-push-guard` (gates `git push`), `git-guards` (commit branch check)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: code-quality
name: tmb_code-quality
description: Shared quality criteria for design, implementation, and review. Used by bro (design-time), SWE (implementation-time), and PR Reviewer (review-time). Covers error handling, edge cases, database safety, Python patterns, test isolation, and the self-review checklist.
---

Expand Down Expand Up @@ -195,4 +195,4 @@ Run before reporting COMPLETED. If any item fails, fix it.

**CRITICAL: Every code change must be tested before reporting COMPLETED.** Untested code is rejected. Lint/build passing is necessary but NOT sufficient β€” you must run the corresponding unit tests and, for behavioral changes, verify the actual runtime behavior. If tests don't exist for the changed code, note that in your report.

> Common review findings: `skills/review-findings/SKILL.md`
> Common review findings: `skills/tmb_review-findings/SKILL.md`
2 changes: 1 addition & 1 deletion skills/tmb_concerns-protocol/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Use when the concern is about HOW the work is being framed β€” scope, ordering,

### Path B β€” Spawn a consultant (technical disagreement)

Use when the concern is technical β€” architecture, security, performance, code-quality β€” and you want an independent read.
Use when the concern is technical β€” architecture, security, performance, tmb_code-quality β€” and you want an independent read.

1. Identify the relevant consultant (`architect`, `cto`, etc.). If absent, invoke `tmb_agent-creator` first.
2. Spawn the consultant with `consultant: analysis-only` marker and the specific question.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: docs-conventions
name: tmb_docs-conventions
description: When and how to update docs alongside code changes, plus the discipline for editing agent prompts and skill files.
agent: bro, swe, pr-reviewer
---
Expand Down
12 changes: 6 additions & 6 deletions skills/tmb_feedback-loop/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@ Every bug caught after SWE submits is a system failure. Learn from it.
For each bug:

1. **Is this new or known?**
- Check `skills/review-findings/SKILL.md` and `skills/code-quality/SKILL.md`
- Check `skills/tmb_review-findings/SKILL.md` and `skills/tmb_code-quality/SKILL.md`
- If already covered β†’ agent ignored criteria
- If NOT covered β†’ gap, proceed to Q2

2. **Where should knowledge live?**
- Specific code pattern β†’ `skills/review-findings/SKILL.md`
- Design-time question β†’ `skills/code-quality/SKILL.md`
- Implementation rule β†’ `skills/code-quality/SKILL.md`
- Specific code pattern β†’ `skills/tmb_review-findings/SKILL.md`
- Design-time question β†’ `skills/tmb_code-quality/SKILL.md`
- Implementation rule β†’ `skills/tmb_code-quality/SKILL.md`

3. **Was the task underspecified?**
- If SWE had to guess β†’ update task template or quality checklist

## Format for New Entries

- review-findings.md: `- **[pattern name]** β€” [what happens]. [why wrong]. [what to do].`
- code-quality.md: `- [concise check β€” one line, actionable]`
- tmb_review-findings.md: `- **[pattern name]** β€” [what happens]. [why wrong]. [what to do].`
- tmb_code-quality.md: `- [concise check β€” one line, actionable]`

## What NOT to Add

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: git-conventions
name: tmb_git-conventions
description: Commit message style, branching rules, push safety.
agent: bro, swe, pr-reviewer
---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: naming-conventions
name: tmb_naming-conventions
description: File and identifier naming patterns.
agent: swe, pr-reviewer
paths: ["src/**", "lib/**", "app/**", "tests/**"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: review-findings
name: tmb_review-findings
description: Living list of patterns caught during code review. All agents internalize these before designing, implementing, or reviewing.
---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: review-protocol
name: tmb_review-protocol
description: Review phases 1-7 for PR Reviewer. Progression from staged diff scan to full design compliance check.
---

Expand Down
2 changes: 1 addition & 1 deletion skills/tmb_skill-creator/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Add a new capability to a project's agents without editing their body. The Lego

## When invoked

- Bro detects a project needs a new skill (e.g. Python-stack swe needs a Python-specific verification checklist that the default `swe-checklist` doesn't cover).
- Bro detects a project needs a new skill (e.g. Python-stack swe needs a Python-specific verification checklist that the default `tmb_swe-checklist` doesn't cover).
- Human asks bro to teach an agent a specific behavior (`@bro teach swe to also run mypy as part of verification`).
- A consultant flagged that the project lacks a skill needed for a domain (e.g. cto says "you should have a perf-budget skill on swe").

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: swe-checklist
name: tmb_swe-checklist
description: Implementation rules and self-review checklist for SWE agent.
---

Expand Down
Loading