diff --git a/.obsidian/appearance.json b/.obsidian/appearance.json index c0d780f..f060b06 100644 --- a/.obsidian/appearance.json +++ b/.obsidian/appearance.json @@ -1,3 +1,4 @@ { - "cssTheme": "GitHub Theme" + "cssTheme": "GitHub Theme", + "nativeMenus": true } \ No newline at end of file diff --git a/AGENTS.md b/AGENTS.md index 4ae729d..ec1fe42 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -13,7 +13,7 @@ The Brain stores five fundamentally different kinds of information: | `inbox/` | Unprocessed captures — no classification required. Write first, classify later. | | `knowledge/` | Durable understanding: concepts, technologies, and methods. | | `projects/` | Contextual, project-specific documents. Each project owns its own sub-folder. | -| `records/` | Historical artifacts: journals, discussions, decisions, experiments. | +| `records/` | Historical artifacts: journals, debug post-mortems, discussions, decisions, experiments. | | `practice/` | Algorithm exercises, LeetCode writeups, and implementation drills. | | `agents/` | Canonical agent specifications, behavioral guardrails, and role profiles. | @@ -73,7 +73,8 @@ The folder establishes context (ownership/locality). The document's `type` field Historical artifacts. The original messy thinking is worth preserving — often what you want to recover later is not just the conclusion, but *why* you reached it. Sub-directories: -- `journal/` — Dated engineering journals and retrospectives. +- `journal/` — Dated daily engineering journals and retrospectives (strictly one entry per day named `YYYY-MM-DD.md`). +- `debug/` — Epistemic incident reports, root-cause analyses, and diagnostic post-mortems (`type: debug`). - `discussions/` — Conversations that informed decisions or produced knowledge. - `decisions/` — Architectural decision records. - `experiments/` — Prototypes, runbooks, and technical investigations. @@ -95,7 +96,7 @@ Every committed markdown document in the knowledge graph must have a YAML frontm ### Core & Optional Fields -- **`type`** *(Required)*: `knowledge`, `project`, `plan`, `guide`, `decision`, `journal`, `discussion`, `experiment`, `practice`, `inbox`, `reference`, `agent`. +- **`type`** *(Required)*: `knowledge`, `project`, `plan`, `guide`, `decision`, `journal`, `debug`, `discussion`, `experiment`, `practice`, `inbox`, `reference`, `agent`. - **`tags`** *(Optional)*: List of keyword tags (e.g., `tags: [homelab, ddns, networking]` or YAML list format) applicable to any document type for cross-cutting discovery. - **`project`** *(Optional)*: Project identifier (e.g., `project: homelab`, `project: dynu-monitor`, `project: bitetrack`) indicating context ownership. - **`status`** *(Conditional)*: Lifecycle status for plans (`draft`, `active`, `completed`, `abandoned`), decisions (`proposed`, `accepted`, `superseded`), projects (`planned`, `active`, `paused`, `completed`), knowledge (`draft`, `stable`), practice (`active`, `completed`), and agents (`active`, `draft`, `archived`). @@ -143,7 +144,7 @@ project: project-name tags: [list, of, tags] --- -# journal (historical record) +# journal (daily historical log) --- type: journal date: YYYY-MM-DD @@ -151,6 +152,14 @@ tags: [list, of, tags] project: optional-project-name --- +# debug (incident reports, postmortems, root cause analyses) +--- +type: debug +date: YYYY-MM-DD +tags: [list, of, tags] +project: optional-project-name +--- + # experiment (prototypes, investigations, runbooks) --- type: experiment @@ -228,7 +237,8 @@ In this repository, commit types directly reflect the Brain's semantic taxonomy | `guide` | Practical SOPs, runbooks, and operation procedures | `guide(nixos): add terminal workspace walkthrough` | | `discussion` | Architectural inquiries, evaluations, trade-offs | `discussion(homelab): evaluate LLDAP vs Stalwart auth` | | `decision` | Architectural Decision Records (ADRs) | `decision(nixos): adopt standalone workstation model` | -| `journal` | Dated journals, post-mortems, RCA logs | `journal(homelab): record Gitea mirror DNS RCA` | +| `journal` | Dated daily engineering journals | `journal: record daily log for 2026-09-21` | +| `debug` | Epistemic incident reports, postmortems, RCA logs | `debug(homelab): record gitops webhook signature mismatch rca` | | `practice` | Algorithm writeups and LeetCode drills | `practice(leetcode): add 0075 sort colors solution` | | `agent` | Agent specifications, behavioral guardrails, and role profiles | `agent(homelab): document homelab operations agent spec` | | `meta` | Brain governance, `AGENTS.md`, taxonomies, root docs | `meta(agents): establish inbox curation protocol` | @@ -295,7 +305,7 @@ Map each consolidated document to its canonical destination following the [Seman - `technologies/` (tools, libraries, languages, CLI utilities) - `methods/` (architecture patterns, testing, auth, SQL) - **`projects//`** — Project-specific context. Place under `discussions/`, `plans/`, `guides/`, or update `README.md`. -- **`records/`** — Historical artifacts (`journal/`, `discussions/`, `decisions/`, `experiments/`). +- **`records/`** — Historical artifacts (`journal/`, `debug/`, `discussions/`, `decisions/`, `experiments/`). - **`practice/`** — Algorithm drills and LeetCode writeups. > [!NOTE] @@ -303,15 +313,20 @@ Map each consolidated document to its canonical destination following the [Seman ### Step 4: Frontmatter & Content Normalization Transform the staging frontmatter into a valid schema-compliant metadata block: -1. Replace `type: inbox` with the canonical type (`knowledge`, `guide`, `plan`, `decision`, etc.). +1. Replace `type: inbox` with the canonical type (`knowledge`, `guide`, `plan`, `decision`, `debug`, etc.). 2. Add appropriate `status` (`draft` or `stable`), `topics`, `tags`, `project`, or `date` identifiers. 3. Fix markdown parsing errors, heading levels, invalid code fences, or malformed links. 4. Ensure all internal links use standard relative Markdown paths (never `file:///` URIs). ### Step 5: Directory Placement & Cross-Reference Linking 1. Write the document to its designated canonical directory (create new directories when needed). -2. Remove the staging file(s) and any superseded drafts from `inbox/`. -3. Update relevant parent indices (e.g., project `README.md` sections) and link related existing knowledge notes (e.g., adding `related: [...]` and cross-reference links in sibling documents). +2. **Incident & Debug Processing**: When curating an incident capture (`*-debug.md`): + - Normalize to `type: debug` and move to `records/debug/YYYY-MM-DD-.md`. + - Update or create the daily journal at `records/journal/YYYY-MM-DD.md`. + - Under `## Incidents & Debugging`, record a concise bullet summary and relative link: + `- [Title](../debug/YYYY-MM-DD-.md): Root cause summary and declarative remediation.` +3. Remove the staging file(s) and any superseded drafts from `inbox/`. +4. Update relevant parent indices (e.g., project `README.md` sections) and link related existing knowledge notes (e.g., adding `related: [...]` and cross-reference links in sibling documents). ### Step 6: Atomic Git Commit Create an isolated atomic commit for each curated document and any adjacent modified files using the [Semantic Commit Taxonomy](#git-commit-standards): diff --git a/agents/homelab-operations.md b/agents/homelab-operations.md index a5ba2ce..7eeb09c 100644 --- a/agents/homelab-operations.md +++ b/agents/homelab-operations.md @@ -27,7 +27,7 @@ tags: * **Mandatory Execution Boundaries**: The agent must **never autonomously** create Git commits, push to any remote, merge branches, deploy to production, execute `nixos-rebuild`, or perform service restarts to roll out changes. * **Proposal-Only Commits & Deployment Runbooks**: When local validation passes, the agent proposes atomic commits with rationale and validation proof, and provides structured deployment runbooks with rollback steps. The user owns all commit, branch merge, and production rollout transitions. * **Interactive Execution Harness**: Follows a 6-part checkpoint review protocol (Current State, Reasoning, Changes, Validation, Next Action, Recovery) at meaningful milestones, pausing before crossing user-controlled boundaries. - * **Incident Journaling Invariant**: Directs investigative findings, hypothesis testing, and non-obvious troubleshooting lessons into the Second Brain journal (`records/journal/`). + * **Incident Debugging Invariant**: Directs investigative findings, hypothesis testing, and non-obvious troubleshooting lessons into the Second Brain inbox for staging and subsequent curation into `records/debug/`. --- @@ -54,9 +54,9 @@ Branching policy is decoupled from diagnostic reasoning: * Straightforward remediation uses `fix/` or `feat/`. * **Git branches do not represent hypotheses**: Hypotheses belong to the scientific method and are documented in the diagnostic record/journal, not in ephemeral Git branches. Once root cause is proven, exploratory instrumentation is stripped so that only clean, atomic production commits are proposed. -### D. Checkpoints vs. Durable Incident Journal +### D. Checkpoints vs. Durable Debug Record * **Checkpoints**: Transient execution-control mechanisms during the live session that keep the operator aligned on current state, reasoning, and upcoming actions. -* **Incident Journal (`records/journal/`)**: The durable historical, technical, and epistemic artifact. Checkpoints are not transcribed verbatim; rather, the verified progression of hypotheses, evidence, declarative changes, and recovery outcomes is synthesized into the permanent Second Brain knowledge base. +* **Debug Record (`records/debug/`)**: The durable historical, technical, and epistemic artifact. Checkpoints are not transcribed verbatim; rather, the verified progression of hypotheses, evidence, declarative changes, and recovery outcomes is synthesized into the permanent Second Brain knowledge base under `records/debug/` and cross-referenced in daily journals (`records/journal/`). --- @@ -144,7 +144,7 @@ flowchart TD D --> CP4{"Deployment Handoff"} CP4 -->|"User Deploys"| E["5. User-Controlled Production Deployment
(Core rebuild or Sites workload rollout)"] E --> F["6. Post-Deployment Verification
(Agent verifies via SSH)"] - F --> G["7. Document in Brain Journal
(~/Brain/records/journal/)"] + F --> G["7. Document in Brain Inbox
(~/Brain/inbox/YYYY-MM-DD-<slug>-debug.md)"] ``` ### B. Checkpoint Protocol @@ -212,8 +212,8 @@ This policy applies equally to Core/NixOS system changes and Sites application c Agent provides the workload-specific deployment handoff runbook. User executes the deployment. 6. **Post-Deployment Verification**: Agent executes read-only SSH diagnostic commands to verify the bug is resolved and no regressions occurred. Checkpoint findings. -7. **Document in Brain Journal**: - If troubleshooting produced non-obvious diagnostic reasoning, architectural insights, or reusable operational lessons, document the incident in `~/Brain/records/journal/`. +7. **Document in Brain Inbox**: + If troubleshooting produced non-obvious diagnostic reasoning, architectural insights, or reusable operational lessons, author an epistemic incident report staged in `~/Brain/inbox/YYYY-MM-DD--debug.md` (`type: inbox`, `project: homelab`). During Second Brain curation, this artifact is normalized to `type: debug`, committed to `records/debug/YYYY-MM-DD-.md`, and referenced in the day's daily journal (`records/journal/YYYY-MM-DD.md`). ### F. CI/CD & Gitea Actions (`act_runner`) Invariants * **Pre-Baked Images over In-Job Installers**: Always declare `container: { image: }` (e.g., `nixery.dev/shell/coreutils/git/nix/nodejs:latest`, `python:3.12-slim`, `node:20-alpine`) rather than running dynamic installers in generic Ubuntu runners. Note that `act_runner` expects standard FHS utilities (like `/bin/sleep`) at container initialization; minimal images like raw `nixos/nix` lack `/bin/sleep` and fail container init. @@ -226,9 +226,11 @@ This policy applies equally to Core/NixOS system changes and Sites application c --- -## 4. Post-Incident Journaling Protocol (Second Brain) +## 4. Post-Incident Debugging & Epistemic Reporting (Second Brain) -Record incidents in the Second Brain (`/home/kiskaadee/Brain/records/journal/YYYY-MM-DD-.md`) whenever troubleshooting produces non-obvious diagnostic reasoning, architectural understanding, or a reusable operational lesson. Routine maintenance and self-explanatory fixes do not require an incident journal. +Capture incidents into the Second Brain inbox (`/home/kiskaadee/Brain/inbox/YYYY-MM-DD--debug.md`) whenever troubleshooting produces non-obvious diagnostic reasoning, architectural understanding, or a reusable operational lesson. Routine maintenance and self-explanatory fixes do not require an incident report. + +During Second Brain curation, the document is moved to `/home/kiskaadee/Brain/records/debug/YYYY-MM-DD-.md` (`type: debug`), and cross-referenced in the day's daily journal (`/home/kiskaadee/Brain/records/journal/YYYY-MM-DD.md`). ### A. Core Behavioral Contract & Epistemic Principles * **Preserve Investigative Reasoning**: Don't document only what fixed the incident; document how the evidence led from the initial observation to the explanation. @@ -238,12 +240,28 @@ Record incidents in the Second Brain (`/home/kiskaadee/Brain/records/journal/YYY * **Proportional Depth**: Scale detail to the incident's learning value. Do not manufacture artificial hypotheses or boilerplate for simple, straightforward fixes. * **Transferable Diagnostic Knowledge**: Focus on diagnostic principles that generalize to future, dissimilar incidents across system boundaries. * **Zero Secret Leakage**: Never log raw or truncated secrets. Document verification matches securely. -* **Checkpoints vs. Durable Journal**: Interactive checkpoints serve as transient execution-control mechanisms during the live session; the journal is the durable historical and technical record. Do not transcribe checkpoints or conversational exchanges verbatim. Synthesize the verified progression of hypotheses, evidence, declarative changes, and recovery outcomes. The checkpoints naturally surface the key investigation transitions needed for an accurate journal. +* **Checkpoints vs. Durable Report**: Interactive checkpoints serve as transient execution-control mechanisms during the live session; the debug record is the durable historical and technical report. Do not transcribe checkpoints or conversational exchanges verbatim. Synthesize the verified progression of hypotheses, evidence, declarative changes, and recovery outcomes. The checkpoints naturally surface the key investigation transitions needed for an accurate report. -### B. Frontmatter Schema: +### B. Frontmatter Schemas: + +**Staging Frontmatter** (`~/Brain/inbox/YYYY-MM-DD--debug.md`): ```yaml --- -type: journal +type: inbox +created: YYYY-MM-DD +project: homelab +tags: + - operations + - homelab + - troubleshooting + - +--- +``` + +**Curated Target Frontmatter** (`~/Brain/records/debug/YYYY-MM-DD-.md`): +```yaml +--- +type: debug project: homelab date: YYYY-MM-DD tags: @@ -331,4 +349,4 @@ When instructions appear to conflict, stop and surface the conflict rather than * [Homelab Core Platform Agent](homelab-core.md) * [Brain GitOps & Auto-Sync Deployment Pipeline Guide](../projects/homelab/guides/brain-gitops-deployment-pipeline.md) * [Scientific Incident Investigation & Epistemic Journaling Protocol](../knowledge/methods/incident-investigation-and-journaling.md) -* [Webhook HMAC Signature Mismatch RCA](../records/journal/2026-09-21-gitops-webhook-payload-signature-mismatch.md) +* [Webhook HMAC Signature Mismatch RCA](../records/debug/2026-09-21-gitops-webhook-payload-signature-mismatch.md) diff --git a/knowledge/methods/incident-investigation-and-journaling.md b/knowledge/methods/incident-investigation-and-journaling.md index b0f485f..b942ca1 100644 --- a/knowledge/methods/incident-investigation-and-journaling.md +++ b/knowledge/methods/incident-investigation-and-journaling.md @@ -108,7 +108,7 @@ When verifying whether two endpoints possess matching credentials, never log raw ## 3. Modular Investigation Structure -When authoring an incident journal (`Brain/records/journal/YYYY-MM-DD-.md`), apply the following modular sections as appropriate: +When authoring an epistemic incident report (`Brain/records/debug/YYYY-MM-DD-.md` with `type: debug`), apply the following modular sections as appropriate: ### 1. System Context & Fundamentals * Establish the specific role of the affected subsystem. diff --git a/scripts/validate-brain.py b/scripts/validate-brain.py index b7ef6cd..0f5f4bd 100755 --- a/scripts/validate-brain.py +++ b/scripts/validate-brain.py @@ -22,7 +22,7 @@ ROOT = pathlib.Path(__file__).parent.parent.resolve() VALID_TYPES = { "knowledge", "project", "plan", "guide", "decision", "journal", "discussion", "experiment", "practice", "inbox", "reference", - "agent", + "agent", "debug", } DEPRECATED_DIRS = [