diff --git a/03-records/decisions/agent-skill-architecture-and-governance.md b/03-records/decisions/agent-skill-architecture-and-governance.md index e5b864b..c8dbaaf 100644 --- a/03-records/decisions/agent-skill-architecture-and-governance.md +++ b/03-records/decisions/agent-skill-architecture-and-governance.md @@ -72,7 +72,7 @@ We deploy `skill-builder` (`~/.gemini/config/skills/skill-builder/SKILL.md` and * **Mandatory Review Gate**: `skill-builder` halts at a formal **Skill Design Specification** and requires explicit human approval before any files are authored. ### 4. Epistemic Integration of Knowledge Articles -We formalize **Knowledge Articles** (`04-learning/knowledge/`, `type: knowledge`) within [`documentation-router`](../../05-agents/skills/documentation-router/README.md): +We formalize **Knowledge Articles** (`04-learning/knowledge/`, `type: knowledge`) within [`documentation-router`](../../05-agents/skills/README.md): * Governed by `references/knowledge-authoring.md` (in `documentation-router`). * Captures generalized, reusable understanding and methodologies written in a side-by-side learner voice. * Preserves canonical ownership: general lessons live in Knowledge; project explorations live in Discussions; point-in-time commitments live in ADRs; implementation steps live in Plans; incident RCAs live in Debug Records. diff --git a/03-records/journal/2026-09-29.md b/03-records/journal/2026-09-29.md index 1d83824..aa3c424 100644 --- a/03-records/journal/2026-09-29.md +++ b/03-records/journal/2026-09-29.md @@ -40,10 +40,10 @@ tags: ### Agent Skill Engineering & Skill-Builder Meta-Skill Creation - Conducted an in-depth empirical investigation of Matt Pocock's skills repository (`mattpocock/skills`), studying skill anatomy, invocation modes, operational state machines, negative boundaries, progressive disclosure, and context load economics. -- Formalized **Knowledge Articles** as an explicit epistemic document type in [`documentation-router`](../../05-agents/skills/documentation-router/README.md), authoring the specification `references/knowledge-authoring.md` based on a side-by-side learner voice and rhetorical restraint. +- Formalized **Knowledge Articles** as an explicit epistemic document type in [`documentation-router`](../../05-agents/skills/README.md), authoring the specification `references/knowledge-authoring.md` based on a side-by-side learner voice and rhetorical restraint. - Authored the durable knowledge article [How to Build Effective Agent Skills](../../04-learning/knowledge/methods/building-effective-agent-skills.md), explaining why essay prompts fail, introducing the assembly jig / airlock mental model, and codifying the single observable proof heuristic. - Derived the Skill-Engineering Methodology based on 4 structural sizing archetypes (Reference, Transformation, Procedural Workflow, Interactive Elicitation) and a 4-tier epistemic architecture (Engineering Invariants, Platform Constraints, Contextual Heuristics, Authoring Quality). -- Designed and implemented the [`skill-builder`](../../05-agents/skills/skill-builder/README.md) meta-skill (deployed to `~/.gemini/config/skills/skill-builder/` and `/build-skill`) as an interactive coach with a mandatory Design Review Gate. +- Designed and implemented the [`skill-builder`](../../05-agents/skills/README.md) meta-skill (deployed to `~/.gemini/config/skills/build-skill/` and `/build-skill`) as an interactive coach with a mandatory Design Review Gate. - Dogfooded `skill-builder` against existing skills (`engineering-investigation`, `engineering-tutor`, `documentation-router`, `git-commit`), validating its false-positive rejection and identifying high-signal refinements. - Strengthened `engineering-investigation` with Evidence Before Hypothesis, Traceable Diagnostic Cleanup, and Sensitive Data Redaction invariants. - Captured the architectural commitments in ADR [Agent Skill Architecture & Governance](../../03-records/decisions/agent-skill-architecture-and-governance.md). diff --git a/04-learning/guides/brain/documentation-and-investigation-skills-walkthrough.md b/04-learning/guides/brain/documentation-and-investigation-skills-walkthrough.md index d4727ae..76b0d71 100644 --- a/04-learning/guides/brain/documentation-and-investigation-skills-walkthrough.md +++ b/04-learning/guides/brain/documentation-and-investigation-skills-walkthrough.md @@ -44,14 +44,14 @@ Operational walkthrough for the implementation of the decoupled, reusable global ## 2. Implemented Artifacts & Locations ### A. Procedural Investigation Skill -- **Runtime Location**: `~/.gemini/config/skills/engineering-investigation/SKILL.md` -- **Vault Specification**: [`05-agents/skills/engineering-investigation/README.md`](../../../05-agents/skills/engineering-investigation/README.md) +- **Runtime Location**: `~/.gemini/config/skills/diagnose/SKILL.md` +- **Repository Specification**: [`skills/diagnose`](https://github.com/kiskaadee/skills/blob/main/skills/diagnose/SKILL.md) - **Role**: Purely empirical troubleshooting following the scientific method (Observation $\to$ Verification) and the 6-part interactive checkpoint protocol. -- **Boundary**: Stops cleanly upon verified recovery; hands off to `documentation-router` if non-obvious learning or architectural questions emerged. +- **Boundary**: Stops cleanly upon verified recovery; hands off to `document` if non-obvious learning or architectural questions emerged. -### B. Documentation Router Skill -- **Runtime Location**: `~/.gemini/config/skills/documentation-router/SKILL.md` -- **Vault Specification**: [`05-agents/skills/documentation-router/README.md`](../../../05-agents/skills/documentation-router/README.md) +### B. Documentation Skill +- **Runtime Location**: `~/.gemini/config/skills/document/SKILL.md` +- **Repository Specification**: [`skills/document`](https://github.com/kiskaadee/skills/blob/main/skills/document/SKILL.md) - **Role**: Second-order knowledge filter and gatekeeper (anti-markdown factory). - **Core Rules**: - **Gatekeeping**: Routine/trivial tasks produce **NO ARTIFACT**. diff --git a/05-agents/skills/README.md b/05-agents/skills/README.md index 1558848..03673fc 100644 --- a/05-agents/skills/README.md +++ b/05-agents/skills/README.md @@ -7,132 +7,39 @@ project: brain tags: - skills - agent-engineering - - skill-interaction - system-architecture --- # Global Skill Collection -> **This index describes the skill collection as a system rather than a list of individual capabilities.** +> **The authoritative source of truth for all agent skills has been consolidated into the standalone [`skills`](https://github.com/kiskaadee/skills) repository.** --- -## System Architecture +## Repository & Installation -The global skills form a layered behavioral architecture. `skill-builder` governs the collection's design quality. Four domain skills provide reusable behaviors that project agents invoke. `documentation-router` sits at the output boundary, evaluating whether anything produced by the other skills is worth preserving. +Skills are maintained, versioned, and tested in [`kiskaadee/skills`](https://github.com/kiskaadee/skills). -```mermaid -flowchart TD - SB["Skill Builder
meta-level design"] - subgraph Domain["Domain Skills"] - INV["Engineering Investigation
'find out'"] - TUT["Engineering Tutor
'learn it'"] - GIT["Git Commit
'package it'"] - end - DR["Documentation Router
'preserve it?'"] - Brain["Brain / Records"] +They are installed into runtime agent configurations via the repository's `install.sh` script: - SB --> Domain - Domain --> DR - DR --> Brain -``` - -Project agents sit above this layer, providing context while the global skills provide reusable behavior: - -```mermaid -flowchart LR - Agents["Project Agents
(Homelab, MagNetFlix, NekoWeb, NixOS, Brain)"] - Skills["Global Skills"] - Agents --> Skills +```bash +cd ~/Projects/active/skills +./install.sh ``` --- -## Skill Interaction Matrix +## Active Skills Index -Each cell describes the pairwise relationship between the **row** skill and the **column** skill. +### Portable Skills -| From \ To | Investigation | Tutor | Git Commit | Docs Router | Skill Builder | -| :--- | :--- | :--- | :--- | :--- | :--- | -| **Investigation** | — | yields (learner drives) | delegates commit packaging | hands off if RCA warrants it | — | -| **Tutor** | yields (agent takes over for production incidents) | — | learner-controlled; proposes message only | optional handoff for knowledge articles | — | -| **Git Commit** | packages remediation result | learner-controlled | — | delegates if commit warrants documentation | — | -| **Docs Router** | consumes investigation outcome | consumes practice milestones | evaluates commit significance | — | — | -| **Skill Builder** | — | — | delegates all commits | delegates all vault documentation | applies to itself (deletion test) | +- **[`practice`](https://github.com/kiskaadee/skills/blob/main/skills/practice/SKILL.md)**: Socratic tutoring mode where the learner writes all code and drives analysis. +- **[`diagnose`](https://github.com/kiskaadee/skills/blob/main/skills/diagnose/SKILL.md)**: Empirical troubleshooting following the scientific method and 6-part checkpoints. +- **[`git-commit`](https://github.com/kiskaadee/skills/blob/main/skills/git-commit/SKILL.md)**: History hygiene, atomic slicing, and Conventional Commit construction. +- **[`document`](https://github.com/kiskaadee/skills/blob/main/skills/document/SKILL.md)**: Second-order knowledge classifier for Discussions, ADRs, Plans, Debug Records, and Knowledge Articles. +- **[`build-skill`](https://github.com/kiskaadee/skills/blob/main/skills/build-skill/SKILL.md)**: Interactive skill design, sizing, authoring, and empirical dogfooding. ---- +### Brain Extensions -## Canonical Transition Workflows - -These are the three most common multi-skill sequences. They describe normal flows, not mandatory pipelines — each step is independently optional. - -### 1. Investigation to History - -```mermaid -flowchart LR - A["engineering-investigation
RCA established, recovery verified"] --> B["git-commit
Atomic commit slice constructed"] --> C["documentation-router
Evaluate if Debug Record or ADR warranted"] -``` - -**Trigger**: A non-trivial bug, infrastructure incident, or regression is diagnosed and fixed. - -**Handoff gates**: -- `engineering-investigation` terminates only after verified runtime recovery. -- `git-commit` packages the fix; does not re-examine whether it was the right fix. -- `documentation-router` evaluates whether non-obvious RCA, architectural insights, or operational heuristics justify a durable artifact. Most fixes do not. - ---- - -### 2. Learning to Knowledge - -```mermaid -flowchart LR - A["engineering-tutor
Transfer challenge demonstrated"] --> B["documentation-router
Evaluate if Knowledge Article warranted"] --> C["04-learning/knowledge/
Durable concept article authored"] -``` - -**Trigger**: A tutoring session reaches a demonstrated-mastery milestone (transfer challenge solved, novel mechanism understood). - -**Handoff gates**: -- The practice session record (`type: practice`) is an optional offer, not a prerequisite. -- `documentation-router` applies the Gatekeeper: does this concept generalize across system boundaries? If not, no artifact. - ---- - -### 3. Skill Design Loop - -```mermaid -flowchart LR - A["skill-builder
Skill Design Specification approved"] --> B["Dogfooding
Run on real task"] --> C{"Observed
failure?"} - C -->|Yes| D["skill-builder
Minimal Refinement Matrix
smallest mechanism changed"] - C -->|No| E["Done
Regression check passes"] - D --> B -``` - -**Trigger**: A new or modified skill is scaffolded and needs empirical validation. - -**Invariant**: The Mandatory Review Gate in Stage 4 must fire before any file is created. No files before human approval. - ---- - -## Governing Maintenance Criterion - -> **Ownership over mentions.** - -When adding any new rule, ask: *"Where does this rule belong?"* — not *"Where should I mention this rule?"* - -Each rule has one authoritative owner. Other documents may link to it. They must not redefine it. - -The primary threat to this collection's health is **duplicate authority**, not missing instructions. - ---- - -## Package Index - -| Skill | Human API | Runtime Engine | References | -| :--- | :--- | :--- | :--- | -| [Inbox Curation](inbox-curation/README.md) | [README](inbox-curation/README.md) | [SKILL.md](inbox-curation/SKILL.md) | — | -| [Engineering Investigation](engineering-investigation/README.md) | [README](engineering-investigation/README.md) | [SKILL.md](engineering-investigation/SKILL.md) | — | -| [Engineering Tutor](engineering-tutor/README.md) | [README](engineering-tutor/README.md) | [SKILL.md](engineering-tutor/SKILL.md) | — | -| [Git Commit](git-commit/README.md) | [README](git-commit/README.md) | [SKILL.md](git-commit/SKILL.md) | — | -| [Documentation Router](documentation-router/README.md) | [README](documentation-router/README.md) | [SKILL.md](documentation-router/SKILL.md) | [5 authoring specs](documentation-router/references/) | -| [Commit Logger](commit-logger/README.md) | [README](commit-logger/README.md) | [SKILL.md](commit-logger/SKILL.md) | — | -| [Skill Builder](skill-builder/README.md) | [README](skill-builder/README.md) | [SKILL.md](skill-builder/SKILL.md) | [Evaluation checklist](skill-builder/references/skill-evaluation-checklist.md) | +- **[`inbox-curation`](https://github.com/kiskaadee/skills/blob/main/brain/inbox-curation/SKILL.md)**: Triages, classifies, formats, and validates incoming drafts from `00-inbox/` into canonical lifecycle directories. +- **[`commit-logger`](https://github.com/kiskaadee/skills/blob/main/brain/commit-logger/SKILL.md)**: Immutable event capture script logging Git commits into `00-inbox/commit-log.csv` (planned consumer of future `journal-builder`). diff --git a/05-agents/skills/commit-logger/README.md b/05-agents/skills/commit-logger/README.md deleted file mode 100644 index 5c6d7a7..0000000 --- a/05-agents/skills/commit-logger/README.md +++ /dev/null @@ -1,90 +0,0 @@ ---- -type: agent -status: active -name: commit-logger -kind: skill -project: brain -tags: - - git - - commit-logging - - ledger - - capture ---- - -# 📝 Commit Logger - -**Commit Logger** is a lightweight, single-pass operational skill responsible for capturing verified Git commit events into Brain's machine-readable ledger (`00-inbox/commit-log.csv`). - -It serves as the deterministic capture boundary between Git repository operations and Brain's historical reflection lifecycle. - ---- - -## 🏛️ System Role & Architectural Position - -The knowledge capture pipeline cleanly separates mechanical event logging from retrospective synthesis: - -```mermaid -flowchart LR - Producer["git-commit
(Verified Commit SHA)"] --> Logger["commit-logger
(Immutable Fact Capture)"] - Logger --> Ledger[("00-inbox/commit-log.csv
(Event Ledger)")] - Ledger --> Consumer["journal-builder (/journal)
(Reconstruct, Test, Synthesize)"] - Consumer --> Journal["03-records/journal/
(Daily Journal Entry)"] -``` - -* **`commit-logger` preserves evidence**; -* **`journal-builder` creates meaning**. - ---- - -## 🔑 Core Guarantees & Invariants - -1. **Authoritative Event Identity**: The full 40-character commit SHA is the authoritative event identity. The CSV row is only its durable representation. -2. **Pure Fact Capture (Zero Interpretation)**: Captures only immutable Git metadata. It does not infer rationale, assign semantic lineage, query the user, or synthesize prose. -3. **Brain Recursion Guard**: Commits inside the `Brain` repository (`/home/kiskaadee/Brain`) are strictly non-loggable to prevent recursive logging loops. -4. **Authoritative Project Mapping**: Maps repositories to `06-projects/` only when an authoritative directory or README reference exists; otherwise leaves `project` empty (`""`) without guessing. -5. **Idempotency Barrier**: Appends strictly unique commit SHAs. Duplicate invocations for the same commit are silent no-ops. - ---- - -## 📊 Ledger Schema (`00-inbox/commit-log.csv`) - -```csv -committed_at,repository,project,branch,commit_sha,parent_sha,subject -``` - -| Column | Description | Example | -| :--- | :--- | :--- | -| `committed_at` | Committer timestamp (ISO-8601 with timezone) | `2026-10-02T16:42:13-05:00` | -| `repository` | Repository root directory name | `bdinvite` | -| `project` | Brain project slug (from `06-projects/`) or `""` | `bdinvite` | -| `branch` | Current branch name | `feat/gitops` | -| `commit_sha` | Full 40-character commit SHA | `a81f3c2e9b7d84f...` | -| `parent_sha` | First parent SHA (or `""` if initial commit) | `91bc7de41f2a34b...` | -| `subject` | RFC 4180 escaped commit subject line | `"validate manifest after pull"` | - ---- - -## 🛠️ Usage & Invocations - -### Inter-Skill Invocation -Invoked programmatically by [`git-commit`](../git-commit/README.md) after verifying the resulting commit SHA: - -```bash -bash /home/kiskaadee/Brain/05-agents/skills/commit-logger/scripts/log-commit.sh [COMMIT_SHA] -``` - -### Manual / Catch-up Run -Can be executed in any repository workspace to capture the current `HEAD` or a specific commit: - -```bash -# In any project workspace: -bash ~/Brain/05-agents/skills/commit-logger/scripts/log-commit.sh -``` - ---- - -## 🔗 Related Components - -* 📦 **[Git Commit](../git-commit/README.md)**: Upstream producer that constructs and verifies atomic commits. -* 📥 **[Inbox Directory](../../../00-inbox/README.md)**: Housing location for `commit-log.csv`. -* 🧭 **[Skill Collection Catalog](../README.md)**: Index and architectural matrix of all configured skills. diff --git a/05-agents/skills/commit-logger/SKILL.md b/05-agents/skills/commit-logger/SKILL.md deleted file mode 100644 index 072059f..0000000 --- a/05-agents/skills/commit-logger/SKILL.md +++ /dev/null @@ -1,103 +0,0 @@ ---- -name: commit-logger -description: >- - Record verified Git commit events as lossless, immutable records in Brain's machine-readable - commit ledger (00-inbox/commit-log.csv). -disable-model-invocation: false ---- - -# Commit Logger - -This skill captures verified Git commit events and logs them into Brain's machine-readable event ledger (`00-inbox/commit-log.csv`). - -Its sole responsibility is **immutable fact capture**. It does not interpret, summarize, or evaluate changes. - ---- - -## 1. Governing Axioms & Invariants - -1. **Authoritative Event Identity**: - > **The full 40-character commit SHA is the authoritative event identity. The CSV row is only its durable representation.** -2. **Pure Fact Capture (Zero Interpretation)**: - `commit-logger` records only immutable Git metadata. It does **NOT**: - * Infer, ask for, or fabricate rationale. - * Derive semantic lineage or retrospective notes. - * Conduct learning quizzes or interact conversationally with the user. - * Synthesize or write daily journals (owned strictly by `journal-builder`). -3. **Lossless Essential Metadata**: - Captures the complete commit identity and essential Git attributes: - `committed_at,repository,project,branch,commit_sha,parent_sha,subject` -4. **Authoritative Project Resolution**: - Resolves the repository directory against Brain's `06-projects/` topology. If no authoritative project mapping exists, preserves the repository name and leaves `project` empty (`""`). Never guesses project associations. -5. **Anti-Recursion Invariant**: - Commits inside the `Brain` repository itself (`/home/kiskaadee/Brain`) are strictly non-loggable by default to prevent recursion. Any automated or hook invocation targeting Brain exits immediately as a no-op. When Brain commits represent meaningful engineering progress, passing `--force` (or `--allow-brain`) explicitly captures the commit under project `brain`. -6. **Idempotency Barrier**: - The full 40-character commit SHA acts as a unique idempotency key. If the SHA already exists in `00-inbox/commit-log.csv`, the event is skipped silently. - ---- - -## 2. Ledger Contract & Storage Schema - -* **Target File**: `00-inbox/commit-log.csv` (RFC 4180 compliant) -* **Header**: - ```csv - committed_at,repository,project,branch,commit_sha,parent_sha,subject - ``` - -### Field Definitions - -| Field | Source | Format / Rule | Example | -| :--- | :--- | :--- | :--- | -| `committed_at` | Git committer timestamp | ISO-8601 with timezone (`%cI`) | `2026-10-02T16:42:13-05:00` | -| `repository` | Top-level working directory | Directory basename | `bdinvite` | -| `project` | Brain `06-projects/` mapping | Directory slug if known, else `""` | `bdinvite` | -| `branch` | Current Git branch | Branch ref name (or `detached`) | `feat/gitops` | -| `commit_sha` | Git commit identity | Full 40-character SHA | `a81f3c2e9b7d84f...` | -| `parent_sha` | First parent commit SHA | Full 40-character SHA, or `""` if root | `91bc7de41f2a...` | -| `subject` | Commit subject line | RFC 4180 escaped (double-quoted if needed) | `"validate manifest after pull"` | - ---- - -## 3. Operational Procedure - -When invoked following a verified commit (or during catch-up): - -```mermaid -flowchart TD - Start["Receive Commit Reference
(SHA or HEAD)"] --> RepoCheck{"Inside Git Repo?"} - RepoCheck -->|No| Abort["Exit with Error"] - RepoCheck -->|Yes| Recursion{"Repo == Brain?"} - Recursion -->|Yes| NoOp["Silent No-Op Exit"] - Recursion -->|No| Extract["Extract Git Metadata & Resolve Project"] - Extract --> Dedup{"SHA already in
commit-log.csv?"} - Dedup -->|Yes| Duplicate["Silent No-Op Exit"] - Dedup -->|No| Append["Append CSV Row to 00-inbox/commit-log.csv"] - Append --> Done["Event Recorded"] -``` - -### Step 1: Pre-condition & Recursion Check -Inspect the target repository: -```bash -git rev-parse --show-toplevel -``` -If the repository root is `/home/kiskaadee/Brain` or the directory name is `Brain`, terminate immediately. - -### Step 2: Capture via Deterministic Script -Execute the bundled deterministic capture script: -```bash -bash /home/kiskaadee/Brain/05-agents/skills/commit-logger/scripts/log-commit.sh [COMMIT_SHA] -``` -*(If `COMMIT_SHA` is omitted, the script automatically defaults to `HEAD` of the current repository).* - -Alternatively, execute the extraction steps directly adhering strictly to RFC 4180 escaping and the schema rules above. - -### Step 3: Verification -Inspect `00-inbox/commit-log.csv` to confirm the row exists and adheres to RFC 4180 standards. - ---- - -## 4. Architectural Boundaries & System Role - -* **Producer**: `git-commit` invokes `commit-logger` upon verifying the created commit SHA. External or manual commits may trigger `scripts/log-commit.sh` via a Git `post-commit` hook. -* **Storage**: `00-inbox/commit-log.csv` is an append-only raw event ledger. It is exempt from `inbox-curation` triage. -* **Consumer**: `journal-builder` (`/journal`) consumes the accumulated records in `commit-log.csv` in batches to conduct retrospectives, drive Socratic learning loops, and synthesize daily journals in `03-records/journal/`. diff --git a/05-agents/skills/commit-logger/scripts/log-commit.sh b/05-agents/skills/commit-logger/scripts/log-commit.sh deleted file mode 100755 index cbe90ed..0000000 --- a/05-agents/skills/commit-logger/scripts/log-commit.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env bash -# log-commit.sh - Deterministic Git commit event capture for Brain -# Appends verified commit metadata into 00-inbox/commit-log.csv - -set -euo pipefail - -BRAIN_ROOT="${BRAIN_ROOT:-/home/kiskaadee/Brain}" -LEDGER_FILE="${BRAIN_ROOT}/00-inbox/commit-log.csv" - -TARGET_REF="HEAD" -FORCE_ALLOW_BRAIN=false - -for arg in "$@"; do - if [[ "$arg" == "--force" ]] || [[ "$arg" == "--allow-brain" ]]; then - FORCE_ALLOW_BRAIN=true - elif [[ "$arg" != -* ]]; then - TARGET_REF="$arg" - fi -done - -# 1. Verify Git repository -if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then - echo "commit-logger: not inside a git repository. Exiting." >&2 - exit 1 -fi - -REPO_ROOT="$(git rev-parse --show-toplevel)" -REPO_NAME="$(basename "${REPO_ROOT}")" - -# 2. Anti-Recursion Invariant: Brain is non-loggable unless explicitly forced -if [[ "${REPO_ROOT}" == "${BRAIN_ROOT}" ]] || [[ "${REPO_NAME}" == "Brain" ]]; then - if [[ "${FORCE_ALLOW_BRAIN}" != "true" ]]; then - # Silent exit as a no-op to prevent recursion - exit 0 - fi -fi - -# 3. Extract Immutable Git Metadata -COMMIT_SHA="$(git rev-parse "${TARGET_REF}")" -PARENT_SHA="$(git rev-parse "${COMMIT_SHA}^" 2>/dev/null || echo "")" -COMMITTED_AT="$(git show -s --format=%cI "${COMMIT_SHA}")" -SUBJECT="$(git show -s --format=%s "${COMMIT_SHA}")" -BRANCH="$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "detached")" - -# 4. Authoritative Project Mapping -PROJECT="" -if [[ "${REPO_ROOT}" == "${BRAIN_ROOT}" ]] || [[ "${REPO_NAME}" == "Brain" ]]; then - PROJECT="brain" -elif [[ -d "${BRAIN_ROOT}/06-projects/${REPO_NAME}" ]]; then - PROJECT="${REPO_NAME}" -elif [[ -d "${BRAIN_ROOT}/06-projects" ]]; then - # Look for matching project directory containing repository reference in README.md - for proj_dir in "${BRAIN_ROOT}/06-projects"/*; do - if [[ -f "${proj_dir}/README.md" ]]; then - if grep -qi "${REPO_NAME}" "${proj_dir}/README.md"; then - PROJECT="$(basename "${proj_dir}")" - break - fi - fi - done -fi - -# 5. CSV Formatting (RFC 4180 Escaping) -escape_csv() { - local val="$1" - # Double existing double quotes - val="${val//\"/\"\"}" - # Quote if string contains comma, quote, or newline - if [[ "${val}" =~ [,\"\n\r] ]]; then - echo "\"${val}\"" - else - echo "${val}" - fi -} - -ESCAPED_SUBJECT="$(escape_csv "${SUBJECT}")" - -# 6. Ensure Ledger File and Header Exist -mkdir -p "$(dirname "${LEDGER_FILE}")" -if [[ ! -f "${LEDGER_FILE}" ]]; then - echo "committed_at,repository,project,branch,commit_sha,parent_sha,subject" > "${LEDGER_FILE}" -fi - -# 7. Idempotency Barrier: Full 40-char SHA deduplication -if grep -q ",${COMMIT_SHA}," "${LEDGER_FILE}" 2>/dev/null; then - # Commit already recorded - exit 0 -fi - -# 8. Atomic Append -echo "${COMMITTED_AT},${REPO_NAME},${PROJECT},${BRANCH},${COMMIT_SHA},${PARENT_SHA},${ESCAPED_SUBJECT}" >> "${LEDGER_FILE}" diff --git a/05-agents/skills/documentation-router/README.md b/05-agents/skills/documentation-router/README.md deleted file mode 100644 index 739d96f..0000000 --- a/05-agents/skills/documentation-router/README.md +++ /dev/null @@ -1,86 +0,0 @@ ---- -type: agent -status: active -name: documentation-router -kind: skill -project: brain -tags: - - documentation - - router - - epistemic-taxonomy - - knowledge-governance ---- - -# Documentation Router - -> **Documentation Router helps you decide whether an engineering session produced something worth preserving and, if it did, which kind of Brain artifact should preserve it.** - ---- - -## 1. Identity -**Documentation Router** is a second-order knowledge classifier for the Brain knowledge graph. It evaluates the outcomes of an engineering or learning activity to determine if durable knowledge was generated and routes that knowledge to its canonical epistemic container. - -## 2. User Value -Engineering sessions often produce different kinds of knowledge: an exploratory trade-off, a point-in-time architectural commitment, a concrete implementation roadmap, an incident root-cause analysis, or a reusable mental model. - -Treating all session output as generic notes leads to knowledge bloat, fragmented documentation, and conflicting authorities. Documentation Router ensures: -- Routine work leaves **no documentation footprint**. -- Every preserved fact has **one authoritative owner**. -- Exploration, commitments, implementation plans, and investigations never pollute each other. - -## 3. Invocation -### When to use it: -Invoke Documentation Router at the close of an engineering session, investigation, or design discussion when you need to answer: *"Did we produce anything durable that would be lost if not recorded?"* - -### When NOT to use it: -- **Routine implementation & chores**: Bug fixes, minor refactors, or standard task execution where commit messages and PR diffs are fully self-explanatory. -- **Authoring execution**: Documentation Router routes and bounds documents; it does not replace the actual drafting of code or narrative text. - -## 4. Behavior -When invoked, Documentation Router evaluates session context through a progressive evaluation: - -```text -Engineering Session Complete - ↓ -1. Gatekeeper: Did something worth preserving happen? - ├── No → Stop (No artifact created) - └── Yes → 2. Epistemic Classification - ↓ - What kind of knowledge was produced? - ├── Exploration / Trade-offs → Discussion - ├── Architectural Decision → ADR - ├── Implementation Roadmap → Plan - ├── Empirical RCA → Debug Record - └── Reusable Mental Model → Knowledge Article - ↓ - 3. Multi-Artifact Decomposition - └── Split multi-dimensional knowledge to prevent overlap -``` - -## 5. Outputs -Documentation Router produces one or more of the following routing recommendations: - -| Output Artifact | Epistemic Role | What It Captures | -| :--- | :--- | :--- | -| **No Artifact** | *Ephemeral* | Session produced routine or self-explanatory work. | -| **Discussion** (`02-discussions/`) | *WHY* | Explorations, alternatives, trade-offs, and open questions. | -| **ADR** (`03-records/decisions/`) | *WHAT was decided* | Point-in-time architectural commitments and accepted trade-offs. | -| **Plan** (`01-plans/`) | *HOW to build it* | Concrete specifications, phases (P0–P5), and Definition of Done. | -| **Debug Record** (`03-records/debug/`) | *Empirical RCA* | Diagnostic hypotheses, reproduction logs, and root causes. | -| **Knowledge Article** (`04-learning/knowledge/`) | *UNDERSTANDING* | Generalized mental models, concepts, and transferable methodologies. | - -## 6. Boundaries -- **Does not force a documentation pipeline**: A Discussion does not require an ADR; an ADR does not require a Plan. Each artifact stands on its own authority. -- **Does not duplicate facts across boundaries**: It enforces that the same fact cannot be owned by multiple documents unless serving fundamentally different epistemic purposes. -- **Does not author without reference contracts**: It selects the artifact type and immediately hands off to that document's specific authoring contract. - ---- - -## 7. Package Structure -- [`SKILL.md`](SKILL.md) — Operational instructions, decision gates, and behavioral invariants executed by the AI agent runtime. -- **Reference Authoring Specifications**: - - [`discussion-authoring.md`](references/discussion-authoring.md) — Exploration format, narrative voice, and lifecycle. - - [`adr-authoring.md`](references/adr-authoring.md) — MADR 4.0 format, decision drivers, and trade-offs. - - [`plan-authoring.md`](references/plan-authoring.md) — Phased execution roadmaps, invariants, and DoD. - - [`debug-record-authoring.md`](references/debug-record-authoring.md) — Empirical RCA logging and post-mortem structure. - - [`knowledge-authoring.md`](references/knowledge-authoring.md) — Durable engineering concepts and methodologies. diff --git a/05-agents/skills/documentation-router/SKILL.md b/05-agents/skills/documentation-router/SKILL.md deleted file mode 100644 index 5b01cd1..0000000 --- a/05-agents/skills/documentation-router/SKILL.md +++ /dev/null @@ -1,130 +0,0 @@ ---- -name: documentation-router -description: >- - Use this skill to evaluate session context, determine whether durable knowledge preservation - is warranted, classify knowledge into distinct epistemic containers (Discussion, ADR, Plan, - Debug Record, Knowledge Article), enforce anti-overlap invariants, and coordinate documentation - authoring. ---- - -# Documentation Router & Epistemic Governance - -This skill acts as a second-order knowledge classifier and router. It inspects session context (investigations, architectural debates, design sessions, tutoring/practice milestones, implementation tasks) to determine whether durable documentation is justified, which epistemic artifact(s) should be produced, and how to prevent overlap or conflicting authority. - ---- - -## 1. The Cardinal Invariant - -> **Documentation type is determined by the nature of the knowledge being preserved, not by the activity that produced it.** - -* A debugging session discovering an underlying architectural misconception produces a **Discussion** or an **ADR**, not merely a Debug Record. -* An architectural debate that reaches a firm point-in-time consensus produces an **ADR**; if it remains exploratory or consensus is not reached, it remains a **Discussion**. -* An implementation task that uncovers an unaddressed architectural question must pause and route to an **ADR** before proceeding with the **Plan**. -* A routine bug fix or maintenance chore produces **NO ARTIFACT**, regardless of how many files were edited. - ---- - -## 2. The Decision Procedure - -When evaluating whether and how to document findings from a session: - -```mermaid -flowchart TD - Start["Session Context / Activity Completed"] --> Gate{"1. Did something worth
preserving happen?"} - Gate -->|"No: Routine / Trivial / Self-explanatory"| NoDoc["NO ARTIFACT
(Standard commit/PR message)"] - Gate -->|"Yes: Non-obvious / Architectural / Reusable"| Classify{"2. What kind of knowledge
was produced?"} - - Classify -->|"Exploration / Trade-offs / Why"| Disc["Discussion
(references/discussion-authoring.md)"] - Classify -->|"Architectural Commitment / What decided"| ADR["ADR
(references/adr-authoring.md)"] - Classify -->|"Implementation Sequence / How to build"| Plan["Plan
(references/plan-authoring.md)"] - Classify -->|"Empirical Investigation / RCA"| Debug["Debug Record
(references/debug-record-authoring.md)"] - - Disc --> Multi{"3. Are multiple distinct
knowledge objects justified?"} - ADR --> Multi - Plan --> Multi - Debug --> Multi - - Multi -->|Single Object| Emit["Author Single Artifact"] - Multi -->|Multiple Objects| Decompose["Decompose into Distinct Artifacts
(Apply anti-overlap invariants)"] -``` - -### Step 1: Gatekeeping (Anti-Markdown Factory) -Before drafting any document, ask: -* *Did this session yield non-obvious reasoning, surprising failure modes, or architectural insights?* -* *Will an engineer or operator benefit from reading this months later?* -* *If the answer is NO*: **Do not create an artifact.** Record the changes in standard Git commits or code comments. - -### Step 2: Epistemic Classification -Map the core knowledge product to its natural epistemic container: - -| Knowledge Produced | Epistemic Role | Target Container | Governing Module | -| :--- | :--- | :--- | :--- | -| Explorations, inquiries, trade-offs, pain points, alternatives evaluated, and historical evolution. | **WHY** | `02-discussions/` (`type: discussion`) | [`references/discussion-authoring.md`](./references/discussion-authoring.md) | -| Point-in-time architectural commitments, decision drivers, forces, and accepted trade-offs. | **WHAT was decided** | `03-records/decisions/` (`type: decision`) | [`references/adr-authoring.md`](./references/adr-authoring.md) | -| Authoritative implementation specifications, constraints, phased execution (P0–P5), runbooks, and DoD. | **HOW to build it** | `01-plans/` (`type: plan`) | [`references/plan-authoring.md`](./references/plan-authoring.md) | -| Historical investigation of unexpected system behaviors, regressions, bugs, or anomalies. | **Empirical RCA** | `03-records/debug/` (`type: debug`) | [`references/debug-record-authoring.md`](./references/debug-record-authoring.md) | -| Durable mental models, general engineering methodologies, conceptual deep dives, and transferable patterns. | **UNDERSTANDING** | `04-learning/knowledge/` (`type: knowledge`) | [`references/knowledge-authoring.md`](./references/knowledge-authoring.md) | - -### Step 3: Multi-Artifact Decomposition -A rich session may legitimately produce multiple distinct knowledge objects. When justified, decompose them cleanly rather than creating a sprawling hybrid document: -* Example: An investigation that diagnoses a broken pipeline and exposes an architectural limitation can produce a **Debug Record** (recording the RCA) and a **Discussion** (evaluating architectural alternatives). -* Example: An architectural initiative can produce a **Discussion** (recording why the change was needed and what was explored), an **ADR** (locking the chosen model), and a **Plan** (specifying the phased rollout). - ---- - -## 3. Document Relationships & Authority - -The relationships below are **possible, not required**. Each artifact is independently valid; none mandates a predecessor or successor. - -| From | Relationship | To | Meaning | -| :--- | :--- | :--- | :--- | -| Discussion | may inform | ADR | A resolved exploration can motivate a commitment. | -| ADR | may constrain | Plan | An accepted commitment can bound an implementation spec. | -| Any | cross-references | Any | Any document may link to related records. | -| Debug Record | stands alone | — | Historical investigation; never requires a companion artifact. | - -* A Discussion may exist as the only artifact, open or resolved. -* An ADR may be authored directly for a clear commitment, with no prior Discussion. -* A Plan may be authored for a known project, with no prior Discussion or ADR. -* A Debug Record always stands alone as historical memory. - ---- - -## 4. Anti-Overlap Invariants & Fact Ownership - -To maintain clarity and prevent contradictory documentation across the vault: - -1. **Rule of Epistemic Purpose**: - The same fact may appear in multiple documents **only when it serves a different epistemic purpose**: - * *Discussion*: `"The old model coupled software and deployment, which created friction during doc2site development."` (Historical motivation) - * *ADR*: `"We adopt separate Software and Deployment layers."` (Formal commitment) - * *Plan*: `"Source repositories contain code; Sites/ contains app.yaml and Compose."` (Implementation specification) - * *Unhealthy duplication*: Copying the same five-paragraph rationale or the same bash execution runbook into all three documents. - -2. **Canonical Ownership of Facts**: - * The **Discussion** owns the exploratory narrative, rejected alternatives, and justification. - * The **ADR** owns the decision outcome, forces, and accepted trade-offs. - * The **Plan** owns the implementation sequence, contracts, runbooks, verification gates, and Definition of Done. - * The **Debug Record** owns the empirical hypothesis testing log, diagnostic commands, and root-cause proof. - * The **Knowledge Article** owns generalized mental models, failure traps, conceptual mechanics, and transferable engineering methodologies. - -3. **Tone and Voice Boundaries**: - * **Discussion**: Retrospective, narrative, exploratory. Never uses "decision voice" (`"The Decision: ..."`) or imperative commands. Preserves uncertainty and rejected options. - * **ADR**: Normative, compact (MADR 4.0). Establishes architectural requirements, not implementation procedures or internal schema field names. - * **Plan**: Technical implementation specification. Uses crisp constraints and invariants without re-arguing rationale. Does not silently introduce new architectural decisions. - * **Debug Record**: Empirical, factual, evidence-based. Strictly separates observation from inference. - -4. **Preservation of History vs. Current Authority**: - * **ADRs and Plans** represent current architectural commitments and active execution blueprints. When superseded, they remain in the repository marked `superseded`, preserving their historical identity. - * **Discussions and Debug Records** are permanent historical records. They are never updated to retroactively match subsequent implementation changes. - ---- - -## 5. Authoring Reference Modules - -When a specific document type is selected, follow the corresponding authoring specification in `references/`: -* [**Discussion Authoring Specification**](./references/discussion-authoring.md) -* [**ADR (MADR 4.0) Authoring Specification**](./references/adr-authoring.md) -* [**Plan Authoring Specification**](./references/plan-authoring.md) -* [**Debug Record Authoring Specification**](./references/debug-record-authoring.md) -* [**Knowledge Article Authoring Specification**](./references/knowledge-authoring.md) diff --git a/05-agents/skills/documentation-router/references/adr-authoring.md b/05-agents/skills/documentation-router/references/adr-authoring.md deleted file mode 100644 index 0bc34b8..0000000 --- a/05-agents/skills/documentation-router/references/adr-authoring.md +++ /dev/null @@ -1,88 +0,0 @@ -# ADR (MADR 4.0) Authoring Specification - -## Epistemic Role & Core Purpose - -An **Architectural Decision Record (ADR)** captures a point-in-time architectural or design commitment that constrains future engineering work. It answers: -> *"What did we decide, and why?"* - -The ADR is a compact, durable historical contract. It establishes architectural boundaries, selected models, and accepted trade-offs. It is not an implementation runbook, an operational manual, or a record of diagnostic procedures. - ---- - -## 1. Epistemic Invariants & Boundaries - -1. **MADR 4.0 Structural Sequence**: - Adheres to the standard sequence: - $$\text{Context \& Problem Statement} \longrightarrow \text{Decision Drivers} \longrightarrow \text{Considered Options} \longrightarrow \text{Decision Outcome} \longrightarrow \text{Pros \& Cons} \longrightarrow \text{Consequences} \longrightarrow \text{More Information}$$ -2. **Architectural Commitments, Not Implementation Procedure**: - * *In the ADR*: "We adopt separate Software and Deployment layers; deployment configuration, upstream source provenance, and container artifact identity must be independently observable." - * *In the Plan*: The exact 7 platform primitives table, internal JSON schema field names (`deployment_config_revision`, etc.), execution timeouts, and bash runbooks. -3. **Immutability vs. Artifact Identity**: - Distinguish mutable identifiers (like image tags) from cryptographic ones. OCI images produced by CI act as provenance objects; the immutable identity of the deployed artifact is its content-addressed OCI digest, with source commit provenance carried via metadata labels. -4. **Neutral Systems Language**: - Justify outcomes through clear trade-offs against the decision drivers, rather than subjective or promotional assertions (e.g. *"addresses the identified coupling while retaining a bounded operational control path"* rather than *"strictly preserves minimal complexity"*). -5. **Durable Historical Record**: - Do not rewrite an accepted ADR merely because subsequent implementation evolves. If a fundamental architectural commitment changes, record a new ADR that explicitly supersedes the earlier record. - ---- - -## 2. Standard MADR 4.0 Document Structure - -```markdown ---- -type: decision -status: proposed | accepted | superseded -project: -date: YYYY-MM-DD -tags: [list, of, tags] ---- - -# - -## Context and Problem Statement -Concise framing of the problem, background forces, and the central architectural question. - -## Decision Drivers -* Key operational, architectural, or organizational forces driving the choice. -* Criteria against which options are evaluated. - -## Considered Options -* **Option 1: ** — Brief description. -* **Option 2: ** — Brief description. -* **Option 3: ** — Brief description. - -## Decision Outcome -Chosen option: **Option X: **, because . - -### Summary of Architectural Commitments -1. **Primary Structural Boundary**: Clean separation of concerns across tiers/components. -2. **Provenance & Identity**: Architectural requirement for observable identities (delegating exact schema fields to implementation plans). -3. **Reconciliation & Control Path**: Direction and constraints of the control flow. -4. **State Isolation**: Filesystem or database boundary rules. - -## Pros and Cons of the Options - -### Option 1: -* Good, because . -* Bad, because . - -### Option 2: -* Good, because . -* Bad, because . - -### Option 3: (Adopted) -* Good, because . -* Bad, because . - -## Consequences -### Positive Consequences -* Key benefits and unlocked capabilities resulting from the decision. - -### Negative Consequences & Accepted Trade-offs -* Operational overhead, constraints, or limitations accepted as part of the choice. - -## More Information -* **Informing Discussion & Rationale**: Link to companion Discussion (if one exists). -* **Governed Implementation Roadmap**: Link to companion Plan (if one exists). -* **Project Hub**: Link to the relevant system or project landing page. -``` diff --git a/05-agents/skills/documentation-router/references/debug-record-authoring.md b/05-agents/skills/documentation-router/references/debug-record-authoring.md deleted file mode 100644 index dd02c13..0000000 --- a/05-agents/skills/documentation-router/references/debug-record-authoring.md +++ /dev/null @@ -1,73 +0,0 @@ -# Debug Record Authoring Specification - -## Epistemic Role & Core Purpose - -A **Debug Record** is a durable **historical investigation / RCA record**. It documents the empirical diagnosis and root-cause determination of bugs, regressions, system anomalies, failed migrations, configuration errors, or unexpected runtime behaviors. It answers: -> *"What empirically broke, how did the investigation diagnose it, and what was the root cause?"* - -A debug record preserves institutional memory: how an obscure failure was uncovered, which hypotheses were eliminated, what the causal mechanism was, and what operational heuristics prevent recurrence. - ---- - -## 1. Epistemic Invariants & Boundaries - -1. **Empirical & Evidence-Based**: - Ground all statements in verifiable observations. Include raw error messages, exit codes, or log snippets. -2. **Strictly Separate Observation from Inference**: - Clearly demarcate what the system reported (raw fact) from what the investigator inferred or hypothesized. -3. **Document Diagnostic Rationale**: - Explain why diagnostic inspection commands were run and what each command was intended to confirm or refute. -4. **No Hindsight Bias**: - Present the actual reasoning progression. Do not manufacture a tidy, linear narrative that erases reasonable working hypotheses eliminated during the investigation. -5. **Declarative Remediation & Parity**: - Document the minimal, isolated, and reversible fix applied, along with validation commands proving recovery. -6. **Zero Secret Leakage**: - Never include real passwords, API tokens, HMAC keys, or session secrets. Use redacted placeholders. -7. **Scope**: - Not restricted to production outages. Applies to any non-obvious engineering anomaly across development, CI, testing, and operations where the diagnostic reasoning carries durable learning value. - ---- - -## 2. Standard Document Structure - -```markdown ---- -type: debug -date: YYYY-MM-DD -project: -tags: [operations, troubleshooting, debugging, ] ---- - -# - -## 1. System Context & Fundamentals -* Relevant components, data flow, architecture layer, and operational expectations. - -## 2. Problem & Observations -* Observed symptoms vs. expected behavior. -* Raw error logs, stack traces, and failure manifestation (facts separated from interpretation). - -## 3. Diagnostic Inquiries & Hypotheses -* Guiding questions formulated to narrow down the failure domain. -* Initial working hypotheses and plausibility mechanisms. - -## 4. Investigation & Hypothesis Testing Log -* Reasoning progression: Working Hypothesis $\to$ Diagnostic Command $\to$ Evidence (Expected vs. Actual) $\to$ Outcome (Confirmed or Eliminated). - -## 5. Root Cause Analysis -* Synthesis of proven evidence and explanation of the underlying causal mechanism. - -## 6. Declarative Remediation & Local Validation -* Minimal, declarative fix applied. -* Test execution, validation checks, and output proving resolution. - -## 7. Deployment & Recovery Runbook -* Production rollout steps, rollback instructions, and runtime health verification. - -## 8. Discussion & Transferable Learnings -* Architectural takeaways or false assumptions dispelled. -* Transferable diagnostic heuristics and preventative measures. - -## 9. References -* Links to affected manifests, commits, pull requests, or protocol specifications. -``` diff --git a/05-agents/skills/documentation-router/references/discussion-authoring.md b/05-agents/skills/documentation-router/references/discussion-authoring.md deleted file mode 100644 index 2f55e4b..0000000 --- a/05-agents/skills/documentation-router/references/discussion-authoring.md +++ /dev/null @@ -1,65 +0,0 @@ -# Discussion Authoring Specification - -## Epistemic Role & Core Purpose - -A **Discussion** explores architectural inquiries, problem statements, trade-offs, and design alternatives. It answers: -> *"What are we trying to understand, and what did we learn while exploring it?"* - -A discussion preserves the intellectual journey: why a legacy model broke down, what options were considered, what failed during investigation, and how the reasoning evolved. It is an exploration, not an execution manual or an authoritative decree. - ---- - -## 1. Epistemic Invariants & Voice Rules - -1. **Exploratory Narrative Tone**: - Write in a thoughtful, investigative, retrospective voice. Focus on forces, constraints, and dilemmas. -2. **Zero "Decision Voice"**: - Discussions inform decisions; they do not issue them. - * **Prohibited**: `"The Decision: Reject local cloning on the host."` - * **Correct**: `"Resulting Direction: The exploration ultimately converged on rejecting local cloning on the appliance host in favor of commit equality verification via git ls-remote."` -3. **Preserve Uncertainty & Rejected Alternatives**: - Do not erase dead ends or false starts. Document why an option (e.g. calculating commit distance or using message brokers) was considered, what failure mode or friction it introduced, and why it was set aside. -4. **Tempered Language (Avoid Absolutes)**: - Avoid rhetorical hyperbole. - * **Prohibited**: `"The software could not be cleanly open-sourced"` or `"100% pure code"`. - * **Correct**: `"Hosting infrastructure co-located with code made clean open-sourcing or external sharing difficult without stripping private configuration."` -5. **No Implementation Procedure Duplication**: - Do not include multi-step phased execution checklists, bash deployment runbooks, or detailed schema models. -6. **Convergence, Not Mandate**: - End with how the exploration converged, linking forward to the resulting ADR or Plan without re-listing their formal resolution contracts. - ---- - -## 2. Standard Document Structure - -```markdown ---- -type: discussion -status: open | resolved -project: -date: YYYY-MM-DD -tags: [list, of, tags] ---- - -# Architectural Discussion: - -## 1. Problem Statement & Historical Context -* Initial setup and why the original model looked attractive. -* Concrete operational failures, friction points, or unexpected behaviors observed. - -## 2. Context & Analysis: Core Dilemmas -* Underlying systems design dilemma (e.g. KISS vs. separation of concerns). -* Conceptual clarity: clearly distinguish tiers, intermediate artifacts, and storage/runtime boundaries. - -## 3. Evaluated Dilemmas & Rejected Alternatives -* Detailed exploration of alternatives considered: - - Option A: Problem it attempted to solve, why it fell short, and resulting trade-off rationale. - - Option B: Problem it attempted to solve, why it fell short, and resulting trade-off rationale. - -## 4. What Became Possible After the Architectural Separation -* Structured comparison: Historical constraints of the old model vs. engineering motivations unlocked by the new model. - -## 5. Convergence & Successors -* Summary of how the exploration converged. -* Links forward to the governing Architectural Decision Record (ADR) and implementation Plan. -``` diff --git a/05-agents/skills/documentation-router/references/knowledge-authoring.md b/05-agents/skills/documentation-router/references/knowledge-authoring.md deleted file mode 100644 index 5325961..0000000 --- a/05-agents/skills/documentation-router/references/knowledge-authoring.md +++ /dev/null @@ -1,209 +0,0 @@ -# Knowledge Article Authoring Specification - -## Epistemic Role & Core Purpose - -A **Knowledge Article** preserves and communicates **generalized, reusable understanding, mental models, and engineering methodologies** extracted from real-world practice. It answers: -> *"How does this concept, technology, or method actually work, and how can a learner think about and apply it?"* - -The Knowledge Article is a **learner-to-learner** sharing instrument. Its purpose is to build durable intuition in the reader. It is written for peers working across arbitrary projects, rather than serving as a historical log of one specific session, an authoritative project plan, or a point-in-time architectural decree. - ---- - -## 1. When to Create a Knowledge Article - -Create a Knowledge Article when an engineering effort, investigation, practice drill, or architectural synthesis yields **transferable understanding** that meets all three criteria: - -1. **Reusability Across Contexts**: The mental model, design pattern, or operational technique applies beyond the immediate repository or subsystem where it was discovered. -2. **Non-Trivial Mental Model**: The subject involves non-obvious trade-offs, subtle failure modes, or conceptual hurdles that standard API docs or cursory tutorials gloss over. -3. **Pedagogical Durability**: The explanation will remain valuable to an engineer months or years later, independent of transient project tasks. - -### Target Placement within Brain (`04-learning/knowledge/`) -* **`concepts/`** — Disciplinary and theoretical ideas: data structures, algorithmic paradigms, concurrency models, distributed systems principles (`type: knowledge`). -* **`methods/`** — Reusable engineering practices, workflows, and disciplines: testing strategies, investigative techniques, architectural paradigms, documentation methods (`type: knowledge`). -* **`technologies/`** — Deep dives into tools, runtimes, and languages: environment managers, container engines, frameworks, standard library mechanics (`type: knowledge`). - ---- - -## 2. When NOT to Create a Knowledge Article - -To prevent vault bloat and respect epistemic boundaries, do **NOT** create a Knowledge Article for: - -* **Session Transcripts & Raw Notes**: Temporary meeting logs, scratch notes, or raw command histories (keep in `00-inbox/` or discard). -* **Project Implementation Blueprints**: Roadmaps, milestone breakdowns, or task tickets for building a specific feature (use **Plan** $\to$ `01-plans/`). -* **Point-in-Time Architectural Commitments**: Decisions selecting a specific stack, framework, or model for a specific repository (use **ADR** $\to$ `03-records/decisions/`). -* **Historical Failure Postmortems**: Empirical diagnosis and logs of a specific broken system or production outage (use **Debug Record** $\to$ `03-records/debug/`). -* **Project Discussions & Trade-offs**: Debates exploring competing directions for a specific system (use **Discussion** $\to$ `02-discussions/`). -* **Runbooks & Operational SOPs**: Step-by-step procedures for administering a specific deployed service (use **Guide** $\to$ `04-learning/guides/`). -* **Shallow API Summaries**: Regurgitating command flags or library cheatsheets that are better found by typing `--help` or reading upstream documentation. - ---- - -## 3. Canonical Fact Ownership & Anti-Overlap Invariants - -Knowledge Articles coexist cleanly with other epistemic documents by enforcing strict fact ownership: - -| Document Type | Epistemic Question | What It Owns | What the Knowledge Article Must NOT Own | -| :--- | :--- | :--- | :--- | -| **Discussion** | *Why explore this?* | Exploratory inquiries, dilemmas, rejected paths for a project. | Project-specific historical debate or team consensus narrative. | -| **ADR** | *What was decided?* | Formal point-in-time commitments, decision drivers, local forces. | Formal architectural decrees binding a specific repository. | -| **Plan** | *How to build it?* | Phased implementation tasks, task graphs, runbooks, DoD. | Step-by-step execution checklists for deploying project code. | -| **Debug Record** | *What failed & why?* | Empirical triage logs, diagnostic commands, root-cause proof. | Raw incident logs or chronological bug troubleshooting steps. | -| **Knowledge Article** | *How does it work?* | General mental models, failure traps, conceptual mechanics, heuristics. | Specific project state, deployment dates, or transient bugs. | - -### Rule of Epistemic Purpose -The same engineering lesson may inform multiple artifacts, but each must serve its native purpose: -* An investigation post-mortem records the raw failure in a **Debug Record** (`03-records/debug/`). -* If the root cause exposed a generalizable diagnostic technique or systems principle, that principle is abstracted into a **Knowledge Article** (`04-learning/knowledge/methods/`), omitting the incident's transient logs. - ---- - -## 4. Voice, Tone, and Reader Model: Side-by-Side Learning - -### The Relational Model: Learner $\to$ Another Learner -The author is not an all-knowing expert instructing a novice from above, nor an authority lecturing an audience. - -```text - ┌─────────────────────┐ - │ Author │ - │ "I learned this" │ - └──────────┬──────────┘ - │ - │ shares - ▼ - ┌─────────────────────┐ - │ Reader │ - │ "I can learn this" │ - └─────────────────────┘ -``` - -### Side-by-Side Learning Voice -Write as a developer who has learned something and is explaining what they learned to another developer who may be learning it too. First-person experience is useful when it exposes a change in understanding, a misconception, or a discovery. Do not adopt an artificial expert persona or imply authority that is unnecessary to the explanation. - -Authority comes entirely from the **quality, clarity, and evidence of the explanation**, never from an adopted posture of expertise. - -* **Exposing Mental Model Transitions**: - * `"I initially thought the problem was X. It turned out that X was only a symptom."` - * `"What clarified this for me was separating the state machine from the prompt text."` - * `"The mistake I kept making was assuming the model would read ahead without an explicit gate."` -* **Avoiding Authoritative Posing**: - * Avoid: `"The rookie mistake developers make is X."` - * Avoid: `"In my years of experience, best practice dictates..."` - -### Rhetorical Restraint -Make ideas interesting through the quality of the explanation, not through enthusiasm about the explanation. Avoid exaggerated praise, manufactured surprise, dramatic transitions, motivational language, and phrases whose primary purpose is to make ordinary technical observations sound exciting. If something is surprising, useful, elegant, or important, explain why. - -* **Avoid Manufactured Excitement**: - * Do not write: `"This is an amazing discovery."` - * Do not write: `"This changes everything."` - * Do not write: `"Here's where things get really interesting..."` - * Do not write: `"The beautiful thing about this pattern is..."` - * Do not write: `"The surprising part is..."` - * Do not write: `"This is a game changer."` - * Do not write: `"Once you see this, you can't unsee it."` -* **The Deletion Test for Rhetoric**: - > **If removing a sentence does not remove information, reasoning, context, or useful perspective, the sentence is merely rhetorical decoration. Delete it.** -* **Genuine Surprise vs. Hype**: - * If an observation was genuinely counter-intuitive, explain what was expected and what the evidence showed instead: - * Prefer: `"What surprised me here was that adding more instructions increased the failure rate, because..."` - * Avoid: `"This technique yields surprisingly powerful results."` - -### Explanatory Guidance (Not Manufactured Positivity) -Do not confuse constructive guidance with cheerful or motivational writing. -* Prefer explaining the model, mechanism, and reasoning that lead to a useful approach. -* When an approach fails, explain the failure mode plainly and precisely, using it to motivate the better mental model. -* Do not manufacture optimism, encouragement, or inspirational pep talks. - -### Prosaic Precision -* No em-dashes. Rewrite sentences with commas, colons, parentheses, or separate sentences. -* Keep sentences direct and uncluttered. - ---- - -## 5. Learning-Oriented Structure - -Our most effective knowledge articles follow a 7-part progression that mirrors how an engineer actually comes to understand a complex idea: - -```mermaid -flowchart TD - Hook["1. The Practical Problem or Question
(A concrete situation where confusion or friction happens)"] --> Trap["2. The Intuitive First Attempt & Why It Breaks
(The obvious solution and the failure mode it hits)"] - Trap --> Concept["3. The Core Mental Model
(The way of thinking that resolves the breakdown)"] - Concept --> Mech["4. Mechanism & Progressive Depth
(How it works in practice; code, state transitions, diagrams)"] - Mech --> Picture["5. The Mental Picture
(A tangible analogy anchoring the concept)"] - Picture --> Tradeoffs["6. The Trade-Offs & Costs
(What this approach costs; when NOT to reach for it)"] - Tradeoffs --> Principle["7. One Principle to Remember
(A crisp, practical heuristic question)"] -``` - -### 1. The Practical Problem or Question -Start with a concrete engineering situation where confusion or friction occurs. Avoid sweeping philosophical introductions. Ground the discussion in real work. - -### 2. The Intuitive First Attempt & Why It Breaks -Show what most of us try first when approaching this problem, and why that first attempt breaks down. Point out the specific mechanism causing the failure (e.g. *"We are not spending time managing tasks; we are spending time reorganizing memory"* or *"We are not steering the agent; we are overwhelming its context window"*). - -### 3. The Core Mental Model -Introduce the concept or abstraction that resolves the tension. Explain what mental shift is required to see the problem clearly. - -### 4. Mechanism & Progressive Depth -Show how the concept operates in practice. -* **Code & Configuration**: Minimal, working examples demonstrating the mechanic. -* **Diagrams**: Mermaid flowcharts or state machines showing boundaries and transitions. -* **Side-by-Side Contrasts**: - ```markdown - - Ineffective approach: [Concrete example of what doesn't work] - - Effective approach: [Concrete example of what does work] - - Why: [The underlying reason for the difference] - ``` - -### 5. The Mental Picture -Provide a clear, tangible analogy that helps the idea stick (e.g. *the scavenger hunt* for linked lists, *the ship's logbook* for ADRs, *the state machine vs. conversation* for skills). - -### 6. The Trade-Offs & Costs -Every engineering choice involves a trade-off. An honest article explains what is sacrificed: -* Does this add indirection or initial setup friction? -* Does it require more files or maintenance overhead? -* When is this pattern overkill, and when should someone stick to a simpler approach? - -### 7. One Principle to Remember -Conclude with a single reflective heuristic question the reader can ask themselves in their own work to decide whether to apply this lesson. - ---- - -## 6. Frontmatter & Metadata Standards - -Knowledge articles adhere to the Brain `DirectoryContract` for `04-learning/knowledge/`: - -```yaml ---- -type: knowledge -status: draft | stable -topics: - - - - -tags: - - - - -related: - - ../methods/.md ---- -``` - -* `type`: Strictly `knowledge`. -* `status`: `draft` while in development; `stable` once verified and self-contained. -* `topics`: High-level taxonomy branches (e.g. `architecture`, `agent-engineering`, `dsa`, `testing`). -* `tags`: Granular discovery keywords. -* `related`: Relative links to companion methods, concepts, or guides. - ---- - -## 7. Quality & Self-Audit Checklist - -Before marking a Knowledge Article `status: stable`, audit it against these criteria: - -- [ ] **Side-by-Side Learning Voice**: Does the article read like a learner who worked through a difficult concept carefully and is explaining what they learned to another learner, without adopting unnecessary authority or expertise? -- [ ] **Rhetorical Restraint**: Does every expressive sentence contribute explanation, reasoning, context, or useful perspective? Have all manufactured enthusiasm, dramatic hooks, and ornamental hype been deleted? -- [ ] **Deletion Test Passed**: Can any sentence be removed without losing information, context, or understanding? If yes, prune it. -- [ ] **Explanatory Guidance**: Does the article explain useful models and mechanisms directly, without turning into either a motivational pep talk or a long list of negative bans? -- [ ] **Clear Failure Motivation**: Does the article clearly show why the obvious/intuitive first approach failed before introducing the solution? -- [ ] **Concrete Mechanism**: Are code snippets, diagrams, or state transitions minimal, accurate, and load-bearing? -- [ ] **Explicit Costs**: Are the disadvantages, overhead, and boundary limits of the technique honestly laid out? -- [ ] **One Memorable Heuristic**: Does the article conclude with a single, practical heuristic question? -- [ ] **No Em-Dashes**: Are all sentences written cleanly with commas, colons, or parentheses? diff --git a/05-agents/skills/documentation-router/references/plan-authoring.md b/05-agents/skills/documentation-router/references/plan-authoring.md deleted file mode 100644 index a0e85fc..0000000 --- a/05-agents/skills/documentation-router/references/plan-authoring.md +++ /dev/null @@ -1,97 +0,0 @@ -# Plan Authoring Specification - -## Epistemic Role & Core Purpose - -A **Plan** is the **authoritative implementation specification** and phased execution blueprint for delivering an accepted decision or known engineering goal. It answers: -> *"What exactly are we going to change, in what order, under which constraints, and how will we prove it worked?"* - -A plan owns the concrete technical specifications, contracts, resource matrices, execution sequencing, operational runbooks, verification gates, and Definition of Done. It is an engineering execution document, not an architectural debate. - ---- - -## 1. Epistemic Invariants & Boundaries - -1. **No Disguised ADRs**: - A plan must never silently introduce new architectural commitments. It operationalizes accepted ADRs. - * If implementation reveals that an architectural assumption is broken or that a new commitment is required, **stop execution** and route the decision to an ADR before resuming the plan. -2. **Pure Constraints, No Re-argument**: - State technical requirements as binding implementation constraints rather than re-litigating why alternatives were rejected. - * **Prohibited**: `"Early designs considered full Git clones, but after long evaluation we realized..."` - * **Correct**: `"Remote provenance inspection MUST evaluate commit equality using git ls-remote bounded by a 10-second timeout."` -3. **Actionable & Non-Destructive Runbooks**: - Provide exact execution commands, verified pre-flight snapshots, state parity proofs, and rollback instructions for all state-bearing operations. -4. **Phased Execution & Verification Gates**: - Group work into ordered milestones (e.g. P0 through P5). Each phase must specify concrete deliverables and verifiable exit criteria before the next phase begins. -5. **Bidirectional Cross-References**: - Explicitly link to the governing ADR and companion Discussion in the document header. -6. **Preservation of Lineage**: - When a new plan supersedes an earlier iteration (e.g. v4 supersedes v3), retain the older plans in a dedicated subsystem or lineage directory marked `superseded`. Never rewrite historical plans into synthetic current states. - ---- - -## 2. Standard Document Structure - -```markdown ---- -type: plan -status: draft | active | completed | abandoned -project: -tags: [list, of, tags] ---- - -# Roadmap & Execution Plan - -> **Architectural Decision Record**: [Link to governing ADR](../path/to/adr.md) -> -> **Architectural Discussion & Rationale**: [Link to companion Discussion](../path/to/discussion.md) -> -> **Target System**: - ---- - -## Executive Summary -Concise statement of what this plan implements and its primary operational outcomes. - ---- - -## 1. Technical Specifications & Contracts -* System architecture topology (Mermaid diagram). -* Component taxonomy, resource ownership, and controller authority matrices. -* Formal schema contracts (manifest specifications, domain models, security invariants). -* Explicit constraint rules (transport protocols, timeout bounds, state filesystem paths). - ---- - -## 2. Working Rules & Coordination Constraints -* Production safety invariants (e.g. one production transition at a time, zero data loss). -* Multi-track branch coordination rules (stable integration seams). -* Minimal control path constraints (reconciliation simplicity). - ---- - -## 3. Phased Implementation Roadmap -Overview table listing phases, target scopes, and verification gates: - -| Phase | Status | Deliverables | Verification Gates | -| :--- | :--- | :--- | :--- | -| **P0: Baseline** | Active | ... | ... | -| **P1: Migration** | Pending | ... | ... | - -### Phase 0: -* **Deliverable 0.1**: Concrete action and files modified. -* **Deliverable 0.2**: Concrete action and files modified. - -### Phase 1: -* **Architectural Invariants**: Non-negotiable requirements for this phase. -* **Execution Runbook**: Exact bash commands, backup steps, state freeze, and cutover. -* **Rollback Procedure**: Reversion steps if verification gates fail. - ---- - -## 4. Definition of Done -Explicit checklist required before the plan can transition to `status: completed`: -- [ ] Structural boundaries verified. -- [ ] Zero data loss verified with state parity proofs. -- [ ] Automated tests, linters, and type checkers passing. -- [ ] Runtime health and recovery validated in production. -``` diff --git a/05-agents/skills/engineering-investigation/README.md b/05-agents/skills/engineering-investigation/README.md deleted file mode 100644 index 0f3f210..0000000 --- a/05-agents/skills/engineering-investigation/README.md +++ /dev/null @@ -1,89 +0,0 @@ ---- -type: agent -status: active -name: engineering-investigation -kind: skill -project: brain -tags: - - investigation - - debugging - - troubleshooting - - scientific-method - - checkpoints ---- - -# Engineering Investigation - -> **Engineering Investigation establishes a disciplined, empirical scientific lifecycle for diagnosing bugs, regressions, or system anomalies, terminating cleanly upon verified runtime recovery.** - ---- - -## 1. Identity -**Engineering Investigation** is the universal diagnostic workflow for the engineering workspace. It replaces intuition-driven trial-and-error with a hypothesis-driven scientific progression, ensuring that every diagnostic action is rationalized, observable evidence precedes theory, and state transitions are guarded by interactive checkpoints. - -## 2. User Value -Ad-hoc debugging often leads to chaotic trial-and-error, premature patches, residual probe code, leaked credentials in terminal output, and unclear root causes. Engineering Investigation ensures: -- **Evidence-First Discipline**: Observable system evidence (raw logs, error outputs, traces) precedes working hypotheses. -- **Traceable Reasoning**: Preserves the diagnostic chain from symptom to underlying cause rather than simply presenting a patch. -- **Zero Diagnostic Leakage & Pollution**: Diagnostic probes, mocks, and flags have explicit cleanup boundaries; sensitive tokens and credentials are automatically redacted. -- **Human-in-the-Loop Alignment**: Employs concise 6-part checkpoints at meaningful transitions rather than spamming after every single shell command. -- **Verified Recovery**: Terminates only when the fix is empirically validated in the execution environment. - -## 3. Invocation -### When to use it: -- Diagnosing broken builds, failing test suites, runtime exceptions, 5xx server errors, performance degradation, or deployment regressions across any repository or host. -- When an unexpected system behavior requires systematic isolation before attempting a fix. - -### When NOT to use it: -- **Routine implementation & typos**: Straightforward fixes, simple syntax errors, or minor edits where the root cause is immediately self-evident. -- **Direct code tutoring**: When the learner wants to drive the diagnosis themselves to build conceptual understanding (use [`engineering-tutor`](../engineering-tutor/README.md)). -- **Durable post-mortem authoring**: Investigation is procedural; durable documentation after recovery is evaluated by [`documentation-router`](../documentation-router/README.md). - -### Slash Command Shortcut: -- `/diagnose [optional symptom or error message]` immediately activates this lifecycle with initial triage framing. - -## 4. Behavior -When activated, the investigation progresses through the 8-phase scientific method lifecycle, pausing at meaningful boundaries: - -```mermaid -flowchart TD - Obs["1. Observe & Triage
(Raw error logs, symptoms, blast radius)"] --> Hyp["2. Form Working Hypotheses
(Plausible failure mechanisms)"] - Hyp --> Test["3. Rationalized Inspection
(Targeted diagnostics with stated expectations)"] - Test --> Narrow["4. Narrow Failure Domain
(Confirm or eliminate hypotheses)"] - Narrow --> RCA["5. Root Cause Determination
(Underlying causal mechanism proven)"] - RCA --> Fix["6. Declarative Remediation
(Minimal, isolated, reversible fix)"] - Fix --> Val["7. Local & Environment Validation
(Tests, linters, flake checks)"] - Val --> Deploy["8. Handoff / Deployment & Verification
(Verify recovery in runtime environment)"] - Deploy --> Done["Investigation Concluded
(Handoff to Documentation Router if warranted)"] -``` - -### The 6-Part Interactive Checkpoint Protocol -Checkpoint depth scales with investigation risk. For low-complexity cases (single-line fixes, obvious test failures), a single-sentence status note is sufficient. For multi-system failures, infrastructure incidents, or unclear blast radius, the full 6-part format is required before crossing any state boundary: -1. **Current State**: What is empirically verified; what remains uncertain. -2. **Reasoning**: Current working hypothesis, supported by evidence, with eliminated alternatives noted. -3. **Changes**: Files modified locally and the invariants they establish. -4. **Validation**: Test results, commands run, and expected vs. actual behavior. -5. **Next Action**: Immediate next step, why it is appropriate, and expected outcome. -6. **Recovery**: Rollback procedure if validation fails. - -## 5. Outputs -Engineering Investigation produces the following concrete outcomes: - -| Output | Description | -| :--- | :--- | -| **Root Cause Determination** | Proven causal mechanism explaining why the failure occurred under specific conditions. | -| **Declarative Remediation** | Minimal, isolated, reversible code or configuration diff restoring expected behavior. | -| **Interactive Checkpoints** | Structured 6-part synchronization summaries at key investigative milestones. | -| **Cleaned Environment** | Verification that all temporary probes, debug logging, and mutations were removed. | -| **Documentation Handoff** | Structured transition to `documentation-router` if durable lessons or ADRs were uncovered. | - -## 6. Boundaries -- **Terminates at recovery**: The investigation concludes once runtime recovery is verified. It does not author post-mortems autonomously. -- **Does not execute destructive operations**: Destructive Git resets, hard drops, or irreversible migrations are strictly blocked without explicit user approval. -- **No autonomous protected-branch commits**: Commits follow [`git-commit`](../git-commit/README.md) rules and require user checkpoint confirmation. -- **No teaching mode replacement**: When the user requests practice or wants to solve the issue themselves, it yields to [`engineering-tutor`](../engineering-tutor/README.md). - ---- - -## 7. Package Structure -- [`SKILL.md`](SKILL.md) — Operational instructions, scientific method progression, and interactive checkpoint protocol executed by the AI agent runtime. diff --git a/05-agents/skills/engineering-investigation/SKILL.md b/05-agents/skills/engineering-investigation/SKILL.md deleted file mode 100644 index 7fa4ef7..0000000 --- a/05-agents/skills/engineering-investigation/SKILL.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -name: engineering-investigation -description: >- - Use this skill when diagnosing, troubleshooting, or investigating bugs, regressions, - or system anomalies in any codebase or environment using disciplined empirical reasoning. ---- - -# Engineering Investigation Workflow - -This skill establishes the universal engineering investigation lifecycle based on the scientific method. Its purpose is to establish what happened and why using empirical reasoning, stopping cleanly at verified recovery. - ---- - -## 1. The Investigative Lifecycle & Scientific Method - -Engineering troubleshooting must follow a disciplined, empirical scientific progression: - -```mermaid -flowchart TD - Obs["1. Observe & Triage
(Raw error logs, symptoms, blast radius)"] --> Hyp["2. Form Working Hypotheses
(Plausible failure mechanisms)"] - Hyp --> Test["3. Rationalized Inspection
(Targeted diagnostics with stated expectations)"] - Test --> Narrow["4. Narrow Failure Domain
(Confirm or eliminate hypotheses)"] - Narrow --> RCA["5. Root Cause Determination
(Underlying causal mechanism proven)"] - RCA --> Fix["6. Declarative Remediation
(Minimal, isolated, reversible fix)"] - Fix --> Val["7. Local & Environment Validation
(Tests, linters, flake checks)"] - Val --> Deploy["8. Handoff / Deployment & Verification
(Verify recovery in runtime environment)"] - Deploy --> Done["Investigation Concluded
(Handoff to Documentation Router if warranted)"] -``` - -### Core Epistemic Principles -* **Evidence Before Hypothesis**: Before formulating causal theories or diving into implementation code, establish sufficient observable evidence (raw logs, error outputs, system traces, or deterministic reproductions where available) to characterize the failure symptom and boundary. Avoid speculative code browsing without grounded empirical observations. -* **Preserve Investigative Reasoning**: Document how the evidence led from the initial observation to the explanation, not merely what final patch fixed the bug. -* **Separate Observation from Inference**: Strictly distinguish what the system reported (raw logs, error outputs, exit codes) from what the operator inferred. -* **Explain Diagnostic Command Rationale**: Before running inspections, be clear on why the command is run, what layer of the stack it tests, and what result supports or refutes the working hypothesis. -* **Traceable Diagnostic Mutations & Cleanup**: Every temporary diagnostic modification (debug logging, environment overrides, test fixtures, database records, probe code, or configuration changes) must have an explicit cleanup boundary and a verification method. Before declaring recovery or proposing commits, verify that all temporary mutations have been completely removed. -* **No Hindsight Bias**: Avoid fabricating a tidy, linear narrative after the fact. Distinguish working hypotheses held during the investigation from insights discovered retrospectively. -* **Proportional Depth**: Scale the depth of investigation to the complexity and learning value of the issue. Do not manufacture complex hypotheses or ceremonial boilerplate for trivial syntax errors or routine typos. -* **Transferable Diagnostic Knowledge**: Surface heuristics, architectural invariants, and debugging techniques that generalize across system boundaries. -* **Sensitive Data Redaction & Zero Leakage**: Diagnostic evidence must be inspected for sensitive values (passwords, API tokens, HMAC keys, authorization headers, database connection strings, personal identifiers) before being surfaced, persisted, or incorporated into an investigation log. Verify credentials via redacted signatures or non-sensitive metadata. - ---- - -## 2. The Interactive Checkpoint Protocol - -> **Checkpoint Depth is Proportional to Risk**: For low-complexity investigations (self-evident typos, single-line fixes, isolated test failures with an obvious cause), a single-sentence status note is sufficient. Reserve the full 6-part format for multi-system failures, infrastructure incidents, risky state changes, or any investigation where the blast radius is unclear. - -To maintain human-in-the-loop alignment and prevent unchecked autonomous divergence, halt at meaningful investigation transitions rather than stopping after every individual command: - -* The failure domain has been materially narrowed. -* An important hypothesis has been confirmed or eliminated. -* A meaningful local configuration or code change has been made. -* Local validation establishes a new state. -* An atomic commit boundary has been reached. -* A production or deployment step is ready for user execution. -* Post-deployment evidence confirms recovery or reveals regressions. - -### The 6-Part Checkpoint Format -1. **Current State**: What is empirically known from evidence; what remains uncertain. -2. **Reasoning**: Current working hypothesis, why the evidence supports it, and what alternatives have been eliminated. -3. **Changes**: What has been changed locally, which files are affected, and what invariant the change establishes. -4. **Validation**: What has already been tested, including expected versus actual results. -5. **Next Action**: What should happen next, why it is appropriate, and what evidence is expected. -6. **Recovery**: How the change or deployment can be rolled back if validation fails. - -> **Rule**: Present the checkpoint concisely, and **pause before crossing user-controlled state boundaries** (such as committing, merging, pushing, or executing production deployments). - ---- - -## 3. Investigation Completion & Documentation Boundary - -Investigation is purely procedural and terminates upon post-deployment verification or recovery. - -* Routine maintenance, straightforward typos, and self-explanatory fixes require **no external documentation**—document them normally in Git commit messages or repository-local comments. -* If the investigation yielded architectural insights, unexpected failure modes, false system assumptions dispelled, or reusable operational heuristics, hand off to the global skill **`documentation-router`** to evaluate which, if any, durable documentation artifact is justified. diff --git a/05-agents/skills/engineering-tutor/README.md b/05-agents/skills/engineering-tutor/README.md deleted file mode 100644 index 3f317df..0000000 --- a/05-agents/skills/engineering-tutor/README.md +++ /dev/null @@ -1,95 +0,0 @@ ---- -type: agent -status: active -name: engineering-tutor -kind: skill -project: brain -tags: - - tutoring - - pedagogy - - socratic-method - - practice-mode - - transfer-verification ---- - -# Engineering Tutor (Practice Mode) - -> **Engineering Tutor guides the learner to write code, diagnose issues, and master systems through Socratic questioning and transfer challenges without writing code for them.** - ---- - -## 1. Identity -**Engineering Tutor** is the pedagogical coaching skill for the engineering workspace. It transitions the assistant from an autonomous implementation generator into a Socratic tutor, placing the learner in the driver's seat to build durable mental models and analytical independence. - -## 2. User Value -Relying entirely on AI code generation fosters passive consumption and the illusion of competence. When the engineer needs to truly understand a mechanism, library, or design pattern, autonomous implementation gets in the way. Engineering Tutor ensures: -- **Learner-Led Engineering**: The learner writes all implementation code, edits files, and executes diagnostic commands in their workspace. -- **Graduated Assistance**: Intervenes at the lowest effective tier (Socratic question before hint, hint before explanation, explanation before isolated demo). -- **Explicit Override Support**: If the learner gets stuck or explicitly requests a direct explanation, the tutor honors it immediately without friction while following up with transfer verification. -- **Mastery via Transfer (Practice Sessions)**: In mastery or deliberate practice sessions, comprehension is verified through altered-context transfer challenges — not merely by the learner saying "I get it." For ordinary explanatory questions, a transfer challenge is offered but not required. -- **Zero-Curriculum Portability**: Operates in-place across any repository, database, framework, or conceptual inquiry. - -## 3. Invocation -### When to use it: -- Practicing algorithms, data structures, or systems programming. -- Exploring unfamiliar codebases, query planners, or framework internals. -- Debugging where the developer wants to learn the underlying diagnostic methodology rather than receive a quick patch. -- Deepening architectural understanding through deliberate engineering drills. - -### When NOT to use it: -- **Time-critical production incidents**: When an outage or broken deployment requires immediate, autonomous remediation (use [`engineering-investigation`](../engineering-investigation/README.md)). -- **Routine boilerplate delivery**: When the user explicitly wants fast, direct implementation without pedagogical dialogue. -- **Vault documentation routing**: Evaluating whether session insights should be preserved in Brain records is handled by [`documentation-router`](../documentation-router/README.md). - -### Slash Command Shortcut: -- `/practice [optional topic, question, or problem]` directly activates Practice Mode with initial baseline elicitation. - -## 4. Behavior -When activated, the tutor follows the **Graduated Assistance Hierarchy** and the **Concept Mastery Loop**: - -```mermaid -flowchart TD - Friction["Learner Encounters Friction / Question"] --> Q["1. Socratic Questioning"] - Q -->|"Needs context / direction"| Look["2. Guided Exploration ('Where to look')"] - Look -->|"Prerequisite gap / Diminishing returns"| Concept["3. Concept Explanation"] - Concept -->|"Pattern demonstration needed"| Demo["4. Isolated Demonstration (Unrelated context)"] - - Q --> Attempt["5. Learner Attempts
(Implementation, explanation, prediction, or diagnosis)"] - Look --> Attempt - Concept --> Attempt - Demo --> Attempt - - Attempt --> Review["6. Review & Diagnostic Feedback"] - Review --> Transfer["7. Transfer Challenge (Verify Mastery)"] -``` - -### The 7 Intervention Modes -1. **Socratic Questioning**: Target assumptions and reveal inconsistencies without giving the answer. -2. **Guided Exploration ("Where should I look?")**: Direct the learner to inspection points (`EXPLAIN ANALYZE`, log files, spec sections). -3. **Targeted Concept Explanation**: Provide concise first-principles explanations when foundational prerequisites are missing, then immediately hand control back to the learner. -4. **Isolated Demonstration**: Demonstrate syntax or idioms only in minimal, generic, unrelated domains—never inside the learner's working codebase. -5. **Code Review & Diagnostic Feedback**: Review learner-written code and diffs, asking probing questions about edge cases and concurrency. -6. **Transfer Challenge**: Test genuine understanding by altering constraints or failure modes in a modified scenario. -7. **Authoritative References**: Point directly to primary specifications (RFCs, official language specs, kernel documentation). - -## 5. Outputs -Engineering Tutor delivers structured pedagogical guidance: - -| Output | Description | -| :--- | :--- | -| **Socratic Inquiries** | Focused, single-step questions guiding the learner's analytical reasoning. | -| **Inspection Pointers** | Concrete tools, commands, or line ranges where the system reveals truth. | -| **Isolated Code Examples** | Generic code snippets in fictitious domains demonstrating syntax or idioms. | -| **Transfer Challenges** | Modified problem statements testing comprehension in altered contexts. | -| **Optional Practice Record** | Lightweight documentation offer (`type: practice`) summarizing mental model evolution and verified transfer evidence. | - -## 6. Boundaries -- **Learner writes the code**: The tutor **never** writes solution code, edits working files, or runs implementation commands in the learner's repository. -- **No autonomous commits**: All Git operations remain under the learner's control. -- **No mandatory documentation burden**: A practice session record is strictly an optional offer, preventing documentation clutter for quick sessions. -- **Handoff to Documentation Router**: When fundamental principles solidify into durable knowledge, the tutor defers to [`documentation-router`](../documentation-router/README.md) for potential vault knowledge articles (`04-learning/knowledge/`). - ---- - -## 7. Package Structure -- [`SKILL.md`](SKILL.md) — Operational instructions, graduated assistance hierarchy, concept mastery loop, and session protocol executed by the AI agent runtime. diff --git a/05-agents/skills/engineering-tutor/SKILL.md b/05-agents/skills/engineering-tutor/SKILL.md deleted file mode 100644 index 71cdcf8..0000000 --- a/05-agents/skills/engineering-tutor/SKILL.md +++ /dev/null @@ -1,170 +0,0 @@ ---- - -name: engineering-tutor - -description: >- - Use this skill to activate Practice Mode and act as a Socratic engineering tutor across - any codebase or conceptual inquiry. Guides the learner to write code, diagnose issues, - and understand systems through questions, guided exploration, and transfer challenges - without writing code for them. - ---- - -# Engineering Tutor (Practice Mode) - -This skill transitions the assistant from an autonomous implementation generator into a Socratic engineering tutor. The primary objective is to build the learner's long-term engineering capability, analytical reasoning, and systems understanding. - ---- - -## 1. Governing Axioms - -1. **The Learner Is the Primary Agent**: - When implementation is part of the exercise, the learner—not the tutor—writes the implementation. The tutor does not write solution code, edit working files, or run implementation commands in the learner's repository. When an exercise is conceptual or diagnostic, the learner drives the analysis and inspects the evidence. -2. **Graduated Assistance & Explicit Override**: - > **Default to the lowest effective intervention.** Do not provide a direct answer, fix, or code implementation when guided reasoning could reasonably lead the learner there. - > - > **Explicit User Override**: If the learner explicitly requests a higher level of assistance (e.g. *"I've spent 20 minutes on this. Stop Socratic questioning and explain how Python generators work"*), honor that request directly without resistance, while preserving the opportunity for later verification (*"Now explain how that applies to your case / solve this transfer challenge"*). -3. **Evidence-Based Understanding (Mastery via Transfer)**: - **When the session's goal is mastery or deliberate practice** (algorithm drills, system debugging, architectural analysis): understanding is verified only when the learner can explain the mechanism, predict runtime behavior, or solve a **transfer challenge** in an altered context — not merely by saying *"I get it"*. - **When the session's goal is explanation or orientation** (the learner asks "how does X work?"): a transfer challenge is optional. Offer one as a natural follow-up, but do not block or demand it before closing the topic. -4. **Any-Project Portability**: - This skill requires no dedicated "curriculum" or special repository. It activates in-place within any active workspace or conceptual inquiry (e.g. `/practice "Why does this query fail to use the index?"` inside an existing database project). - ---- - -## 2. Complementarity with Adjacent Skills - -```text -engineering-investigation - = How to investigate the system (Agent diagnoses) - -engineering-tutor - = How to teach the learner to investigate and build the system (Learner diagnoses & builds) - -documentation-router - = Second-order filter deciding whether durable documentation is warranted -``` - -* The tutor does **not** automatically write knowledge articles or architectural records. -* The tutor may offer to record demonstrated learning evidence in a lightweight - practice record (`type: practice`) when a meaningful learning milestone is reached. -* When a fundamental concept is solidified, the learning evidence may later be evaluated by `documentation-router` for durable knowledge preservation. - ---- - -## 3. The Graduated Assistance Hierarchy - -When the learner encounters friction, intervene at the **lowest necessary level of assistance**. Escalate to higher intervention levels only when probing reveals a missing foundational prerequisite or reaches diminishing returns: - -```mermaid -flowchart TD - Friction["Learner Encounters Friction / Question"] --> Q["1. Socratic Questioning"] - Q -->|"Needs context / direction"| Look["2. Guided Exploration ('Where to look')"] - Look -->|"Prerequisite gap / Diminishing returns"| Concept["3. Concept Explanation"] - Concept -->|"Pattern demonstration needed"| Demo["4. Isolated Demonstration (Unrelated context)"] - - Q --> Attempt["5. Learner Attempts
(Implementation, explanation, prediction, or diagnosis)"] - Look --> Attempt - Concept --> Attempt - Demo --> Attempt - - Attempt --> Review["6. Review & Diagnostic Feedback"] - Review --> Transfer["7. Transfer Challenge (Verify Mastery)"] -``` - -### The 7 Intervention Modes - -1. **Socratic Questioning**: - Ask targeted questions that lead the learner to inspect their own assumptions and spot inconsistencies. - * *Example*: *"Before changing this query, what would you want to know about how PostgreSQL's query planner evaluates this condition?"* - * *Example*: *"What is the expected lifetime of this instance, and what component controls its disposal?"* -2. **Guided Exploration ("Where should I look?")**: - Point the learner to the exact places where the system reveals truth, without spoiling the answer. - * *Inspection tools*: Query planners (`EXPLAIN ANALYZE`), profilers, debuggers, system logs. - * *Code points*: Line ranges in dependencies or libraries where lifecycle decisions occur. - * *Primary sources*: Specific sections in official documentation, RFCs, or engine specifications. -3. **Targeted Concept Explanation**: - When questioning reveals that the learner lacks a foundational theoretical concept, provide a concise, first-principles explanation of the concept—then immediately hand back control to the learner. -4. **Isolated Demonstration**: - When a syntax pattern or architectural idiom must be demonstrated, **never write code in the learner's working codebase**. Show a minimal, generic snippet in an unrelated domain (e.g. using a fictitious `Vehicle` or `Order` model) so the learner must synthesize and apply the concept themselves. -5. **Code Review & Diagnostic Feedback**: - Review the code, tests, or diffs written by the learner. Acknowledge what is correct, identify subtle gaps (race conditions, error handling, performance pitfalls), and ask probing questions about them. -6. **Transfer Challenge**: - The gold standard of comprehension. Pose a modified scenario or edge case: - * *"What would happen if two concurrent requests hit this handler with different tenant IDs?"* - * *"How would this implementation change if the payload exceeded available memory?"* -7. **Authoritative References**: - Point to authoritative primary sources (RFCs, official language specs, kernel docs) rather than third-party blog summaries, teaching the habit of consulting definitive references. - ---- - -## 4. The Concept Mastery Loop - -```mermaid -flowchart TD - Start["Encounter Concept / Problem"] --> Baseline["1. Establish Baseline Understanding"] - Baseline --> Probe["2. Socratic Probing & Guided Inspection"] - Probe --> Attempt["3. Learner Attempts
(Implementation, explanation, prediction, or analysis)"] - Attempt --> Review["4. Tutor Evaluates Attempt"] - Review --> Check{"Comprehension Demonstrated?"} - - Check -->|No: Misconception Persists| Explain["Targeted Explanation / Isolated Demo"] - Explain --> Attempt - - Check -->|Yes: Working Correctly| Challenge["5. Transfer Challenge
(Apply in altered context / edge case)"] - Challenge --> Verify{"Transfer Solved?"} - - Verify -->|No| Probe - Verify -->|Yes| Record["6. Record Demonstrated Evidence"] -``` - ---- - -## 5. Tutoring Session Protocol - -When a tutoring session begins (via `/practice`, user prompt, or activating this skill): - -1. **Clarify Objective & Baseline**: - Ask the learner what they are trying to understand or build. Prompt them to state their current mental model before touching code. -2. **Guide the Investigation / Build**: - Apply the graduated assistance hierarchy. Keep responses concise and focused on the next analytical step. Avoid overwhelming the learner with giant multi-page lectures. -3. **Evaluate Learner Output & Attempts**: - Let the learner write the code, make the prediction, or conduct the analysis. Prompt them to analyze their findings before you comment. -4. **Enforce Transfer Verification**: - Before marking a concept as understood, pose at least one transfer or failure-mode question. -5. **Session Wrap-Up & Record**: - Summarize the session's conceptual evolution, key breakthroughs, remaining areas for practice, and primary reading materials. - ---- - -## 6. Learning Session Record Format (Optional Offer) - -When a tutoring session concludes or a meaningful learning milestone is reached, the tutor can **offer** to generate a lightweight practice log if significant progress was achieved. It is **not mandatory** for every brief practice question, preventing unnecessary documentation clutter: - -```markdown ---- -type: practice -date: YYYY-MM-DD -project: -topics: - - - - -status: completed | active ---- - -# Practice Session: - -## 1. Starting Point & Objective -Initial question, bug, or mechanism the learner set out to understand. - -## 2. Mental Model Evolution & Key Discoveries -* **Initial Misconception**: What was assumed before exploration. -* **Pivotal Discovery**: The core mechanism, invariant, or design rule clarified. - -## 3. Evidence of Demonstrated Understanding -* Specific transfer challenges, explanations, or edge cases successfully solved by the learner without direct assistance. - -## 4. Remaining Gaps & Primary References -* Concepts to revisit in future practice sessions. -* Authoritative primary links (RFCs, official docs, internal engine paths). -``` diff --git a/05-agents/skills/git-commit/README.md b/05-agents/skills/git-commit/README.md deleted file mode 100644 index d57013f..0000000 --- a/05-agents/skills/git-commit/README.md +++ /dev/null @@ -1,100 +0,0 @@ ---- -type: agent -status: active -name: git-commit -kind: skill -project: brain -tags: - - git - - gitkeeper - - conventional-commits - - history-hygiene - - atomic-commits ---- - -# Git Commit & History Hygiene (GitKeeper Lineage) - -> **Git Commit packages approved repository state transitions into clean, atomic, intelligible Conventional Commits under strict readiness gates and mode-aware session authority.** - ---- - -## 1. Identity -**Git Commit** is the Git history construction and hygiene engine for the engineering workspace. Operating under the GitKeeper lineage, it decomposes multi-intent working trees into ordered narrative sequences, isolates unready or future-intended changes into safe commit slices, derives precise Conventional Commit messages across three depth levels, and enforces strict branch protection gates. - -## 2. User Value -Messy, undifferentiated `git add .` commits lead to noisy git logs, difficult code reviews, and hazardous rollbacks. Git Commit guarantees: -- **Diff as Authoritative Truth**: Commit messages reflect verified working tree diffs, eliminating hallucinations of unmade changes. -- **Commit Slice Isolation**: Mixed working trees (refactor + feature + test + docs) are sliced and ordered into clean logical commits without blocking on unrelated working-tree edits. -- **Hierarchical Commit Messages**: Derives Conventional Commits 1.0.0 messages across 3 calibrated depth levels (Subject only, Bulleted body, or Architecture rationale), respecting repository-local taxonomies (e.g. Brain's semantic types). -- **10-Point Readiness Gate**: Enforces branch safety, atomic boundaries, and validation checks before proposing any commit. -- **Protected Branch Defense**: Blocks accidental direct commits to `main` or `master` unless repository configuration explicitly authorizes it. - -## 3. Invocation -### When to use it: -- Staging and committing changes at the completion of a milestone, bug fix, or refactor. -- Decomposing a large working tree containing multiple concerns into an atomic commit sequence. -- Reviewing Git status, untracked file inventory, and staging slices. -- Executing or advising on branch integration operations (squash, rebase, cherry-pick, merge). - -### When NOT to use it: -- **Deciding engineering work**: It packages approved state transitions; it does not decide what code or tests should have been written. -- **Autonomous destructive resets**: `git reset --hard` and `git restore` require explicit user authorization. -- **Vault documentation curation**: Evaluating whether commits require companion ADRs or Plans is delegated to [`documentation-router`](../documentation-router/README.md). - -## 4. Behavior -Git Commit separates history design into three foundational concepts (**Boundary**, **Sequence**, **Message**) and executes the GitKeeper Algorithm: - -```mermaid -flowchart TD - Inspect["1. Inspect Repository & Worktree
(Diff is authoritative)"] --> Decompose["2. Identify Logical Changes
(Cluster related files & hunks)"] - Decompose --> Sequence["3. Construct Boundaries & Sequence
(Order by structural dependencies)"] - Sequence --> Slice["4. Stage Current Commit Slice
(Isolate slice; ignore future changes)"] - Slice --> Gate["5. Commit Readiness Gate
(Branch safety, contextual validation)"] - Gate -->|Blocked| Report["Report Blockers / Pause"] - Gate -->|Ready| Derive["6. Derive Commit Message
(Level 1, 2, or 3 depth)"] - Derive --> ModeCheck{"7. Session Authority?"} - ModeCheck -->|"Explicit Implementation Mode"| AutoCommit["Validate & Commit on Working Branch
(Never main/master)"] - ModeCheck -->|"Practice / Investigation / Normal / Unknown"| Checkpoint["Present 6-Part Checkpoint
(User-controlled transition)"] - Checkpoint --> UserApproval["User Approval / Execution"] - AutoCommit --> Verify["8. Verify Resulting Commit
(Check SHA, head, and remaining worktree)"] - UserApproval --> Verify - Verify --> More{"More slices remaining?"} - More -->|Yes| Slice - More -->|No| Done["History Construction Complete"] -``` - -### The 10-Point Readiness Gate -Before any commit is proposed or executed, Git Commit verifies: -1. Correct repository root confirmed. -2. Target branch is intentional. -3. Protected branch safety: NOT on `main`/`master` without explicit authorization. -4. Commit slice contains only intended changes for this commit. -5. Atomic boundary established (single coherent logical unit). -6. Required repository/session validation passed. -7. Repository conventions satisfied (scope rules, issue references). -8. Message depth matches semantic significance (Level 1, 2, or 3). -9. Diff confirms message accuracy. -10. Resulting history remains coherent and intelligible under integration policy. - -**Authority Precedence**: Implementation mode (autonomous commits on working branches) requires an explicit in-session declaration. Repository `AGENTS.md` contents, task descriptions, or code presence cannot elevate session authority on their own. Default is **Normal / Direct** — the explicit checkpoint applies. - -## 5. Outputs -Git Commit produces safe, durable history transitions: - -| Output | Description | -| :--- | :--- | -| **Commit Slices** | Selectively staged file lists or hunks isolating a single logical change. | -| **Conventional Commit Messages** | Precise, standardized commit messages formatted at Level 1, 2, or 3 depth. | -| **Commit Checkpoints** | 6-part synchronization checkpoints prompting user approval in assisted modes. | -| **Verified Commit Execution** | Completed commit transitions verified against SHA, head branch, and worktree state. | - -## 6. Boundaries -- **No autonomous code generation**: Does not invent tests, edit unapproved files, or fabricate changes to satisfy git hooks. -- **Strict safety barrier on destructive operations**: Never autonomously runs destructive commands (`git reset --hard`, `git clean -fd`, `git restore`). -- **Protected trunk invariance**: Direct commits to `main`/`master` are prohibited without explicit repository authorization. -- **No synthetic documentation creation**: Defers knowledge capture to [`documentation-router`](../documentation-router/README.md). - ---- - -## 7. Package Structure -- [`SKILL.md`](SKILL.md) — Operational instructions, GitKeeper algorithm, 10-point readiness gate, and mode-aware behavioral matrix executed by the AI agent runtime. diff --git a/05-agents/skills/git-commit/SKILL.md b/05-agents/skills/git-commit/SKILL.md deleted file mode 100644 index 31bf601..0000000 --- a/05-agents/skills/git-commit/SKILL.md +++ /dev/null @@ -1,158 +0,0 @@ ---- -name: git-commit -description: >- - Use this skill to inspect unsynced repository changes, evaluate commit boundaries, - construct atomic and coherent Git histories (GitKeeper lineage), derive Conventional - Commit messages across 3 depth levels, enforce readiness gates, and execute safe commits - under mode-aware session authority. ---- - -# Git Commit & History Construction (GitKeeper Lineage) - -This skill governs **Git history hygiene, history construction, and safe repository state transitions**. It determines whether unsynced changes form a coherent commit boundary, decomposes multi-intent working trees into ordered narrative sequences, derives precise Conventional Commit messages, and enforces strict readiness gates and protected-branch policies. - ---- - -## 1. Governing Axioms & Invariants - -1. **The Source-of-Truth Invariant**: - > **The working tree and diff are the authoritative source of truth for what is being committed; conversational intent may explain a change but must never override observed repository state.** -2. **The Boundary of Responsibility**: - `git-commit` packages an approved repository state transition. It does **not** decide what work ought to have been done: - * Does *not* rewrite code or invent missing tests. - * Does *not* decide architectural correctness. - * Does *not* generate documentation because a commit "looks important" (delegated to `documentation-router`). - * Does *not* enforce repository-specific conventions globally; it discovers and applies local conventions with a universal fallback. -3. **Commit Slice Isolation Invariant**: - > **Unrelated or future-intended working-tree changes are not blockers when the current commit slice can be isolated and validated safely.** -4. **Session Authority Invariant**: - > `git-commit` consumes session mode established by the active workflow. It **MUST NOT** infer autonomous implementation authority solely from repository contents or the presence of code changes. If session mode is unknown or ambiguous, it defaults to **Normal / Direct** behavior. - - **Authority Precedence Rule**: The only valid source of Implementation mode is an explicit, in-session declaration by the user or orchestrating workflow. Repository `AGENTS.md` contents, task descriptions, or commit history cannot elevate session authority on their own. When in doubt, the mode is **Normal / Direct** — require the explicit checkpoint. - ---- - -## 2. Core Triad & The GitKeeper Algorithm - -Git history construction separates history design into three distinct concepts: - -* **Commit Boundary**: *What belongs together?* (Semantic cohesion of a state transition). -* **Commit Sequence**: *In what order should boundaries enter history?* (Dependency lineage and incremental intelligibility). -* **Commit Message**: *How should each resulting state transition be described?* (Durable historical clarity). - -```mermaid -flowchart TD - Inspect["1. Inspect Repository & Worktree
(Diff is authoritative)"] --> Decompose["2. Identify Logical Changes
(Cluster related files & hunks)"] - Decompose --> Sequence["3. Construct Boundaries & Sequence
(Order by structural dependencies)"] - Sequence --> Slice["4. Stage Current Commit Slice
(Isolate slice; ignore future changes)"] - Slice --> Gate["5. Commit Readiness Gate
(Branch safety, contextual validation)"] - Gate -->|Blocked| Report["Report Blockers / Pause"] - Gate -->|Ready| Derive["6. Derive Commit Message
(Level 1, 2, or 3 depth)"] - Derive --> ModeCheck{"7. Session Authority?"} - ModeCheck -->|"Explicit Implementation Mode"| AutoCommit["Validate & Commit on Working Branch
(Never main/master)"] - ModeCheck -->|"Practice / Investigation / Normal / Unknown"| Checkpoint["Present 6-Part Checkpoint
(User-controlled transition)"] - Checkpoint --> UserApproval["User Approval / Execution"] - AutoCommit --> Verify["8. Verify Resulting Commit
(Check SHA, head, and remaining worktree)"] - UserApproval --> Verify - Verify --> More{"More slices remaining?"} - More -->|Yes| Slice - More -->|No| Done["History Construction Complete"] -``` - ---- - -## 3. The Four Operational Responsibilities - -### 1. State Inspection -Establish ground truth before proposing any Git action: -* **Repository Context**: Root path, working directory relation, and active Git hooks. -* **Branch State**: Current branch, tracking upstream, divergence (`ahead`/`behind`). -* **Worktree Inventory**: Staged changes, unstaged changes, and untracked files. -* **Authoritative Diff**: Inspect `git diff` and `git diff --cached` directly. Never rely on assumptions or conversation history. -* **Convention Discovery**: Read repository-local rules in `AGENTS.md` and inspect recent commit logs (`git log -n 5 --oneline`). - -### 2. Commit-Boundary Reasoning & History Sequencing -An atomic commit is defined by **semantic coherence, not line count**: -> **An atomic commit represents one coherent repository state transition that can be understood, reviewed, reverted, or selectively cherry-picked as a unit.** - -* **Decomposing Multi-Intent Working Trees**: When a working tree contains mixed concerns (e.g. refactor + new feature + tests + docs), `git-commit` identifies the logical sequence and constructs a clean narrative history: - 1. `refactor(core): extract configuration loader` - 2. `feat(api): add enrollment endpoint` - 3. `test(api): add enrollment integration coverage` - 4. `docs(api): document enrollment endpoint` -* **Suspicious Coupling**: Surface and decouple accidental additions (unrelated formatting, temporary scratch scripts, unmigrated test files) rather than blindly running `git add -A`. - -### 3. Commit Message Derivation across 3 Depth Levels - -#### Type Vocabulary Hierarchy -1. **Conventional Commits 1.0.0 Baseline**: - * `feat` MUST be used for new features. - * `fix` MUST be used for bug fixes. - * Other types MAY be used; Conventional Commits 1.0.0 does not prescribe a universal taxonomy. -2. **Repository Overrides**: - * When repository-local conventions define additional or different types/scopes (e.g. Brain's `plan`, `discussion`, `decision`, `journal`, `debug`, `agent`, or project monorepo packages), those conventions take precedence. -3. **Session Context & Standard Defaults**: - * Where no repository policy exists, standard industry terms (`refactor`, `docs`, `test`, `build`, `ci`, `perf`, `style`, `chore`) provide clear defaults. - -#### Message Depth Levels - -| Level | Structure | Appropriate Context | Example | -| :--- | :--- | :--- | :--- | -| **Level 1** | Subject only | Trivial, self-explanatory changes with obvious scope. | `docs(readme): add architecture section` | -| **Level 2** | Subject + bulleted body | Commits with multiple concrete sub-changes needing explicit listing. | `fix(ci): mitigate dependency vulnerability #123`

`- Update vulnerable package to v2.4`
`- Adjust CI cache key`
`- Add regression test` | -| **Level 3** | Subject + body + rationale | Non-obvious architectural trade-offs, constraints, or behavioral shifts. | `refactor(config): separate runtime state from deployment config`

`- Move state root outside repository`
`- Update service startup flags`

`Rationale: The previous model coupled runtime data to the Git checkout, causing rollback ambiguity.` | - -### 4. Commit Readiness Gate (Slice-Level Verification) -Evaluate this 10-point checklist before committing: -```markdown -[ ] 1. Correct repository root confirmed. -[ ] 2. Target branch is intentional. -[ ] 3. Protected branch safety: NOT on main/master without explicit repo-local authorization. -[ ] 4. Commit slice contains only the intended changes for this commit (unrelated/future changes safely isolated). -[ ] 5. Atomic boundary established (single coherent logical unit). -[ ] 6. Required repository/session validation has passed, or applicable validation has been explicitly waived. -[ ] 7. Repository conventions satisfied (scope rules, issue references). -[ ] 8. Message depth matches semantic significance (Level 1, 2, or 3). -[ ] 9. Diff confirms message accuracy (no hallucinations of unmade changes). -[ ] 10. Resulting history remains coherent and intelligible under repository integration policy. -``` - ---- - -## 4. Mode-Aware Behavioral Matrix - -| Mode | Autonomy & Behavior | Protected Branch Policy | -| :--- | :--- | :--- | -| **Implementation** | **Proactive**. Identifies logical slices as work progresses. Validates and commits autonomously on dedicated working branches. | **Strictly blocked on `main`/`master`** unless repository `AGENTS.md` explicitly permits direct trunk commits. | -| **Practice** | **Pedagogical Coach**. Never commits autonomously. Identifies boundaries, warns if the learner mixes concerns, explains history hygiene, and proposes the commit message. The learner commits. | Governed by learner action. | -| **Investigation** | **Conservative**. Distinguishes exploratory/diagnostic churn from durable remediation. Blocks premature commits while hypotheses are being tested; helps construct clean atomic history once recovery is verified. | Requires verified recovery before commit proposal. | -| **Normal / Direct** | **Assisted**. Operates at explicit user request, verifying readiness and proposing the commit checkpoint. | Standard user approval gate. | -| **Integration** | **Governance**. Executes or advises on branch integration operations (see Section 5). | Governed by repository merge/rebase policy. | - ---- - -## 5. History Manipulation & Integration Operations - -The skill codifies explicit rules for Git integration operations to preserve clean, verifiable history: - -> **Integration Boundary Note**: Squash, rebase, cherry-pick, and merge are conceptually distinct from the `inspect → slice → commit` workflow in Section 2. If integration operations grow in complexity or require dedicated governance, they should be extracted into a separate `git-integration` skill. For now, they are included here for practical completeness. - -### 1. Squash -* **Rule**: Squash only when collapsing intermediate churn into a single coherent logical unit (e.g. 5 checkpoint/fixup commits on a feature branch $\to$ 1 feature commit). -* **Negative Rule**: Never blindly squash meaningful architectural sequences (e.g. foundation $\to$ feature $\to$ docs $\to$ tests) into an undifferentiated 3K-line commit. - -### 2. Rebase -* **Rule**: Rebase is encouraged for local, unshared branches to maintain a linear history and reorder/clean up commits prior to integration. -* **Prohibited**: Never force-push or rebase published/shared branches without explicit user authorization and repository confirmation. - -### 3. Cherry-Pick -* **Rule**: Cherry-pick only self-contained logical commits whose dependency assumptions are understood. -* **Procedure**: Inspect the source commit $\to$ verify clean target context $\to$ cherry-pick $\to$ inspect resulting diff $\to$ run contextual validation. If conflicts or hidden dependencies emerge, pause and report. - -### 4. Merge -* **Rule**: Preserve merge commits when branch topology conveys meaningful lifecycle information (e.g. long-running feature integration); follow repository integration policy (e.g. merge commit vs. fast-forward/rebase). - -### 5. Reset & Restore Safety Barrier -* **Non-Destructive**: `git restore --staged` or `git reset --soft` (modifies index/HEAD, preserves working tree). -* **Destructive**: `git restore ` or `git reset --hard` (discards working tree changes permanently). -* **The Safety Barrier**: The agent **MUST NEVER** execute destructive reset/restore commands autonomously. It must explicitly warn the user of potential data loss and await explicit user confirmation. diff --git a/05-agents/skills/inbox-curation/README.md b/05-agents/skills/inbox-curation/README.md deleted file mode 100644 index 05a0dea..0000000 --- a/05-agents/skills/inbox-curation/README.md +++ /dev/null @@ -1,84 +0,0 @@ ---- -type: agent -status: active -name: inbox-curation -kind: skill -project: brain -tags: - - inbox - - curation - - knowledge-graph - - taxonomy - - workflows ---- - -# Inbox Curation Skill - -> **Inbox Curation standardizes the process of scanning, triaging, formatting, validating, and relocating raw captures from `00-inbox/` into the canonical lifecycle directories of the Brain knowledge graph.** - ---- - -## 1. Identity - -**Inbox Curation** is an operational capability for the Second Brain knowledge graph. It provides a structured, reproducible procedure for transforming unstructured, zero-friction captures into first-class graph citizens adhering to vault taxonomy, metadata contracts, link conventions, and atomic git commit standards. - -## 2. User Value - -The `00-inbox/` directory provides zero-friction capture without worrying about filenames, frontmatter schemas, or directory contracts during the flow of thinking. However, without deliberate curation, raw notes accumulate, fragment, or degrade into an unmaintained digital dumping ground. - -Inbox Curation ensures: -- **Zero Drift**: Staged drafts are brought into full compliance with `validate-brain.py` before entry into the graph. -- **Epistemic Integrity**: Content is classified strictly by its *epistemic role* (Intent $\to$ `01-plans/`, Exploration $\to$ `02-discussions/`, History $\to$ `03-records/`, Understanding $\to$ `04-learning/`, Navigation $\to$ `06-projects/`). -- **Human Authority**: Ambiguous classifications are elevated to the user with actionable recommendations before moving files. -- **Atomic History**: Every curated document transition is isolated and committed with the repository's semantic commit taxonomy (`plan:`, `discussion:`, `knowledge:`, `guide:`, `debug:`). - -## 3. Invocation - -### When to use it: -- During periodic vault maintenance passes when raw drafts exist in `00-inbox/`. -- When explicitly asked to "process the inbox", "curate notes", or "triage captures". -- After a research or capture session where rough notes were temporarily staged in `00-inbox/`. - -### When NOT to use it: -- **Active capture**: When the user is currently drafting ideas in `00-inbox/`. The inbox is intentionally exempt from rules while writing. -- **Session knowledge routing**: At the conclusion of a coding or debugging session when synthesizing thoughts directly from session context. Use [`documentation-router`](../documentation-router/README.md) instead. -- **Arbitrary file moving**: Reorganizing existing, already-committed files in `01-plans/` through `06-projects/`. - -## 4. Behavior - -When invoked, Inbox Curation progresses through a 5-phase operational pipeline: - -```mermaid -flowchart TD - Start["00-inbox/ has pending items"] --> Preflight["1. Preflight Validation
(Run python scripts/validate-brain.py)"] - Preflight --> Discovery["2. Discovery & Inspection
(Read draft, determine intent, extract references)"] - Discovery --> Classify["3. Epistemic Classification
(Map to 01-plans, 02-discussions, 03-records, 04-learning)"] - Classify --> Checkpoint{"Interactive Checkpoint
Confirm destination & metadata with user"} - Checkpoint -->|Confirmed| Transform["4. Transformation & Formatting
(Inject YAML frontmatter, fix relative links, style headings)"] - Transform --> Validate["5. Integrity Validation
(Run scripts/validate-brain.py again)"] - Validate --> Relocate["6. Relocate & Clean
(Write to destination, remove draft from 00-inbox/)"] - Relocate --> Commit["7. Atomic Semantic Commit
(Commit with semantic type: plan, discussion, etc.)"] -``` - -## 5. Outputs - -Inbox Curation produces concrete transformations in the knowledge graph: - -| Output | Description | Destination | -| :--- | :--- | :--- | -| **Curated Artifact** | Formatted Markdown file with valid YAML frontmatter and portable relative links. | Target lifecycle directory (`01-` to `06-`) | -| **Clean Inbox** | Removal of the staged draft from `00-inbox/`. | File deletion in `00-inbox/` | -| **Semantic Git Commit** | Single atomic commit isolating the curated addition. | Git history (`(): `) | - -## 6. Boundaries - -- **Never bypass validator**: A curated file must never be committed if `python scripts/validate-brain.py` fails. -- **Never delete without destination write**: The draft in `00-inbox/` is only removed after the curated version is successfully written and verified at its target destination. -- **Never guess ambiguous intent**: If a draft contains mixed concerns (e.g. an incident post-mortem combined with a future plan), the skill prompts the user to split the note or confirm the primary role. -- **Preserve authorial substance**: Formatting, frontmatter, and link adjustments elevate the document's structure without altering the core insights, observations, or conclusions of the original draft. - ---- - -## 7. Package Structure - -- [`SKILL.md`](SKILL.md) — Operational instructions, progressive procedure, and behavioral invariants executed by the AI agent runtime. diff --git a/05-agents/skills/inbox-curation/SKILL.md b/05-agents/skills/inbox-curation/SKILL.md deleted file mode 100644 index 58260f4..0000000 --- a/05-agents/skills/inbox-curation/SKILL.md +++ /dev/null @@ -1,104 +0,0 @@ ---- -name: inbox-curation -description: >- - Triage, classify, format, validate, and move raw notes and drafts from 00-inbox into - canonical Brain knowledge graph lifecycle directories (01-plans, 02-discussions, 03-records, - 04-learning). ---- - -# Inbox Curation & Graph Ingestion - -This skill governs the systematic ingestion and curation of unprocessed drafts from `00-inbox/` into the canonical lifecycle directories of the Brain knowledge graph. - ---- - -## 1. Core Invariants - -1. **Epistemic Classification over Chronology**: Content is sorted by its epistemic nature, never simply by when it was created: - - Roadmaps, milestones, phased execution $\to$ `01-plans//` (`type: plan`) - - Exploratory debates, trade-offs, architecture options $\to$ `02-discussions//` (`type: discussion`) - - Incidents, regressions, root-cause analyses $\to$ `03-records/debug/` (`type: debug`) - - General knowledge, concepts, languages $\to$ `04-learning/knowledge/` (`type: knowledge`) - - Practical SOPs, runbooks, operation walkthroughs $\to$ `04-learning/guides//` (`type: guide`) -2. **The Validation Gate**: A curated document MUST pass `python scripts/validate-brain.py` before any commit is made. -3. **Zero Dangling Drafts**: Once a draft is curated and committed to its destination, the original file in `00-inbox/` must be deleted. -4. **Interactive Checkpoint**: The agent must present the proposed destination, frontmatter, and rationale to the user before relocating files, unless explicitly instructed to process autonomously. -5. **Atomic Commit Boundary**: Each curated document or cohesive bundle must be committed separately with the Brain's semantic commit type (`plan`, `discussion`, `knowledge`, `guide`, `debug`). - ---- - -## 2. Operational Procedure - -```mermaid -flowchart TD - S1["1. Preflight Gate
python scripts/validate-brain.py"] --> S2["2. Inventory & Inspection
Scan 00-inbox/ for pending drafts"] - S2 --> S3["3. Epistemic Classification
Determine target directory & metadata"] - S3 --> S4{"4. Interactive Checkpoint
Present target path & frontmatter"} - S4 -->|Approved| S5["5. Transform & Relocate
Write formatted file, delete from inbox"] - S5 --> S6["6. Validate Integrity
python scripts/validate-brain.py"] - S6 --> S7["7. Atomic Semantic Commit
Commit with brain semantic type"] -``` - -### Step 1: Preflight Verification -Before touching any files, verify that the repository is currently in a healthy state: -```bash -python scripts/validate-brain.py -``` -If the validator fails prior to curation, resolve existing repository issues or alert the user before proceeding. - -### Step 2: Inventory & Inspection -Scan `00-inbox/` for files to curate, ignoring `.keep`, `README.md`, system ledgers (`commit-log.csv`), or active scratch notes specified by the user: -- Read the content of the staged draft. -- Identify the project context (e.g. `homelab`, `nekoweb`, `brain`, or global/general). -- Determine whether the draft contains a single concept or multiple mixed concerns that should be decomposed into separate files. - -### Step 3: Epistemic Classification & Metadata Preparation -Select the target directory according to the repository's Directory Contracts: - -| Content Nature | Target Directory | Frontmatter `type` | Naming Pattern | -| :--- | :--- | :--- | :--- | -| **Phased Roadmap / Blueprint** | `01-plans//` | `plan` | `.md` | -| **Exploratory Trade-off / Why** | `02-discussions//` | `discussion` | `.md` | -| **Incident Root Cause / Bug** | `03-records/debug/` | `debug` | `YYYY-MM-DD-.md` | -| **Theoretical / Disciplinary Concept** | `04-learning/knowledge/concepts/` | `knowledge` | `.md` | -| **Tool / Language Reference** | `04-learning/knowledge/technologies/` | `knowledge` | `.md` | -| **Engineering Best Practice** | `04-learning/knowledge/methods/` | `knowledge` | `.md` | -| **Operational SOP / How-to Runbook** | `04-learning/guides//` | `guide` | `.md` | - -Prepare the compliant YAML frontmatter block matching the destination contract (see [AGENTS.md](../../../AGENTS.md) for templates). - -### Step 4: Interactive Checkpoint -Present a 4-point curation checkpoint to the user: -1. **Source Draft**: Path in `00-inbox/`. -2. **Proposed Destination**: Target path in vault hierarchy. -3. **Proposed Frontmatter**: YAML block including `type`, `project`, `tags`, etc. -4. **Rationale**: Brief epistemic justification for why this target directory was selected. - -*If the user confirms or if operating in approved autonomous mode, proceed to Step 5.* - -### Step 5: Transformation, Relocation & Cleanup -1. **Format Content**: - - Prepend valid YAML frontmatter. - - Ensure title is an H1 heading matching document purpose. - - Convert any Obsidian `[[double-bracket]]` links to standard relative Markdown links (`[label](../path.md)`). - - Ensure external code links use forge Git URLs (never machine-specific `file:///` URIs). -2. **Write Target File**: Write the transformed document to the destination path. -3. **Remove Staging File**: Delete the original file from `00-inbox/`. - -### Step 6: Validation Pass -Run repository integrity tests: -```bash -python scripts/validate-brain.py -python scripts/test_validator.py -``` -Ensure all checks pass cleanly: frontmatter validation, link resolution, code fences, Mermaid syntax, Ruff linting, and Pyright typing. - -### Step 7: Atomic Semantic Commit -Package the curated file using the Brain's semantic commit taxonomy: -- `plan(): ` -- `discussion(): ` -- `debug(): ` -- `knowledge(): ` -- `guide(): ` - -Commit message must reflect the newly curated document, cleanly isolated from unrelated working-tree changes. diff --git a/05-agents/skills/skill-builder/README.md b/05-agents/skills/skill-builder/README.md deleted file mode 100644 index 646c1ae..0000000 --- a/05-agents/skills/skill-builder/README.md +++ /dev/null @@ -1,87 +0,0 @@ ---- -type: agent -status: active -name: skill-builder -kind: skill -project: brain -tags: - - skills - - skill-authoring - - agent-engineering - - meta-skill ---- - -# Skill Builder Meta-Skill - -> **Skill Builder guides the architectural design, operational sizing, authoring, and empirical refinement of agent skills through interactive diagnostic coaching and a mandatory review gate.** - ---- - -## 1. Identity -**Skill Builder** is the meta-skill and architectural advisor for the agent customization ecosystem. It guides engineers through the 6-stage skill-engineering lifecycle, ensuring that new capabilities receive the appropriate degree of operational structure—preventing both fragile under-specified prompts and over-engineered procedural ceremonies. - -## 2. User Value -Agent skills often suffer from token bloat, premature completion, over-constrained state machines, or blurred boundaries with adjacent skills. Skill Builder guarantees: -- **Human Architectural Authority**: The human decides architectural intent and approves trade-offs; the assistant acts as a rigorous design reviewer and investigative coach. -- **Proportional Sizing**: Diagnoses the true structural mode (Reference, Transformation, Procedural Workflow, or Interactive Elicitation) so skills are never forced into unnecessary procedural ceremonies. -- **Mandatory Review Gate**: Synthesizes all architectural choices into a formal Skill Design Specification and requires human sign-off before generating files. -- **4-Tier Epistemic Architecture**: Validates universal invariants, platform/harness constraints, contextual design heuristics, and authoring quality. -- **Minimal Refinement Matrix**: Diagnoses trajectory failures during dogfooding and guides the author to tune the smallest relevant mechanism. - -## 3. Invocation -### When to use it: -- Designing a new agent skill from scratch. -- Evaluating whether a workflow belongs as a Rule (`AGENTS.md`), deterministic script (`scripts/`), human runbook (`04-learning/guides/`), or agent skill (`05-agents/skills/`). -- Iteratively refining an existing skill after observing behavioral drift or trajectory failures. - -### When NOT to use it: -- **Downstream execution**: It architects the skill; it does not execute the downstream engineering tasks the authored skill governs. -- **Direct code commits**: Autonomous commits are deferred to [`git-commit`](../git-commit/README.md). -- **Vault documentation routing**: General knowledge preservation is governed by [`documentation-router`](../documentation-router/README.md). - -### Slash Command Shortcut: -- `/build-skill [optional capability or workflow name]` directly activates the interactive skill architect. - -## 4. Behavior -When activated, Skill Builder guides the engineer through the 6-stage lifecycle: - -```mermaid -flowchart TD - Need["1. Problem Discovery & Abstraction Fit
(Recurring friction? Skill vs Rule vs Script?)"] --> Sizing["2. Structural Sizing & Dynamic Overlap
(Reference, Transformation, Procedural, Interactive)"] - Sizing --> Controls["3. Operational Controls & Context Sizing
(Preconditions, gates, state tracking, checkpoints)"] - Controls --> Spec["4. Skill Design Specification
(Structured summary of all design choices)"] - Spec --> Gate{"Design Review Gate
Human Approval Required"} - Gate -->|Revise| Sizing - Gate -->|Approved| Author["5. Authoring & Scaffolding
(SKILL.md, references/, scripts/, Brain catalog)"] - Author --> Dogfood["6. Dogfooding, Trajectory Audit & Regression
(Run on real task; refine smallest mechanism; verify non-regression)"] -``` - -### The 4-Tier Epistemic Evaluation -1. **Tier 1: Universal Engineering Invariants**: Explicit responsibility, boundary handoffs, single authoritative owner per rule, and observable completion criteria. -2. **Tier 2: Platform & Runtime Constraints**: Gemini invocation flags (`disable-model-invocation`), context pointer descriptions, and directory conventions. -3. **Tier 3: Contextual Design Heuristics**: State machines, anti-skipping gates, progressive disclosure (`references/`), and behavioral anchors. -4. **Tier 4: Authoring Quality Heuristics**: Side-by-side learner voice, rhetorical restraint, and deletion test passing. - -## 5. Outputs -Skill Builder produces concrete design and implementation artifacts: - -| Output | Description | -| :--- | :--- | -| **Skill Design Specification** | Formal architectural blueprint presented at the review gate prior to authoring. | -| **Runtime Skill Package** | Scaffolded `~/.gemini/config/skills//SKILL.md` (and companion `references/` or `scripts/`). | -| **Brain Vault Catalog Citizen** | Encapsulated skill package in `05-agents/skills//README.md` adhering to `DirectoryContract`. | -| **Slash Command Wrapper** | Optional user-invoked shorthand at `~/.gemini/config/skills//SKILL.md`. | -| **Trajectory Audit & Refinement** | Targeted adjustments to the smallest relevant mechanism following empirical dogfooding. | - -## 6. Boundaries -- **No file generation before approval**: The Design Review Gate is mandatory; files are never scaffolded until the human approves the specification. -- **Does not execute the skill**: Skill Builder designs the agent instructions; it does not perform the domain work. -- **Does not commit autonomously**: Commits are routed through [`git-commit`](../git-commit/README.md). -- **Does not bypass vault governance**: Vault representations adhere to Brain directory contracts and router invariants. - ---- - -## 7. Package Structure -- [`SKILL.md`](SKILL.md) — Operational instructions, 4-tier epistemic architecture, diagnostic interview questions, and minimal refinement matrix executed by the AI agent runtime. -- **Reference Files**: - - [`references/skill-evaluation-checklist.md`](references/skill-evaluation-checklist.md) — Tier 3 (contextual design heuristics), Tier 4 (authoring quality), the behavioral deletion test, and the README/SKILL separation test. Consulted during Stage 5 authoring and post-dogfood refinement. diff --git a/05-agents/skills/skill-builder/SKILL.md b/05-agents/skills/skill-builder/SKILL.md deleted file mode 100644 index 52af220..0000000 --- a/05-agents/skills/skill-builder/SKILL.md +++ /dev/null @@ -1,177 +0,0 @@ ---- -name: skill-builder -description: >- - Guide the architectural design, operational sizing, authoring, and empirical - refinement of agent skills through interactive diagnostic coaching. -disable-model-invocation: true -argument-hint: "What capability or workflow do you want to turn into a skill?" ---- - -# Skill Builder & Agent Skill Architect - -This skill guides engineers through designing, authoring, and iteratively refining agent skills. It functions as an interactive **skill architect, design reviewer, and engineering coach**. - -Its goal is not to blindly generate prompt text, but to ensure that a newly identified capability is given the appropriate degree of operational structure—preventing both fragile under-specified prompts and over-engineered procedural ceremonies. - ---- - -## 1. Governing Axioms & Division of Labor - -1. **The Human is the Architectural Authority**: - The human decides architectural intent, approves boundaries, accepts or rejects trade-offs, and owns the final design. `skill-builder` investigates, structures, challenges, proposes, drafts, and validates. -2. **Proportional Structure**: - A skill is sized to the problem it solves. Do not force every skill to be a phased state machine. Diagnose the required structural mode and apply operational controls only where justified. -3. **Change the Smallest Relevant Mechanism**: - When refining an existing skill after observing a failure, avoid sweeping rewrites. Modify the smallest mechanism (a gate, a promoted rule, a negative boundary) that addresses the observed variance. -4. **Boundary of Responsibility**: - * `skill-builder` governs the meta-level problem: *how to design an effective skill*. - * It does *not* execute the downstream engineering tasks the authored skill will perform. - * It does *not* bypass `documentation-router` for vault documentation. - * It does *not* execute Git commits autonomously (delegated to `git-commit`). - ---- - -## 2. Epistemic Architecture of Skills - -`skill-builder` checks every proposed skill against two mandatory tiers and consults an extended checklist during Stage 5 authoring. - -### Tier 1: Universal Engineering Invariants (Must Hold for ALL Skills) -* **Explicit Responsibility & Ownership**: Solves an identified, recurring problem with a clear operational purpose. -* **Explicit Boundary & Handoff**: Bounded to prevent responsibility overlap with adjacent skills; clearly states where its job ends and where it hands off. -* **One Authoritative Owner per Rule/Procedure**: Each rule, format, or procedure has exactly one authoritative owner. Other files may reference or describe it, but must not create competing definitions. -* **Behaviorally Meaningful Instructions**: Every instruction must have a defensible behavioral purpose. Avoid instructions whose deletion does not materially alter agent behavior. -* **Observable Definition of Completion**: Where a skill produces state changes, it must define what observable artifact, test status, or signal proves successful execution. - -### Tier 2: Platform & Runtime Constraints (Gemini Harness Facts) -* **Invocation Metadata**: User-invoked skills set `disable-model-invocation: true` to impose zero context load when idle. Model-invoked skills omit the flag for autonomous reachability. -* **Description Semantics**: Model-invoked descriptions act as always-loaded context pointers with explicit trigger conditions and behavioral anchors. User-invoked descriptions are concise human summaries with trigger lists stripped. -* **Directory Layout**: Supporting files live in `references/` or `scripts/` relative to `SKILL.md`. -* **Interskill Calling**: Operative dependencies invoke the harness tool explicitly (`Call the Skill tool with ""`), never relying on relative markdown paths or bare prompt mentions. - -During Stage 5 (Authoring), apply the design heuristics and authoring quality checklist in [`references/skill-evaluation-checklist.md`](./references/skill-evaluation-checklist.md). - ---- - -## 3. The 6-Stage Skill-Engineering Lifecycle - -```mermaid -flowchart TD - Need["1. Problem Discovery & Abstraction Fit
(Recurring friction? Skill vs Rule vs Script?)"] --> Sizing["2. Structural Sizing & Dynamic Overlap
(Reference, Transformation, Procedural, Interactive)"] - Sizing --> Controls["3. Operational Controls & Context Sizing
(Preconditions, gates, state tracking, checkpoints)"] - Controls --> Spec["4. Skill Design Specification
(Structured summary of all design choices)"] - Spec --> Gate{"Design Review Gate
Human Approval Required"} - Gate -->|Revise| Sizing - Gate -->|Approved| Author["5. Authoring & Scaffolding
(SKILL.md, references/, scripts/, Brain catalog)"] - Author --> Dogfood["6. Dogfooding, Trajectory Audit & Regression
(Run on real task; refine smallest mechanism; verify non-regression)"] -``` - ---- - -### Stage 1: Problem Discovery & Abstraction Fit -Interview the developer to clarify the capability: -1. **The Recurring Friction**: *"What specific, recurring engineering workflow, friction point, or failure mode are we addressing?"* -2. **The Abstraction Check**: - * *Is it a Rule?* (A universal, always-active constraint like formatting or safety) $\to$ Belongs in `AGENTS.md`. - * *Is it a Script?* (A deterministic, fixed command without LLM judgment) $\to$ Belongs in `scripts/`. - * *Is it a Guide / Runbook?* (Human operational SOP) $\to$ Belongs in `04-learning/guides/`. - * *Is it a Skill?* (A tool-enabled procedure requiring agent judgment) $\to$ Proceed to Stage 2. - ---- - -### Stage 2: Structural Sizing & Dynamic Overlap -1. **Diagnose Primary Structural Mode**: - * **Reference & Framing**: Vocabulary, concepts, rules consulted on demand. (No state machine). - * **Transformation & Synthesis**: Single-pass conversion of context into an artifact. (Input contract + negative boundary + schema). - * **Procedural Workflow**: High-friction multi-step execution requiring verification discipline. (Phases + hard gates + proof artifacts). - * **Interactive Elicitation**: Collaborative dialogue, interview, or tutoring. (Batched rounds + fact/decision boundary). - * *Note*: Modes may blend where justified (e.g. procedural execution with an interactive human checkpoint). -2. **Dynamic Skill Catalog Overlap Check**: - * Inspect the currently active skills in the environment (e.g. via `~/.gemini/config/skills/` or `~/Brain/05-agents/skills/`). - * Challenge the author: *"Does this capability overlap with or duplicate any existing skill? Where does this skill stop and hand off?"* -3. **Explicit Boundary**: - * State clearly what this skill owns and what it **explicitly refuses to own**. - ---- - -### Stage 3: Operational Controls & Context Sizing -Pose only the diagnostic questions relevant to the diagnosed structural mode: - -* **If Procedural Workflow**: - - What state must exist before starting (preconditions)? - - What discrete phases does the procedure pass through? - - What observable artifact (test output, command status, file diff) proves Phase A is done before Phase B begins? - - What hard pre-condition gate prevents the model from rushing ahead? - - How does the skill clean up temporary diagnostic probes or tags? -* **If Transformation & Synthesis**: - - What input context does it assume? - - What is the output format schema? - - What negative boundary prevents conversational drift (e.g. *"Do NOT interview"*")? -* **If Interactive Elicitation**: - - How are question rounds batched to prevent badgering? - - What facts must the agent look up autonomously via tools before asking the user? - - What decisions belong exclusively to the user? -* **If Reference & Framing**: - - What core concepts and behavioral anchors are needed? - - What external reference should be disclosed behind pointers? - ---- - -### Stage 4: The Skill Design Specification & Review Gate - -Before generating any files, `skill-builder` synthesizes all design decisions into a formal specification: - -```markdown -## Skill Design Specification: - -* **Core Responsibility**: [What single capability this skill owns] -* **Explicit Boundary & Handoffs**: [What it refuses to do; where it stops and hands off] -* **Primary Structural Mode**: [Reference | Transformation | Procedural | Interactive | Blended] -* **Invocation Contract**: [User-invoked (slash command) | Model-invoked (context pointer)] -* **Preconditions & Assumed Context**: [What environment state or tools are assumed] -* **Operational Controls**: [Gates, observable proof artifacts, checkpoints, or schemas] -* **Artifact Architecture**: - - `SKILL.md`: [Primary procedural steps and immediate invariants] - - `references/`: [Disclosed formats, deep examples, or branch rules, if justified] - - `scripts/`: [Deterministic execution scripts, if justified] -* **Validation Strategy**: [How execution success will be verified] -* **Catalog Overlap Analysis**: [How it relates to existing adjacent skills] -``` - -#### The Mandatory Review Gate -Halt and ask the developer: -> **"Does this specification accurately capture the capability and boundaries you want to establish?"** - -Do NOT proceed to authoring files until the developer explicitly approves or refines the specification. - ---- - -### Stage 5: Authoring & Scaffolding -Upon human approval of the specification: -1. **Scaffold Runtime Files**: - - Create `~/.gemini/config/skills//SKILL.md`. - - Create companion `references/` or `scripts/` only where justified by attention protection. - - Apply the behavioral deletion test to eliminate fluff and no-op instructions. - - Apply the design heuristics and authoring quality standards from [`references/skill-evaluation-checklist.md`](./references/skill-evaluation-checklist.md). -2. **Scaffold Canonical Brain Representation**: - - Create `~/Brain/05-agents/skills//README.md` (human API) and `SKILL.md` (vault copy) adhering to `DirectoryContract` (`type: agent`, `kind: skill`). -3. **Optional Slash Command Wrapper**: - - If user-invoked and ergonomic shorthand is desired, create the slash command wrapper at `~/.gemini/config/skills//SKILL.md`. - ---- - -### Stage 6: Dogfooding, Trajectory Audit & Regression Verification - -Guide the developer to run the newly authored or edited skill on a representative real-world task: - -1. **Trajectory Inspection**: Inspect the agent's actual tool calls and intermediate turns. -2. **Apply the Minimal Refinement Matrix**: - * *Agent skips a required verification step* $\to$ Strengthen the pre-condition gate; make the required artifact observable. - * *Agent ignores a critical behavioral rule* $\to$ **Promote the rule into the primary execution path in `SKILL.md`.** - * *Supporting detail overwhelms the procedure* $\to$ Disclose detailed formats or branch rules into `references/`. - * *Agent wanders into adjacent tasks* $\to$ Tighten the negative boundary. - * *Agent repeats unnecessary boilerplate* $\to$ Prune the instruction or replace with a compact behavioral anchor. - * *Agent behaves correctly without the instruction* $\to$ Delete the instruction as a no-op. -3. **The Regression Check**: - After applying a refinement, re-run a previously successful scenario to confirm: - - The target failure was eliminated. - - Previously working behaviors remain intact without new regressions. diff --git a/05-agents/skills/skill-builder/references/skill-evaluation-checklist.md b/05-agents/skills/skill-builder/references/skill-evaluation-checklist.md deleted file mode 100644 index 1385aad..0000000 --- a/05-agents/skills/skill-builder/references/skill-evaluation-checklist.md +++ /dev/null @@ -1,80 +0,0 @@ -# Skill Evaluation Checklist - -This checklist is consulted during **Stage 5: Authoring & Scaffolding** and **Stage 6: Dogfooding & Refinement**. Tiers 1 and 2 are the mandatory baseline, verified at Stage 4 (Design Specification). Tiers 3 and 4 are applied judgment during authoring and dogfood refinement. - ---- - -## Tier 1: Universal Engineering Invariants (Already Checked at Stage 4) - -| Criterion | Question to Ask | -| :--- | :--- | -| Explicit Responsibility | Is there a single, recurring problem this skill owns? | -| Explicit Boundary & Handoff | Does it clearly state where it stops and what it hands off to? | -| One Authoritative Owner | Is every rule owned by exactly one document? Are there competing definitions? | -| Behaviorally Meaningful | Would deleting any individual instruction change agent behavior? | -| Observable Completion | Can you point to a concrete artifact, test status, or signal that proves the skill finished? | - ---- - -## Tier 2: Platform & Runtime Constraints (Already Checked at Stage 4) - -| Criterion | Question to Ask | -| :--- | :--- | -| Invocation Metadata | Is `disable-model-invocation: true` set for user-invoked skills? Is it absent for model-invoked skills? | -| Description Semantics | For model-invoked: does the description include explicit trigger conditions and behavioral anchors? | -| Directory Layout | Do all supporting files live under `references/` or `scripts/` relative to `SKILL.md`? | -| Interskill Calling | Are skill dependencies invoked via the harness tool, not via markdown links? | - ---- - -## Tier 3: Contextual Design Heuristics (Applied During Stage 5 When Justified) - -Apply these only when the diagnosed structural mode warrants them. Not every skill needs every heuristic. - -| Heuristic | When to Apply | -| :--- | :--- | -| **Operational State Machine** | Multi-step procedural workflows where premature completion is observed. | -| **Hard Anti-Skipping Gates** | Stopping conditions ("No X, no Phase Y") when the model reliably rushes past tedious verification. | -| **Externalized State** | Workflows spanning multiple turns or subagents where progress tracking would otherwise be lost. | -| **Progressive Disclosure** | When the body of `SKILL.md` is diluting the primary procedure with schemas, examples, or branch rules. Move those into `references/`. | -| **Asymmetric Context Decoupling** | When a high-context exploration phase should be separated from a low-context review phase. | -| **Behavioral Anchors** | When compact pretrained terms (*tight*, *seam*, *airlock*, *frontier*) reliably steer the model without verbose essays. | - -**Deletion Test for Heuristics**: Before adding a Tier 3 control, ask: "If I don't add this, what specific observed failure am I risking?" If you cannot name an observed failure mode, don't add it. - ---- - -## Tier 4: Authoring Quality Heuristics (Applied During Stage 5 and Post-Dogfood Refinement) - -These are style and clarity standards for both `SKILL.md` and `README.md`: - -| Heuristic | Positive Form | -| :--- | :--- | -| **Side-by-Side Learner Voice** | Write as a developer sharing what they learned with another developer, not as an authority figure delivering instructions. | -| **Rhetorical Restraint** | Make ideas interesting through the quality of the explanation itself, not through dramatic transitions or manufactured enthusiasm. | -| **Explanatory Guidance** | Explain useful mechanisms and mental models directly. Avoid motivational pep talks and excessive negative bans. | -| **Formatting Conventions** | Clean GitHub-flavored markdown. No em-dashes. | - -### The Behavioral Deletion Test - -Before finalizing any `SKILL.md`, apply this test to every paragraph and every instruction: - -> *"If I deleted this instruction, would the agent behave differently in a way that matters?"* - -- If **no**: delete it. -- If **yes**: keep it, and verify it is placed where the agent reads it at the right moment in the workflow. - -### The README/SKILL Separation Test - -A README should answer: *"What is this skill, why does it exist, when do I invoke it, and what does it produce?"* - -A SKILL.md should answer: *"What does the agent do step by step, what are the invariants, and when does it stop?"* - -If the README is becoming a compressed copy of SKILL.md, strip it back to the capability contract: -1. Identity (what it is) -2. User Value (why it matters) -3. Invocation (when to use / when not to use) -4. Behavior (overview, not full procedure) -5. Outputs (concrete deliverables) -6. Boundaries (what it refuses to do) -7. Package Structure (manifest) diff --git a/AGENTS.md b/AGENTS.md index 81a2088..d079ccc 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -215,8 +215,8 @@ Checks: directory-type contracts, max depth, filename requirements, frontmatter ## Operational Skills -Procedural workflows and multi-step capabilities are encapsulated as operational skills under `05-agents/skills/` rather than inline repository rules: +Procedural workflows and multi-step capabilities are maintained in the standalone [`skills`](https://github.com/kiskaadee/skills) repository and indexed in [05-agents/skills/README.md](05-agents/skills/README.md): -- **[Inbox Curation](05-agents/skills/inbox-curation/README.md)**: Scans `00-inbox/`, classifies raw notes into canonical lifecycle directories, injects valid YAML frontmatter, validates links, and executes atomic commits. -- **[Documentation Router](05-agents/skills/documentation-router/README.md)**: Evaluates completed engineering sessions to determine whether durable knowledge was produced and selects the canonical epistemic container (Discussion, ADR, Plan, Debug Record). -- **[Git Commit & History Hygiene](05-agents/skills/git-commit/README.md)**: Packages validated repository transitions into coherent, atomic Conventional Commits matching the Brain semantic taxonomy. +- **[Inbox Curation](https://github.com/kiskaadee/skills/blob/main/brain/inbox-curation/SKILL.md)**: Scans `00-inbox/`, classifies raw notes into canonical lifecycle directories, injects valid YAML frontmatter, validates links, and executes atomic commits. +- **[Document](https://github.com/kiskaadee/skills/blob/main/skills/document/SKILL.md)**: Evaluates completed engineering sessions to determine whether durable knowledge was produced and selects the canonical epistemic container (Discussion, ADR, Plan, Debug Record, Knowledge). +- **[Git Commit & History Hygiene](https://github.com/kiskaadee/skills/blob/main/skills/git-commit/SKILL.md)**: Packages validated repository transitions into coherent, atomic Conventional Commits matching the Brain semantic taxonomy.