From 5826a10fa20c6aafb441eecb1c3ce6b8693e4431 Mon Sep 17 00:00:00 2001 From: kiskaadee Date: Mon, 5 Oct 2026 01:37:13 -0500 Subject: [PATCH] refactor: separate portable core skills from vault extensions - Relocate brain/ to extensions/ and rename inbox-curation to draft-curation - Explicitly state vault contracts in extensions (lifecycle taxonomy & ledger) - Enforce portable skill filesystem topology invariant across skills/ and references - Generalize target path defaults to context-defined placeholders and profile inboxes - Update install.sh to manage draft-curation and retire inbox-curation --- {brain => extensions}/commit-logger/SKILL.md | 16 +++++------ .../commit-logger/scripts/log-commit.sh | 18 ++++++------ .../draft-curation}/SKILL.md | 24 ++++++++-------- install.sh | 18 ++++++------ skills/build-skill/SKILL.md | 4 +-- skills/document/SKILL.md | 28 ++++++++++--------- .../references/knowledge-authoring.md | 4 +-- skills/git-commit/SKILL.md | 2 +- skills/practice/references/practice-record.md | 4 +-- 9 files changed, 60 insertions(+), 58 deletions(-) rename {brain => extensions}/commit-logger/SKILL.md (78%) rename {brain => extensions}/commit-logger/scripts/log-commit.sh (76%) rename {brain/inbox-curation => extensions/draft-curation}/SKILL.md (81%) diff --git a/brain/commit-logger/SKILL.md b/extensions/commit-logger/SKILL.md similarity index 78% rename from brain/commit-logger/SKILL.md rename to extensions/commit-logger/SKILL.md index 187f852..3b54647 100644 --- a/brain/commit-logger/SKILL.md +++ b/extensions/commit-logger/SKILL.md @@ -1,14 +1,12 @@ --- 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). +description: Record verified Git commit events as lossless, immutable records in a 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`). +Vault extension: captures Git commit events into a configured knowledge-vault ledger (`00-inbox/commit-log.csv`). Its sole responsibility is **immutable fact capture**. It does not interpret, summarize, or evaluate changes. @@ -28,9 +26,9 @@ Its sole responsibility is **immutable fact capture**. It does not interpret, su 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. + Resolves the repository directory against the vault's project topology (e.g. `06-projects/`). 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`. + Commits inside the vault repository itself (e.g. `~/Brain`) are strictly non-loggable by default to prevent recursion. Any automated or hook invocation targeting the vault exits immediately as a no-op. When vault 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. @@ -50,7 +48,7 @@ Its sole responsibility is **immutable fact capture**. It does not interpret, su | :--- | :--- | :--- | :--- | | `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` | +| `project` | Vault `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...` | @@ -66,7 +64,7 @@ When invoked following a verified commit (or during catch-up): flowchart TD Start["Receive Commit Reference
(SHA or HEAD)"] --> RepoCheck{"Inside Git Repo?"} RepoCheck -->|No| Abort["Exit with Error"] - RepoCheck -->|Yes| Recursion{"Repo == Brain?"} + RepoCheck -->|Yes| Recursion{"Repo == Vault?"} Recursion -->|Yes| NoOp["Silent No-Op Exit"] Recursion -->|No| Extract["Extract Git Metadata & Resolve Project"] Extract --> Dedup{"SHA already in
commit-log.csv?"} @@ -80,7 +78,7 @@ Inspect the target repository: ```bash git rev-parse --show-toplevel ``` -If the repository root is `~/Brain` or the directory name is `Brain`, terminate immediately. +If the repository root matches the configured vault or the directory name is `Brain`, terminate immediately. ### Step 2: Capture via Deterministic Script Execute the bundled deterministic capture script: diff --git a/brain/commit-logger/scripts/log-commit.sh b/extensions/commit-logger/scripts/log-commit.sh similarity index 76% rename from brain/commit-logger/scripts/log-commit.sh rename to extensions/commit-logger/scripts/log-commit.sh index b4d5584..aa6c11c 100755 --- a/brain/commit-logger/scripts/log-commit.sh +++ b/extensions/commit-logger/scripts/log-commit.sh @@ -1,11 +1,11 @@ #!/usr/bin/env bash -# log-commit.sh - Deterministic Git commit event capture for Brain +# log-commit.sh - Deterministic Git commit event capture for structured knowledge vaults # 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" +VAULT_ROOT="${VAULT_ROOT:-${BRAIN_ROOT:-$HOME/Brain}}" +LEDGER_FILE="${VAULT_ROOT}/00-inbox/commit-log.csv" TARGET_REF="HEAD" FORCE_ALLOW_BRAIN=false @@ -27,8 +27,8 @@ 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 +# 2. Anti-Recursion Invariant: Vault repo is non-loggable unless explicitly forced +if [[ "${REPO_ROOT}" == "${VAULT_ROOT}" ]] || [[ "${REPO_NAME}" == "Brain" ]] || [[ "${REPO_NAME}" == "$(basename "${VAULT_ROOT}")" ]]; then if [[ "${FORCE_ALLOW_BRAIN}" != "true" ]]; then # Silent exit as a no-op to prevent recursion exit 0 @@ -44,13 +44,13 @@ 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 +if [[ "${REPO_ROOT}" == "${VAULT_ROOT}" ]] || [[ "${REPO_NAME}" == "Brain" ]] || [[ "${REPO_NAME}" == "$(basename "${VAULT_ROOT}")" ]]; then PROJECT="brain" -elif [[ -d "${BRAIN_ROOT}/06-projects/${REPO_NAME}" ]]; then +elif [[ -d "${VAULT_ROOT}/06-projects/${REPO_NAME}" ]]; then PROJECT="${REPO_NAME}" -elif [[ -d "${BRAIN_ROOT}/06-projects" ]]; then +elif [[ -d "${VAULT_ROOT}/06-projects" ]]; then # Look for matching project directory containing repository reference in README.md - for proj_dir in "${BRAIN_ROOT}/06-projects"/*; do + for proj_dir in "${VAULT_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}")" diff --git a/brain/inbox-curation/SKILL.md b/extensions/draft-curation/SKILL.md similarity index 81% rename from brain/inbox-curation/SKILL.md rename to extensions/draft-curation/SKILL.md index 36366b9..082dd78 100644 --- a/brain/inbox-curation/SKILL.md +++ b/extensions/draft-curation/SKILL.md @@ -1,14 +1,16 @@ --- -name: inbox-curation +name: draft-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). + Triage, classify, format, validate, and move raw notes and drafts from an inbox or staging + directory into canonical knowledge lifecycle directories (plans, discussions, records, + learning). --- -# Inbox Curation & Graph Ingestion +# Draft Curation & Knowledge 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. +This extension skill governs the systematic ingestion and curation of unprocessed drafts from an inbox/staging directory (e.g. `00-inbox/`) into canonical lifecycle directories. + +> **Vault Contract**: This extension assumes a knowledge vault organized around epistemic lifecycle directories (`01-plans/`, `02-discussions/`, `03-records/`, `04-learning/`) with schema validation and semantic commit conventions. --- @@ -20,10 +22,10 @@ This skill governs the systematic ingestion and curation of unprocessed drafts f - 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. +2. **The Validation Gate**: If the vault has an automated validator (e.g. `python scripts/validate-brain.py`), a curated document MUST pass before any commit is made. +3. **Zero Dangling Drafts**: Once a draft is curated and committed to its destination, the original file in the staging directory 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`). +5. **Atomic Commit Boundary**: Each curated document or cohesive bundle must be committed separately with conventional or vault-specific semantic commit types (`plan`, `discussion`, `knowledge`, `guide`, `debug`). --- @@ -65,7 +67,7 @@ Select the target directory according to the repository's Directory Contracts: | **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 Brain's `AGENTS.md` for templates). +Prepare the compliant YAML frontmatter block matching the destination contract (see vault's `AGENTS.md` or templates). ### Step 4: Interactive Checkpoint Present a 4-point curation checkpoint to the user: @@ -94,7 +96,7 @@ 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: +Package the curated file using conventional or vault semantic commit taxonomy: - `plan(): ` - `discussion(): ` - `debug(): ` diff --git a/install.sh b/install.sh index ac63246..094261c 100755 --- a/install.sh +++ b/install.sh @@ -33,11 +33,11 @@ done # Active skills to install ACTIVE_PORTABLE_SKILLS=(build-skill diagnose document git-commit practice) -ACTIVE_BRAIN_SKILLS=(inbox-curation) +ACTIVE_EXTENSION_SKILLS=(draft-curation) # Note: commit-logger is NOT installed (planned consumer of journal-builder) # Legacy / deprecated skills to clean up or back up if found in target -OBSOLETE_SKILLS=(engineering-tutor engineering-investigation skill-builder documentation-router commit-logger) +OBSOLETE_SKILLS=(engineering-tutor engineering-investigation skill-builder documentation-router commit-logger inbox-curation) echo "=== Target: $TARGET_DIR (mode: $MODE) ===" @@ -50,9 +50,9 @@ if [[ "$CHECK_ONLY" -eq 1 ]]; then missing=$((missing + 1)) fi done - for s in "${ACTIVE_BRAIN_SKILLS[@]}"; do + for s in "${ACTIVE_EXTENSION_SKILLS[@]}"; do if [[ ! -e "$TARGET_DIR/$s" ]]; then - echo " [MISSING] $s (brain)" + echo " [MISSING] $s (extension)" missing=$((missing + 1)) fi done @@ -118,9 +118,9 @@ for s in "${ACTIVE_PORTABLE_SKILLS[@]}"; do fi done -# Install brain skills -for s in "${ACTIVE_BRAIN_SKILLS[@]}"; do - src="$SCRIPT_DIR/brain/$s" +# Install extension skills +for s in "${ACTIVE_EXTENSION_SKILLS[@]}"; do + src="$SCRIPT_DIR/extensions/$s" dest="$TARGET_DIR/$s" if [[ -L "$dest" ]]; then @@ -134,12 +134,12 @@ for s in "${ACTIVE_BRAIN_SKILLS[@]}"; do if [[ "$MODE" == "link" ]]; then ln -sfn "$src" "$dest" - echo " [LINKED] $s (brain) -> $dest" + echo " [LINKED] $s (extension) -> $dest" elif [[ "$MODE" == "copy" ]]; then mkdir -p "$dest" rsync -a --delete "$src/" "$dest/" echo "$SCRIPT_DIR@$(git -C "$SCRIPT_DIR" rev-parse HEAD 2>/dev/null || echo unknown)" > "$dest/.managed-by-skills-repo" - echo " [COPIED] $s (brain) -> $dest" + echo " [COPIED] $s (extension) -> $dest" fi done diff --git a/skills/build-skill/SKILL.md b/skills/build-skill/SKILL.md index 8a12739..fd62033 100644 --- a/skills/build-skill/SKILL.md +++ b/skills/build-skill/SKILL.md @@ -18,9 +18,9 @@ disable-model-invocation: true 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 human procedure: a guide in your docs or vault; - a procedure that needs agent judgment: a skill. Continue. -3. **Check overlap.** List the skills in this repo (`skills/`, `brain/`). Ask where the new +3. **Check overlap.** List the skills in this repo (`skills/`, `extensions/`). 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 diff --git a/skills/document/SKILL.md b/skills/document/SKILL.md index 0903889..4612cb8 100644 --- a/skills/document/SKILL.md +++ b/skills/document/SKILL.md @@ -18,29 +18,31 @@ description: >- 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) | +| 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. - 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, +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 + general lesson. Others link to it instead of repeating it. +5. **Keep references portable**: Use relative paths or context-defined placeholders. Never write absolute file-system paths into documentation. +6. **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. +- **Insights:** when the core insight is unclear, ask about the intent behind important choices, rejected alternatives, and relevant trade-offs. Use these questions to validate the user's understanding, not to expand the scope of the session. - **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. + default notes inbox (from profile) / the project's `docs/` / typed record folder. ## Done when - The file exists at the chosen location, or we agreed no document is needed. diff --git a/skills/document/references/knowledge-authoring.md b/skills/document/references/knowledge-authoring.md index 5325961..e1c2a85 100644 --- a/skills/document/references/knowledge-authoring.md +++ b/skills/document/references/knowledge-authoring.md @@ -17,7 +17,7 @@ Create a Knowledge Article when an engineering effort, investigation, practice d 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/`) +### Target Placement within Knowledge Base or Vault * **`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`). @@ -169,7 +169,7 @@ Conclude with a single reflective heuristic question the reader can ask themselv ## 6. Frontmatter & Metadata Standards -Knowledge articles adhere to the Brain `DirectoryContract` for `04-learning/knowledge/`: +Knowledge articles adhere to standard YAML frontmatter metadata: ```yaml --- diff --git a/skills/git-commit/SKILL.md b/skills/git-commit/SKILL.md index b32ed8b..a38c10d 100644 --- a/skills/git-commit/SKILL.md +++ b/skills/git-commit/SKILL.md @@ -51,4 +51,4 @@ the repo allows it. ## 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. +- `commit-logger`: after a verified commit, if installed. diff --git a/skills/practice/references/practice-record.md b/skills/practice/references/practice-record.md index 41e149e..68e5070 100644 --- a/skills/practice/references/practice-record.md +++ b/skills/practice/references/practice-record.md @@ -1,7 +1,7 @@ # Practice Record Template -Default location: `~/Brain/00-inbox/practice-YYYY-MM-DD-.md`. -Before saving, ask where it goes (2-3 options, `~/Brain/00-inbox` recommended). +Default location: configured notes inbox (or project `docs/`) as `practice-YYYY-MM-DD-.md`. +Before saving, ask where it goes (2-3 options, configured notes inbox recommended). ```markdown ---