agent(skills): package commit-logger skill and register inbox ledger
Brain Structural Validation / Validate Markdown Structure & Links (push) Successful in 8s
Brain Structural Validation / Validate Markdown Structure & Links (push) Successful in 8s
- Add canonical commit-logger SKILL.md enforcing RFC 4180 fact capture - Add log-commit.sh deterministic capture script with --force override for Brain - Add commit-logger README.md adhering to DirectoryContract (type: agent) - Register commit-logger in global skill collection Package Index - Exempt commit-log.csv from inbox-curation drafts triage
This commit is contained in:
1 parent
32ff96fa41
commit
364601af3d
5 files changed
+286
-1
No files matched your search
@@ -134,4 +134,5 @@ The primary threat to this collection's health is **duplicate authority**, not m
|
|||||||
| [Engineering Tutor](engineering-tutor/README.md) | [README](engineering-tutor/README.md) | [SKILL.md](engineering-tutor/SKILL.md) | — |
|
| [Engineering Tutor](engineering-tutor/README.md) | [README](engineering-tutor/README.md) | [SKILL.md](engineering-tutor/SKILL.md) | — |
|
||||||
| [Git Commit](git-commit/README.md) | [README](git-commit/README.md) | [SKILL.md](git-commit/SKILL.md) | — |
|
| [Git Commit](git-commit/README.md) | [README](git-commit/README.md) | [SKILL.md](git-commit/SKILL.md) | — |
|
||||||
| [Documentation Router](documentation-router/README.md) | [README](documentation-router/README.md) | [SKILL.md](documentation-router/SKILL.md) | [5 authoring specs](documentation-router/references/) |
|
| [Documentation Router](documentation-router/README.md) | [README](documentation-router/README.md) | [SKILL.md](documentation-router/SKILL.md) | [5 authoring specs](documentation-router/references/) |
|
||||||
|
| [Commit Logger](commit-logger/README.md) | [README](commit-logger/README.md) | [SKILL.md](commit-logger/SKILL.md) | — |
|
||||||
| [Skill Builder](skill-builder/README.md) | [README](skill-builder/README.md) | [SKILL.md](skill-builder/SKILL.md) | [Evaluation checklist](skill-builder/references/skill-evaluation-checklist.md) |
|
| [Skill Builder](skill-builder/README.md) | [README](skill-builder/README.md) | [SKILL.md](skill-builder/SKILL.md) | [Evaluation checklist](skill-builder/references/skill-evaluation-checklist.md) |
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
---
|
||||||
|
type: agent
|
||||||
|
status: active
|
||||||
|
name: commit-logger
|
||||||
|
kind: skill
|
||||||
|
project: brain
|
||||||
|
tags:
|
||||||
|
- git
|
||||||
|
- commit-logging
|
||||||
|
- ledger
|
||||||
|
- capture
|
||||||
|
---
|
||||||
|
|
||||||
|
# 📝 Commit Logger
|
||||||
|
|
||||||
|
**Commit Logger** is a lightweight, single-pass operational skill responsible for capturing verified Git commit events into Brain's machine-readable ledger (`00-inbox/commit-log.csv`).
|
||||||
|
|
||||||
|
It serves as the deterministic capture boundary between Git repository operations and Brain's historical reflection lifecycle.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🏛️ System Role & Architectural Position
|
||||||
|
|
||||||
|
The knowledge capture pipeline cleanly separates mechanical event logging from retrospective synthesis:
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
flowchart LR
|
||||||
|
Producer["git-commit<br/>(Verified Commit SHA)"] --> Logger["commit-logger<br/>(Immutable Fact Capture)"]
|
||||||
|
Logger --> Ledger[("00-inbox/commit-log.csv<br/>(Event Ledger)")]
|
||||||
|
Ledger --> Consumer["journal-builder (/journal)<br/>(Reconstruct, Test, Synthesize)"]
|
||||||
|
Consumer --> Journal["03-records/journal/<br/>(Daily Journal Entry)"]
|
||||||
|
```
|
||||||
|
|
||||||
|
* **`commit-logger` preserves evidence**;
|
||||||
|
* **`journal-builder` creates meaning**.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🔑 Core Guarantees & Invariants
|
||||||
|
|
||||||
|
1. **Authoritative Event Identity**: The full 40-character commit SHA is the authoritative event identity. The CSV row is only its durable representation.
|
||||||
|
2. **Pure Fact Capture (Zero Interpretation)**: Captures only immutable Git metadata. It does not infer rationale, assign semantic lineage, query the user, or synthesize prose.
|
||||||
|
3. **Brain Recursion Guard**: Commits inside the `Brain` repository (`/home/kiskaadee/Brain`) are strictly non-loggable to prevent recursive logging loops.
|
||||||
|
4. **Authoritative Project Mapping**: Maps repositories to `06-projects/` only when an authoritative directory or README reference exists; otherwise leaves `project` empty (`""`) without guessing.
|
||||||
|
5. **Idempotency Barrier**: Appends strictly unique commit SHAs. Duplicate invocations for the same commit are silent no-ops.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📊 Ledger Schema (`00-inbox/commit-log.csv`)
|
||||||
|
|
||||||
|
```csv
|
||||||
|
committed_at,repository,project,branch,commit_sha,parent_sha,subject
|
||||||
|
```
|
||||||
|
|
||||||
|
| Column | Description | Example |
|
||||||
|
| :--- | :--- | :--- |
|
||||||
|
| `committed_at` | Committer timestamp (ISO-8601 with timezone) | `2026-10-02T16:42:13-05:00` |
|
||||||
|
| `repository` | Repository root directory name | `bdinvite` |
|
||||||
|
| `project` | Brain project slug (from `06-projects/`) or `""` | `bdinvite` |
|
||||||
|
| `branch` | Current branch name | `feat/gitops` |
|
||||||
|
| `commit_sha` | Full 40-character commit SHA | `a81f3c2e9b7d84f...` |
|
||||||
|
| `parent_sha` | First parent SHA (or `""` if initial commit) | `91bc7de41f2a34b...` |
|
||||||
|
| `subject` | RFC 4180 escaped commit subject line | `"validate manifest after pull"` |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🛠️ Usage & Invocations
|
||||||
|
|
||||||
|
### Inter-Skill Invocation
|
||||||
|
Invoked programmatically by [`git-commit`](../git-commit/README.md) after verifying the resulting commit SHA:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bash /home/kiskaadee/Brain/05-agents/skills/commit-logger/scripts/log-commit.sh [COMMIT_SHA]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Manual / Catch-up Run
|
||||||
|
Can be executed in any repository workspace to capture the current `HEAD` or a specific commit:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# In any project workspace:
|
||||||
|
bash ~/Brain/05-agents/skills/commit-logger/scripts/log-commit.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🔗 Related Components
|
||||||
|
|
||||||
|
* 📦 **[Git Commit](../git-commit/README.md)**: Upstream producer that constructs and verifies atomic commits.
|
||||||
|
* 📥 **[Inbox Directory](../../../00-inbox/README.md)**: Housing location for `commit-log.csv`.
|
||||||
|
* 🧭 **[Skill Collection Catalog](../README.md)**: Index and architectural matrix of all configured skills.
|
||||||
@@ -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 (owned strictly by `journal-builder`).
|
||||||
|
3. **Lossless Essential Metadata**:
|
||||||
|
Captures the complete commit identity and essential Git attributes:
|
||||||
|
`committed_at,repository,project,branch,commit_sha,parent_sha,subject`
|
||||||
|
4. **Authoritative Project Resolution**:
|
||||||
|
Resolves the repository directory against Brain's `06-projects/` topology. If no authoritative project mapping exists, preserves the repository name and leaves `project` empty (`""`). Never guesses project associations.
|
||||||
|
5. **Anti-Recursion Invariant**:
|
||||||
|
Commits inside the `Brain` repository itself (`/home/kiskaadee/Brain`) are strictly non-loggable by default to prevent recursion. Any automated or hook invocation targeting Brain exits immediately as a no-op. When Brain commits represent meaningful engineering progress, passing `--force` (or `--allow-brain`) explicitly captures the commit under project `brain`.
|
||||||
|
6. **Idempotency Barrier**:
|
||||||
|
The full 40-character commit SHA acts as a unique idempotency key. If the SHA already exists in `00-inbox/commit-log.csv`, the event is skipped silently.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2. Ledger Contract & Storage Schema
|
||||||
|
|
||||||
|
* **Target File**: `00-inbox/commit-log.csv` (RFC 4180 compliant)
|
||||||
|
* **Header**:
|
||||||
|
```csv
|
||||||
|
committed_at,repository,project,branch,commit_sha,parent_sha,subject
|
||||||
|
```
|
||||||
|
|
||||||
|
### Field Definitions
|
||||||
|
|
||||||
|
| Field | Source | Format / Rule | Example |
|
||||||
|
| :--- | :--- | :--- | :--- |
|
||||||
|
| `committed_at` | Git committer timestamp | ISO-8601 with timezone (`%cI`) | `2026-10-02T16:42:13-05:00` |
|
||||||
|
| `repository` | Top-level working directory | Directory basename | `bdinvite` |
|
||||||
|
| `project` | Brain `06-projects/` mapping | Directory slug if known, else `""` | `bdinvite` |
|
||||||
|
| `branch` | Current Git branch | Branch ref name (or `detached`) | `feat/gitops` |
|
||||||
|
| `commit_sha` | Git commit identity | Full 40-character SHA | `a81f3c2e9b7d84f...` |
|
||||||
|
| `parent_sha` | First parent commit SHA | Full 40-character SHA, or `""` if root | `91bc7de41f2a...` |
|
||||||
|
| `subject` | Commit subject line | RFC 4180 escaped (double-quoted if needed) | `"validate manifest after pull"` |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3. Operational Procedure
|
||||||
|
|
||||||
|
When invoked following a verified commit (or during catch-up):
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
flowchart TD
|
||||||
|
Start["Receive Commit Reference<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 `/home/kiskaadee/Brain` or the directory name is `Brain`, terminate immediately.
|
||||||
|
|
||||||
|
### Step 2: Capture via Deterministic Script
|
||||||
|
Execute the bundled deterministic capture script:
|
||||||
|
```bash
|
||||||
|
bash /home/kiskaadee/Brain/05-agents/skills/commit-logger/scripts/log-commit.sh [COMMIT_SHA]
|
||||||
|
```
|
||||||
|
*(If `COMMIT_SHA` is omitted, the script automatically defaults to `HEAD` of the current repository).*
|
||||||
|
|
||||||
|
Alternatively, execute the extraction steps directly adhering strictly to RFC 4180 escaping and the schema rules above.
|
||||||
|
|
||||||
|
### Step 3: Verification
|
||||||
|
Inspect `00-inbox/commit-log.csv` to confirm the row exists and adheres to RFC 4180 standards.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 4. Architectural Boundaries & System Role
|
||||||
|
|
||||||
|
* **Producer**: `git-commit` invokes `commit-logger` upon verifying the created commit SHA. External or manual commits may trigger `scripts/log-commit.sh` via a Git `post-commit` hook.
|
||||||
|
* **Storage**: `00-inbox/commit-log.csv` is an append-only raw event ledger. It is exempt from `inbox-curation` triage.
|
||||||
|
* **Consumer**: `journal-builder` (`/journal`) consumes the accumulated records in `commit-log.csv` in batches to conduct retrospectives, drive Socratic learning loops, and synthesize daily journals in `03-records/journal/`.
|
||||||
+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/kiskaadee/Brain}"
|
||||||
|
LEDGER_FILE="${BRAIN_ROOT}/00-inbox/commit-log.csv"
|
||||||
|
|
||||||
|
TARGET_REF="HEAD"
|
||||||
|
FORCE_ALLOW_BRAIN=false
|
||||||
|
|
||||||
|
for arg in "$@"; do
|
||||||
|
if [[ "$arg" == "--force" ]] || [[ "$arg" == "--allow-brain" ]]; then
|
||||||
|
FORCE_ALLOW_BRAIN=true
|
||||||
|
elif [[ "$arg" != -* ]]; then
|
||||||
|
TARGET_REF="$arg"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# 1. Verify Git repository
|
||||||
|
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
||||||
|
echo "commit-logger: not inside a git repository. Exiting." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
REPO_ROOT="$(git rev-parse --show-toplevel)"
|
||||||
|
REPO_NAME="$(basename "${REPO_ROOT}")"
|
||||||
|
|
||||||
|
# 2. Anti-Recursion Invariant: Brain is non-loggable unless explicitly forced
|
||||||
|
if [[ "${REPO_ROOT}" == "${BRAIN_ROOT}" ]] || [[ "${REPO_NAME}" == "Brain" ]]; then
|
||||||
|
if [[ "${FORCE_ALLOW_BRAIN}" != "true" ]]; then
|
||||||
|
# Silent exit as a no-op to prevent recursion
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 3. Extract Immutable Git Metadata
|
||||||
|
COMMIT_SHA="$(git rev-parse "${TARGET_REF}")"
|
||||||
|
PARENT_SHA="$(git rev-parse "${COMMIT_SHA}^" 2>/dev/null || echo "")"
|
||||||
|
COMMITTED_AT="$(git show -s --format=%cI "${COMMIT_SHA}")"
|
||||||
|
SUBJECT="$(git show -s --format=%s "${COMMIT_SHA}")"
|
||||||
|
BRANCH="$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "detached")"
|
||||||
|
|
||||||
|
# 4. Authoritative Project Mapping
|
||||||
|
PROJECT=""
|
||||||
|
if [[ "${REPO_ROOT}" == "${BRAIN_ROOT}" ]] || [[ "${REPO_NAME}" == "Brain" ]]; then
|
||||||
|
PROJECT="brain"
|
||||||
|
elif [[ -d "${BRAIN_ROOT}/06-projects/${REPO_NAME}" ]]; then
|
||||||
|
PROJECT="${REPO_NAME}"
|
||||||
|
elif [[ -d "${BRAIN_ROOT}/06-projects" ]]; then
|
||||||
|
# Look for matching project directory containing repository reference in README.md
|
||||||
|
for proj_dir in "${BRAIN_ROOT}/06-projects"/*; do
|
||||||
|
if [[ -f "${proj_dir}/README.md" ]]; then
|
||||||
|
if grep -qi "${REPO_NAME}" "${proj_dir}/README.md"; then
|
||||||
|
PROJECT="$(basename "${proj_dir}")"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 5. CSV Formatting (RFC 4180 Escaping)
|
||||||
|
escape_csv() {
|
||||||
|
local val="$1"
|
||||||
|
# Double existing double quotes
|
||||||
|
val="${val//\"/\"\"}"
|
||||||
|
# Quote if string contains comma, quote, or newline
|
||||||
|
if [[ "${val}" =~ [,\"\n\r] ]]; then
|
||||||
|
echo "\"${val}\""
|
||||||
|
else
|
||||||
|
echo "${val}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
ESCAPED_SUBJECT="$(escape_csv "${SUBJECT}")"
|
||||||
|
|
||||||
|
# 6. Ensure Ledger File and Header Exist
|
||||||
|
mkdir -p "$(dirname "${LEDGER_FILE}")"
|
||||||
|
if [[ ! -f "${LEDGER_FILE}" ]]; then
|
||||||
|
echo "committed_at,repository,project,branch,commit_sha,parent_sha,subject" > "${LEDGER_FILE}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 7. Idempotency Barrier: Full 40-char SHA deduplication
|
||||||
|
if grep -q ",${COMMIT_SHA}," "${LEDGER_FILE}" 2>/dev/null; then
|
||||||
|
# Commit already recorded
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 8. Atomic Append
|
||||||
|
echo "${COMMITTED_AT},${REPO_NAME},${PROJECT},${BRANCH},${COMMIT_SHA},${PARENT_SHA},${ESCAPED_SUBJECT}" >> "${LEDGER_FILE}"
|
||||||
@@ -47,7 +47,7 @@ python scripts/validate-brain.py
|
|||||||
If the validator fails prior to curation, resolve existing repository issues or alert the user before proceeding.
|
If the validator fails prior to curation, resolve existing repository issues or alert the user before proceeding.
|
||||||
|
|
||||||
### Step 2: Inventory & Inspection
|
### Step 2: Inventory & Inspection
|
||||||
Scan `00-inbox/` for files to curate, ignoring `.keep`, `README.md`, or active scratch notes specified by the user:
|
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.
|
- Read the content of the staged draft.
|
||||||
- Identify the project context (e.g. `homelab`, `nekoweb`, `brain`, or global/general).
|
- 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.
|
- Determine whether the draft contains a single concept or multiple mixed concerns that should be decomposed into separate files.
|
||||||
|
|||||||
Reference in new issue
Block a user