Compare commits
8
Commits
fee7429a10
...
cf14d806d3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf14d806d3 | ||
|
|
8fafa08d13 | ||
|
|
ae38ba6414 | ||
|
|
98635f73ad | ||
|
|
552ebe48b4 | ||
|
|
6b529cf86a | ||
|
|
70bdc0e5dc | ||
|
|
9ae6c84a06 |
No files matched your search
@@ -0,0 +1,10 @@
|
|||||||
|
# AGENTS.md: skills repo
|
||||||
|
|
||||||
|
Source of truth for my agent skills. Installed into agent tools by `install.sh`.
|
||||||
|
|
||||||
|
## Rules for working in this repo
|
||||||
|
- Direct commits to `main` are allowed (solo repo).
|
||||||
|
- Edit skills **here**, never in an installed location (`~/.gemini/config/skills/…`).
|
||||||
|
- Every `skills/*/SKILL.md` follows `skills/build-skill/references/skeleton.md` and stays ≤ 80 lines.
|
||||||
|
- No absolute home paths (`/home/<user>`) and no secrets; this repo is public.
|
||||||
|
- Commit types: Conventional Commits; scope = skill name (e.g. `refactor(git-commit): …`).
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2026 kiskaadee
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
---
|
||||||
|
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 (reserved for a future `journal-builder` skill, not built yet).
|
||||||
|
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 (`~/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<br/>(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<br/>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 `~/Brain` or the directory name is `Brain`, terminate immediately.
|
||||||
|
|
||||||
|
### Step 2: Capture via Deterministic Script
|
||||||
|
Execute the bundled deterministic capture script:
|
||||||
|
```bash
|
||||||
|
bash scripts/log-commit.sh [COMMIT_SHA] # path relative to this SKILL.md
|
||||||
|
```
|
||||||
|
*(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 (planned, not built yet)**: a future `journal-builder` (`/journal`) would consume the accumulated records in `commit-log.csv` in batches to conduct retrospectives, drive Socratic learning loops, and synthesize daily journals in `03-records/journal/`.
|
||||||
Executable
+91
@@ -0,0 +1,91 @@
|
|||||||
|
#!/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/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}"
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
---
|
||||||
|
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/<project>/` (`type: plan`)
|
||||||
|
- Exploratory debates, trade-offs, architecture options $\to$ `02-discussions/<project>/` (`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/<project>/` (`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<br/>python scripts/validate-brain.py"] --> S2["2. Inventory & Inspection<br/>Scan 00-inbox/ for pending drafts"]
|
||||||
|
S2 --> S3["3. Epistemic Classification<br/>Determine target directory & metadata"]
|
||||||
|
S3 --> S4{"4. Interactive Checkpoint<br/>Present target path & frontmatter"}
|
||||||
|
S4 -->|Approved| S5["5. Transform & Relocate<br/>Write formatted file, delete from inbox"]
|
||||||
|
S5 --> S6["6. Validate Integrity<br/>python scripts/validate-brain.py"]
|
||||||
|
S6 --> S7["7. Atomic Semantic Commit<br/>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/<project>/` | `plan` | `<slug>.md` |
|
||||||
|
| **Exploratory Trade-off / Why** | `02-discussions/<project>/` | `discussion` | `<slug>.md` |
|
||||||
|
| **Incident Root Cause / Bug** | `03-records/debug/` | `debug` | `YYYY-MM-DD-<slug>.md` |
|
||||||
|
| **Theoretical / Disciplinary Concept** | `04-learning/knowledge/concepts/` | `knowledge` | `<slug>.md` |
|
||||||
|
| **Tool / Language Reference** | `04-learning/knowledge/technologies/` | `knowledge` | `<slug>.md` |
|
||||||
|
| **Engineering Best Practice** | `04-learning/knowledge/methods/` | `knowledge` | `<slug>.md` |
|
||||||
|
| **Operational SOP / How-to Runbook** | `04-learning/guides/<project>/` | `guide` | `<slug>.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(<project>): <description>`
|
||||||
|
- `discussion(<project>): <description>`
|
||||||
|
- `debug(<project>): <description>`
|
||||||
|
- `knowledge(<topic>): <description>`
|
||||||
|
- `guide(<project>): <description>`
|
||||||
|
|
||||||
|
Commit message must reflect the newly curated document, cleanly isolated from unrelated working-tree changes.
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
# Working With Me
|
||||||
|
|
||||||
|
I'm a career-changer (biology to software) learning to engineer by building real projects.
|
||||||
|
Help me build, but make me think. Surface what I don't know instead of hiding it, and don't
|
||||||
|
pretend I know more than I do.
|
||||||
|
|
||||||
|
## Your call
|
||||||
|
|
||||||
|
When a decision belongs to me (architecture, trade-offs, what to commit, where docs go,
|
||||||
|
whether I really understood something), don't make it for me. Ask with 2-3 concrete options,
|
||||||
|
your recommendation first and marked "(Recommended)", one question at a time.
|
||||||
|
Use the ask-question tool if available; otherwise a numbered list.
|
||||||
|
|
||||||
|
## Hard rules
|
||||||
|
|
||||||
|
- Never commit to `main`/`master` unless the repo's own `AGENTS.md` allows it.
|
||||||
|
- Never run destructive git (`reset --hard`, `restore <file>`, `clean -fd`, force-push) without
|
||||||
|
my explicit yes.
|
||||||
|
- Redact secrets (tokens, keys, passwords, connection strings) from anything you print or save.
|
||||||
|
|
||||||
|
## Skills and docs
|
||||||
|
|
||||||
|
- My skills live in `~/Projects/active/skills`. Edit them there, never in an installed copy.
|
||||||
|
- Durable notes default to `~/Brain/00-inbox/`. Use `document` to decide if one is warranted.
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
---
|
||||||
|
name: build-skill
|
||||||
|
description: >-
|
||||||
|
Interactive design and refinement of agent skills. Use when the user types /build-skill
|
||||||
|
to create a new skill or fix one that misbehaves.
|
||||||
|
disable-model-invocation: true
|
||||||
|
---
|
||||||
|
|
||||||
|
# Build Skill
|
||||||
|
|
||||||
|
## Use when
|
||||||
|
- `/build-skill [capability]`: turning a recurring workflow or failure into a skill.
|
||||||
|
- Fixing an existing skill after watching it misbehave on a real task.
|
||||||
|
|
||||||
|
## Steps
|
||||||
|
1. **Find the friction.** Ask what recurring workflow, pain point, or failure this addresses.
|
||||||
|
If no capability was given, ask: "What keeps going wrong, or what do you keep repeating?"
|
||||||
|
2. **Pick the right tool.** Before writing a skill, check whether it is really:
|
||||||
|
- a rule that always applies: one line in `AGENTS.md`;
|
||||||
|
- a fixed command with no judgment: a script;
|
||||||
|
- a human procedure: a guide in Brain;
|
||||||
|
- a procedure that needs agent judgment: a skill. Continue.
|
||||||
|
3. **Check overlap.** List the skills in this repo (`skills/`, `brain/`). Ask where the new
|
||||||
|
skill stops and which existing skill it hands off to.
|
||||||
|
4. **Size it.** Decide the shape: reference (facts consulted on demand), transformation
|
||||||
|
(input to output), procedure (steps with checks between them), or interview (rounds of
|
||||||
|
questions). Add gates or checkpoints only for a failure you can name.
|
||||||
|
5. **Write a short spec:** name (= slash command), description, steps, "Your call" items,
|
||||||
|
done-when signal, hand-offs, files in `references/` or `scripts/` if any.
|
||||||
|
6. **Write it** in this repo following [references/skeleton.md](references/skeleton.md),
|
||||||
|
then run the checks in [references/checklist.md](references/checklist.md).
|
||||||
|
7. **Dogfood.** Run it on a real task, read the agent's actual turns, and fix the smallest
|
||||||
|
thing that went wrong (see the checklist's refinement table). Re-run a case that worked
|
||||||
|
before to make sure nothing regressed.
|
||||||
|
|
||||||
|
Write only in this repo. Never create copies elsewhere or wrapper skills for slash commands.
|
||||||
|
|
||||||
|
## Your call
|
||||||
|
- Rule, script, guide, or skill? (step 2)
|
||||||
|
- What the skill refuses to own. (step 3)
|
||||||
|
- **Approve the spec before any file is written.** (step 5)
|
||||||
|
- Whether a dogfood failure is worth a fix, or acceptable.
|
||||||
|
|
||||||
|
## Done when
|
||||||
|
- The skill passes the checklist and one real dogfood run behaves as the spec says.
|
||||||
|
|
||||||
|
## Hands off to
|
||||||
|
- `git-commit`: to commit the new or changed skill.
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
# Skill Checklist
|
||||||
|
|
||||||
|
Used by `build-skill` at step 6 (writing) and step 7 (dogfooding).
|
||||||
|
|
||||||
|
## Before calling a skill done
|
||||||
|
|
||||||
|
| Check | Question |
|
||||||
|
| :--- | :--- |
|
||||||
|
| One job | Is there one recurring problem this skill owns? |
|
||||||
|
| Clear edges | Does "Hands off to" say where it stops? Does "Use when" say what it is not for? |
|
||||||
|
| One owner per rule | Is any rule here already defined elsewhere (AGENTS.md, another skill)? Point to it instead. |
|
||||||
|
| Deletion test | Would removing each sentence change what the agent does? If not, remove it. |
|
||||||
|
| Observable finish | Does "Done when" name a concrete signal (test passes, file exists, user approved)? |
|
||||||
|
| Human decisions | Does "Your call" list the decisions that must stay with the user? |
|
||||||
|
| Size | Is `SKILL.md` 80 lines or less, with bulky material in `references/`? |
|
||||||
|
| Invocation | Should this ever auto-trigger? If not, set `disable-model-invocation: true`. |
|
||||||
|
| Description | Does it say what the skill does and name concrete triggers? (The agent decides from this alone.) |
|
||||||
|
| Public repo | No absolute home paths, no secrets. |
|
||||||
|
|
||||||
|
Add extra controls (hard gates, state files, checkpoints) only for a failure you have actually
|
||||||
|
seen. If you can't name the failure, don't add the control.
|
||||||
|
|
||||||
|
## Refining after a dogfood run
|
||||||
|
|
||||||
|
Change the smallest thing that explains what went wrong:
|
||||||
|
|
||||||
|
| Observed | Smallest fix |
|
||||||
|
| :--- | :--- |
|
||||||
|
| Skipped a verification step | Make the step's proof observable and gate the next step on it. |
|
||||||
|
| Ignored an important rule | Move the rule into the numbered steps, where it is read at the right moment. |
|
||||||
|
| Procedure lost in detail | Move the detail to `references/`. |
|
||||||
|
| Wandered into another skill's job | Tighten "Use when" and "Hands off to". |
|
||||||
|
| Repeated boilerplate | Cut the instruction or shorten it. |
|
||||||
|
| Behaved correctly without an instruction | Delete the instruction. |
|
||||||
|
|
||||||
|
Then re-run a scenario that used to work, to confirm nothing regressed.
|
||||||
|
|
||||||
|
## Writing style
|
||||||
|
|
||||||
|
- Write like a developer explaining to another developer, not like an authority issuing orders.
|
||||||
|
- Explain the mechanism directly; skip pep talks and long lists of bans.
|
||||||
|
- Clean GitHub-flavored markdown. No em-dashes.
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
# Skill Skeleton
|
||||||
|
|
||||||
|
Every `skills/*/SKILL.md` uses this shape. `build-skill` owns this file; other skills follow it and do not restate it.
|
||||||
|
|
||||||
|
```markdown
|
||||||
|
---
|
||||||
|
name: <command-name> # what the user types: /<command-name>
|
||||||
|
description: >-
|
||||||
|
<What it does, in one sentence. When to use it: concrete triggers.>
|
||||||
|
# disable-model-invocation: true # only for skills that must never auto-trigger
|
||||||
|
---
|
||||||
|
|
||||||
|
# <Title>
|
||||||
|
|
||||||
|
## Use when
|
||||||
|
- Triggers (and one "not for X, use Y" line if confusion is likely).
|
||||||
|
|
||||||
|
## Steps
|
||||||
|
1. Numbered, imperative, in the order the agent should act.
|
||||||
|
|
||||||
|
## Your call
|
||||||
|
- Decisions the agent hands to the human instead of making them.
|
||||||
|
Asked the way the global AGENTS.md "Your call" rule describes.
|
||||||
|
|
||||||
|
## Done when
|
||||||
|
- The observable signal that the skill is finished.
|
||||||
|
|
||||||
|
## Hands off to
|
||||||
|
- `<skill>`: when and why.
|
||||||
|
```
|
||||||
|
|
||||||
|
## Rules
|
||||||
|
|
||||||
|
- **80 lines max** for `SKILL.md`. Templates, long formats and branch rules go in `references/`.
|
||||||
|
- **Extra sections** are allowed only for a format used across several steps (e.g. `diagnose`'s checkpoint).
|
||||||
|
- **One owner per rule.** If another file already defines it (AGENTS.md, another skill), point to it.
|
||||||
|
- **Deletion test.** If removing a sentence would not change what the agent does, remove it.
|
||||||
|
- **Plain words.** No invented vocabulary. Prefer "decision" over "epistemic commitment".
|
||||||
|
- **No diagrams that repeat a list.** A numbered list is already the flow.
|
||||||
|
- **No em-dashes** in skill text.
|
||||||
|
- **The `name` is the slash command.** Never create a separate wrapper skill to expose a command.
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
---
|
||||||
|
name: diagnose
|
||||||
|
description: >-
|
||||||
|
Evidence-first troubleshooting. Use when the user types /diagnose or reports a bug,
|
||||||
|
regression, failing build, or unexpected system behavior. Works from raw evidence to a
|
||||||
|
proven root cause and a minimal, reversible fix, pausing at risky transitions.
|
||||||
|
---
|
||||||
|
|
||||||
|
# Diagnose
|
||||||
|
|
||||||
|
## Use when
|
||||||
|
- `/diagnose [symptom or error]`, or any "why is this broken / behaving strangely?" request.
|
||||||
|
- If I want to find the cause myself, switch to `practice`.
|
||||||
|
|
||||||
|
## Steps
|
||||||
|
1. **Observe.** Collect raw evidence first: exact error, logs, exit codes, a reproduction,
|
||||||
|
what changed recently, how far the failure spreads. If no symptom was given, ask for it.
|
||||||
|
2. **Hypothesize.** List the plausible causes. Keep what the system reported separate from
|
||||||
|
what you infer.
|
||||||
|
3. **Check, with a stated purpose.** Before each inspection command, say what it tests and
|
||||||
|
which result would confirm or rule out a hypothesis.
|
||||||
|
4. **Narrow** until one cause is proven by evidence, not just plausible.
|
||||||
|
5. **Fix** with the smallest reversible change.
|
||||||
|
6. **Validate** locally (tests, linters, build), then **verify** in the environment where it
|
||||||
|
actually failed.
|
||||||
|
7. **Clean up** every temporary probe (debug logs, env overrides, fixtures, test records)
|
||||||
|
and confirm it's gone.
|
||||||
|
|
||||||
|
Scale the effort to the problem: a typo gets one line, not a ceremony.
|
||||||
|
Redact secrets (tokens, keys, connection strings) from anything you print or save.
|
||||||
|
|
||||||
|
## Checkpoints
|
||||||
|
At risky or multi-system transitions (domain narrowed, hypothesis ruled out, change applied,
|
||||||
|
ready to commit or deploy), pause and report in six short parts:
|
||||||
|
**Current state** (known vs unknown), **Reasoning**, **Changes**, **Validation**
|
||||||
|
(expected vs actual), **Next action**, **Recovery** (how to roll back).
|
||||||
|
For trivial issues, a one-sentence status is enough.
|
||||||
|
|
||||||
|
## Your call
|
||||||
|
- Which hypothesis to chase when the evidence is ambiguous.
|
||||||
|
- Approving any step that changes state: commit, push, deploy, data change.
|
||||||
|
- Whether the root cause taught something worth recording.
|
||||||
|
|
||||||
|
## Done when
|
||||||
|
- The fix is verified where the failure happened, and all temporary probes are removed.
|
||||||
|
|
||||||
|
## Hands off to
|
||||||
|
- `git-commit`: to package the fix once recovery is verified.
|
||||||
|
- `document`: when the investigation revealed a non-obvious failure mode or design flaw.
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
---
|
||||||
|
name: document
|
||||||
|
description: >-
|
||||||
|
Decide whether a session produced knowledge worth keeping, pick the right document type
|
||||||
|
(Discussion, ADR, Plan, Debug Record, Knowledge), and draft it. Use when the user types
|
||||||
|
/document, or when another skill hands off a decision, root cause, or insight.
|
||||||
|
---
|
||||||
|
|
||||||
|
# Document
|
||||||
|
|
||||||
|
## Use when
|
||||||
|
- `/document` at the end of a session, or a handoff from `diagnose`, `practice`, `git-commit`.
|
||||||
|
- Routine fixes and chores need no document: a good commit message is enough.
|
||||||
|
|
||||||
|
## Steps
|
||||||
|
1. **Is it worth writing?** Default is no. Continue only if the session produced something
|
||||||
|
non-obvious that someone (me, in six months) would benefit from reading: a decision, a
|
||||||
|
surprising failure, a reusable insight.
|
||||||
|
2. **Classify by the kind of knowledge, not by the activity that produced it:**
|
||||||
|
|
||||||
|
| Knowledge | Type | Spec |
|
||||||
|
| :--- | :--- | :--- |
|
||||||
|
| Why: exploration, alternatives, trade-offs | Discussion | [discussion](references/discussion-authoring.md) |
|
||||||
|
| What we decided (architecture) | ADR | [adr](references/adr-authoring.md) |
|
||||||
|
| How to build it: phases, constraints, done-definition | Plan | [plan](references/plan-authoring.md) |
|
||||||
|
| What broke and why (root cause) | Debug Record | [debug](references/debug-record-authoring.md) |
|
||||||
|
| A general mental model or technique | Knowledge | [knowledge](references/knowledge-authoring.md) |
|
||||||
|
|
||||||
|
A rich session may justify more than one (e.g. Debug Record + Discussion). Split them;
|
||||||
|
don't write one hybrid document.
|
||||||
|
3. **Draft** each document following its spec. Read the spec before writing.
|
||||||
|
4. **Avoid overlap.** Each fact has one owning document: the Discussion owns the reasoning,
|
||||||
|
the ADR the decision, the Plan the steps, the Debug Record the evidence, Knowledge the
|
||||||
|
general lesson. Others link to it instead of repeating it.
|
||||||
|
5. **Save** to the location I choose (see below). Discussions and Debug Records are
|
||||||
|
historical and never rewritten later. ADRs and Plans get `status: superseded` when replaced.
|
||||||
|
|
||||||
|
## Your call
|
||||||
|
- **Type(s)**: confirm the classification from step 2.
|
||||||
|
- **The key sentence**: before drafting, ask me to state the core in my own words: the
|
||||||
|
decision, the root cause, or the insight. Build the draft around my sentence.
|
||||||
|
- **Where it goes**: offer 2-3 options, recommended first, e.g.
|
||||||
|
`~/Brain/00-inbox/` (Recommended) / the project's `docs/` / Brain's typed folder for this type.
|
||||||
|
|
||||||
|
## Done when
|
||||||
|
- The file exists at the chosen location, or we agreed no document is needed.
|
||||||
|
|
||||||
|
## Hands off to
|
||||||
|
- `git-commit`: to commit the document if it lives in a repo.
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
# 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: <project-name>
|
||||||
|
date: YYYY-MM-DD
|
||||||
|
tags: [list, of, tags]
|
||||||
|
---
|
||||||
|
|
||||||
|
# <Short Architectural Decision Title>
|
||||||
|
|
||||||
|
## 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: <Name>** — Brief description.
|
||||||
|
* **Option 2: <Name>** — Brief description.
|
||||||
|
* **Option 3: <Name>** — Brief description.
|
||||||
|
|
||||||
|
## Decision Outcome
|
||||||
|
Chosen option: **Option X: <Name>**, because <neutral trade-off rationale grounded in decision drivers>.
|
||||||
|
|
||||||
|
### 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: <Name>
|
||||||
|
* Good, because <argument>.
|
||||||
|
* Bad, because <argument>.
|
||||||
|
|
||||||
|
### Option 2: <Name>
|
||||||
|
* Good, because <argument>.
|
||||||
|
* Bad, because <argument>.
|
||||||
|
|
||||||
|
### Option 3: <Name> (Adopted)
|
||||||
|
* Good, because <argument>.
|
||||||
|
* Bad, because <accepted trade-off>.
|
||||||
|
|
||||||
|
## 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.
|
||||||
|
```
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
# 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: <project-name>
|
||||||
|
tags: [operations, troubleshooting, debugging, <subsystems>]
|
||||||
|
---
|
||||||
|
|
||||||
|
# <Descriptive Incident / RCA Title>
|
||||||
|
|
||||||
|
## 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.
|
||||||
|
```
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
# 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: <project-name>
|
||||||
|
date: YYYY-MM-DD
|
||||||
|
tags: [list, of, tags]
|
||||||
|
---
|
||||||
|
|
||||||
|
# Architectural Discussion: <Descriptive Title>
|
||||||
|
|
||||||
|
## 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.
|
||||||
|
```
|
||||||
@@ -0,0 +1,209 @@
|
|||||||
|
# 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<br/>(A concrete situation where confusion or friction happens)"] --> Trap["2. The Intuitive First Attempt & Why It Breaks<br/>(The obvious solution and the failure mode it hits)"]
|
||||||
|
Trap --> Concept["3. The Core Mental Model<br/>(The way of thinking that resolves the breakdown)"]
|
||||||
|
Concept --> Mech["4. Mechanism & Progressive Depth<br/>(How it works in practice; code, state transitions, diagrams)"]
|
||||||
|
Mech --> Picture["5. The Mental Picture<br/>(A tangible analogy anchoring the concept)"]
|
||||||
|
Picture --> Tradeoffs["6. The Trade-Offs & Costs<br/>(What this approach costs; when NOT to reach for it)"]
|
||||||
|
Tradeoffs --> Principle["7. One Principle to Remember<br/>(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:
|
||||||
|
- <primary-domain>
|
||||||
|
- <sub-topic>
|
||||||
|
tags:
|
||||||
|
- <search-tag-1>
|
||||||
|
- <search-tag-2>
|
||||||
|
related:
|
||||||
|
- ../methods/<related-method>.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?
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
# 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: <project-name>
|
||||||
|
tags: [list, of, tags]
|
||||||
|
---
|
||||||
|
|
||||||
|
# <Project Title> 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**: <Target host, appliance, or environment>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 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: <Phase Name>
|
||||||
|
* **Deliverable 0.1**: Concrete action and files modified.
|
||||||
|
* **Deliverable 0.2**: Concrete action and files modified.
|
||||||
|
|
||||||
|
### Phase 1: <Phase Name>
|
||||||
|
* **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.
|
||||||
|
```
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
---
|
||||||
|
name: git-commit
|
||||||
|
description: >-
|
||||||
|
Turn working-tree changes into clean, atomic Conventional Commits. Use when the user types
|
||||||
|
/git-commit or asks to commit, split changes, or write a commit message. The diff is the
|
||||||
|
source of truth; the user approves every commit.
|
||||||
|
---
|
||||||
|
|
||||||
|
# Git Commit
|
||||||
|
|
||||||
|
## Use when
|
||||||
|
- `/git-commit`, "commit this", "split these changes", "write the commit message".
|
||||||
|
- Rebase, squash, cherry-pick, merge or reset: read
|
||||||
|
[references/history-editing.md](references/history-editing.md) first.
|
||||||
|
|
||||||
|
## Steps
|
||||||
|
1. **Inspect.** Repo root, branch and upstream, `git status`, `git diff`, `git diff --cached`.
|
||||||
|
Read the repo's `AGENTS.md` for commit conventions and `git log -n 5 --oneline` for style.
|
||||||
|
Trust the diff over anything said in the conversation.
|
||||||
|
2. **Group** changes into slices. A slice is one coherent change that could be reviewed or
|
||||||
|
reverted on its own (e.g. refactor, then feature, then tests, then docs). Flag accidental
|
||||||
|
additions: scratch files, unrelated formatting, debug code.
|
||||||
|
3. **Order** slices so each commit builds on the previous one.
|
||||||
|
4. **Draft messages** using the repo's types (`AGENTS.md`), otherwise Conventional Commits
|
||||||
|
(`feat`, `fix`, `refactor`, `docs`, `test`, `build`, `ci`, `chore`, ...). Match depth to
|
||||||
|
significance:
|
||||||
|
- trivial: subject only;
|
||||||
|
- several concrete changes: subject + bullet body;
|
||||||
|
- non-obvious trade-off: subject + bullets + `Rationale:` line.
|
||||||
|
5. **Gate** each slice before committing:
|
||||||
|
right repo; intended branch (not `main`/`master` unless the repo's `AGENTS.md` allows it);
|
||||||
|
staged content is only this slice; tests/build run or explicitly waived; message matches
|
||||||
|
the diff.
|
||||||
|
6. **Commit** the approved slice by staging exactly its files or hunks (never a blind
|
||||||
|
`git add -A` when other changes exist), then verify: new SHA, `git log -1`, what remains
|
||||||
|
in the working tree.
|
||||||
|
7. Repeat for the remaining slices.
|
||||||
|
|
||||||
|
In `/practice`, stop after step 4: explain the boundaries and let me run the commands.
|
||||||
|
Commit without asking only if I said so in this session, and never on `main`/`master` unless
|
||||||
|
the repo allows it.
|
||||||
|
|
||||||
|
## Your call
|
||||||
|
- **How to slice.** Offer 2-3 options, recommended first, each with its draft messages.
|
||||||
|
Example: "1 commit" / "2 commits: refactor + feature" / "3 commits: refactor, feature, tests".
|
||||||
|
- **Approve each commit** before it is created.
|
||||||
|
- **What next** after the last commit: offer 2-3 actions (push, open PR, keep working, run `document`).
|
||||||
|
|
||||||
|
## Done when
|
||||||
|
- Every approved slice is committed, verified by SHA, and leftover changes are reported.
|
||||||
|
|
||||||
|
## Hands off to
|
||||||
|
- `document`: if a commit carries a decision or insight worth more than a commit message.
|
||||||
|
- `commit-logger` (Brain only): after a verified commit, if installed.
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
# History Editing
|
||||||
|
|
||||||
|
Rules for rewriting or combining history. Read before any of these operations.
|
||||||
|
|
||||||
|
## Squash
|
||||||
|
- Do it to collapse noise (checkpoint or fixup commits) into one coherent change.
|
||||||
|
- Don't squash a meaningful sequence (foundation, feature, tests, docs) into one giant commit.
|
||||||
|
|
||||||
|
## Rebase
|
||||||
|
- Fine on local, unshared branches, to keep history linear and tidy before integrating.
|
||||||
|
- Never rebase or force-push a branch others may have pulled without my explicit OK.
|
||||||
|
|
||||||
|
## Cherry-pick
|
||||||
|
1. Inspect the source commit and what it depends on.
|
||||||
|
2. Confirm the target working tree is clean.
|
||||||
|
3. Cherry-pick, inspect the resulting diff, run validation.
|
||||||
|
4. On conflicts or hidden dependencies: stop and report.
|
||||||
|
|
||||||
|
## Merge
|
||||||
|
- Follow the repo's integration policy (merge commit vs fast-forward vs rebase).
|
||||||
|
- Keep merge commits when the branch shape tells a useful story (long-running feature work).
|
||||||
|
|
||||||
|
## Reset and restore
|
||||||
|
- **Safe** (keeps file contents): `git restore --staged <file>`, `git reset --soft <ref>`.
|
||||||
|
- **Destructive** (discards work): `git restore <file>`, `git reset --hard`, `git clean -fd`,
|
||||||
|
`git push --force`.
|
||||||
|
- Never run a destructive command without telling me exactly what would be lost and getting an
|
||||||
|
explicit yes.
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
---
|
||||||
|
name: practice
|
||||||
|
description: >-
|
||||||
|
Socratic tutoring mode. Use when the user types /practice, asks to learn or be taught
|
||||||
|
something, or wants guidance without the agent writing the solution. The learner writes
|
||||||
|
all code and drives the analysis; the agent asks, points, explains, and reviews.
|
||||||
|
---
|
||||||
|
|
||||||
|
# Practice
|
||||||
|
|
||||||
|
## Use when
|
||||||
|
- `/practice [topic or problem]`, "teach me", "help me understand", "don't write it for me".
|
||||||
|
- Works in any repo or as a pure concept question. No curriculum needed.
|
||||||
|
- Not for urgent production failures: use `diagnose`.
|
||||||
|
|
||||||
|
## Steps
|
||||||
|
1. Ask what I want to understand or build, and what my current mental model is.
|
||||||
|
If no topic was given, ask: "What concept, mechanism, or problem do you want to explore?"
|
||||||
|
2. Help at the lowest level that works, moving up only when I'm stuck or missing a prerequisite:
|
||||||
|
1. A question that makes me check my own assumption.
|
||||||
|
2. Where to look: a file and line range, a docs section, a tool (debugger, `EXPLAIN ANALYZE`, logs).
|
||||||
|
3. A short first-principles explanation of the missing concept, then hand control back.
|
||||||
|
4. A minimal demo in an unrelated example (never in my working code).
|
||||||
|
3. Let me attempt it: code, prediction, explanation, or diagnosis. Ask me to read my own
|
||||||
|
result before you comment.
|
||||||
|
4. Review what I produced: say what is right, then point at subtle gaps with a question.
|
||||||
|
5. If I explicitly ask for a direct answer, give it without resistance, then check it with one
|
||||||
|
follow-up question about my case.
|
||||||
|
6. Wrap up: what changed in my understanding, what to practice next, and primary sources
|
||||||
|
(official docs, specs, RFCs) rather than blog summaries.
|
||||||
|
|
||||||
|
Never edit files in my working repo or run implementation commands there, unless I explicitly
|
||||||
|
say so. Keep each reply short and focused on the next step.
|
||||||
|
|
||||||
|
## Your call
|
||||||
|
- **Did I understand it?** In deliberate practice, pose one transfer challenge (a changed context
|
||||||
|
or edge case) before calling a concept done. For a quick "how does X work?" question, offer it
|
||||||
|
but don't require it.
|
||||||
|
- **Save a practice record?** Offer at a real milestone, not after every question.
|
||||||
|
Template: [references/practice-record.md](references/practice-record.md).
|
||||||
|
|
||||||
|
## Done when
|
||||||
|
- I solve the transfer challenge, or I close the topic.
|
||||||
|
|
||||||
|
## Hands off to
|
||||||
|
- `document`: when a durable insight came out of the session.
|
||||||
|
- `git-commit`: it proposes slices and messages; I type the commit myself.
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
# Practice Record Template
|
||||||
|
|
||||||
|
Default location: `~/Brain/00-inbox/practice-YYYY-MM-DD-<topic>.md`.
|
||||||
|
Before saving, ask where it goes (2-3 options, `~/Brain/00-inbox` recommended).
|
||||||
|
|
||||||
|
```markdown
|
||||||
|
---
|
||||||
|
type: practice
|
||||||
|
date: YYYY-MM-DD
|
||||||
|
project: <project-name or none>
|
||||||
|
topics: [<topic-1>, <topic-2>]
|
||||||
|
status: completed | active
|
||||||
|
---
|
||||||
|
|
||||||
|
# Practice: <topic or problem>
|
||||||
|
|
||||||
|
## Starting point
|
||||||
|
The question, bug, or mechanism I set out to understand.
|
||||||
|
|
||||||
|
## How my mental model changed
|
||||||
|
- Before: what I assumed.
|
||||||
|
- After: the mechanism, invariant, or rule that clicked.
|
||||||
|
|
||||||
|
## Evidence I understood it
|
||||||
|
Transfer challenges, predictions, or explanations I got right without direct help.
|
||||||
|
|
||||||
|
## Still open
|
||||||
|
- Concepts to revisit.
|
||||||
|
- Primary references (official docs, specs, source paths).
|
||||||
|
```
|
||||||
Reference in new issue
Block a user