Logo Brain Consistency Auditor

Brain Consistency Auditor

Cộng đồng
sherifican
brain-consistency-auditor

Use when a project's shared knowledge/brain files have been edited (CHANGES_PENDING.md, VERSION_HISTORY.md, the project README for agents, the master PLAN file, memory/*.md, MEMORY.md). Cross-references that the brain layer is internally consistent — CHANGES_PENDING headings vs PLAN sections, VERSION_HISTORY monotonicity, MEMORY.md index completeness vs disk files, and dual-path parity when memory lives at two on-disk locations. Flags stale references (e.g., a CHANGES_PENDING entry titled for one patch version while its body retains the previous version's references — a class of bug seen on the reference setup during a patch ship), missing index entries for new memory rule files, version-sequence gaps. Invoke when the user says "audit brain files", "check brain consistency", "verify memory index", or after any brain-file edit session.

Tổng quan

Nhà phát hànhsherifican
Kho mãAgent-FleetOps
Tên kỹ năngbrain-consistency-auditor
Sao
34
Bản fork
0
Tệp đi kèm
Chỉ có hướng dẫn
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • Hướng dẫn có đủ mọi thứ cần thiết

    Mọi thứ mô hình cần đều nằm trong hướng dẫn — không có tệp bổ sung cần đồng bộ.

  • Mã nguồn mở

    Được sherifican công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Brain Consistency Auditor trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/sherifican/Agent-FleetOps/tree/main/skills/brain-consistency-auditor
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/sherifican/Agent-FleetOps.git /tmp/Agent-FleetOps
mkdir -p .claude/skills
cp -r /tmp/Agent-FleetOps/skills/brain-consistency-auditor .claude/skills/brain-consistency-auditor
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Brain Consistency Auditor trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Brain Consistency Auditor ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Brain Consistency Auditor với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Brain Consistency Auditor

Audits a project's shared knowledge layer ("brain files": changelogs, version history, a master plan, and a file-per-fact memory store with a hand-maintained index) for internal consistency after edits.

Closes the brain-file consistency gap surfaced repeatedly on the reference setup — a patch-release entry body retained pre-amendment references; the memory dir dual-path drifted (one path missing entries the other had); a VERSION_HISTORY entry was missed and caught only by a later release-janitor pass; the MEMORY.md index didn't track newly-added rule files until a manual sync. The brain layer lives under the project root and is audited by the local orchestrator agent.

When to Use

Activates whenever:

  1. Brain file edited — CHANGES_PENDING.md, VERSION_HISTORY.md, the project README for agents, the master PLAN file, memory/*.md, MEMORY.md modified in last N minutes (configurable; default 10 min)
  2. User explicitly invokes via /brain-audit (or the equivalent skill-invocation in your agent framework)
  3. User asks "audit brain files", "is the brain consistent", "check MEMORY.md vs disk"
  4. Post-ship trigger — fires automatically after a slice's brain-bookkeeping step completes (paired with a ship-verification cron job or hook; see [[shared-brain-bookkeeping]])

DO NOT activate for:

  • Brain files outside the project under audit (other projects' memory layers)
  • Single-line edits that obviously can't break consistency (e.g., typo fix)
  • Mid-edit state (only fire AFTER an edit session completes; race conditions otherwise)

Procedure

Step 1 — Inventory the Brain Layer

All paths are under the project root. Read the brain-file set + memory dir state:

bash
cd <project-root>
# Brain-file headers + sizes (some bookkeeping files may live only on another machine — list whatever is present)
ls -la AGENT_README.md PLAN.md CHANGES_PENDING.md VERSION_HISTORY.md memory/MEMORY.md 2>/dev/null

# Memory rule files at both on-disk paths
ls memory/*.md | wc -l
ls <secondary-memory-path>/*.md | wc -l

NOTE (reference setup): on the machine being audited, the project root had the agent README and both memory dirs, but CHANGES_PENDING.md, VERSION_HISTORY.md, and the master plan were NOT present (they were ship-bookkeeping files kept on a different machine). Every check below SKIPs (reports N/A — file absent) rather than FAILs when its target file is missing, so the auditor degrades gracefully. If/when those files appear, the checks light up automatically.

Step 2 — Run Six Consistency Checks

Check 1 — VERSION_HISTORY.md monotonicity. (Skip with N/A if VERSION_HISTORY.md is absent.) Extract all ### v<X> headings; verify they're in strictly descending order; verify no version-numbers are skipped (e.g., -10 to -8 would skip -9). On the reference setup, a historical backfill stub closes one known gap; future gaps surface as WARN.

bash
grep -nE "^### v[0-9]" VERSION_HISTORY.md | head -20

Compare adjacent entries; flag any non-monotonic-descending sequence + any skipped version segment.

Check 2 — CHANGES_PENDING.md top entry body internal consistency. (Skip with N/A if CHANGES_PENDING.md is absent.) For the TOP entry only (most recent ship breadcrumb), scan for stale references — pre-change terms appearing inside a post-change entry. Specifically look for:

  • Old asset/component names inside entries about the newer versions that replaced them
  • TENTATIVE flags inside entries with "Zero TENTATIVE remain" summary lines
  • Pre-bump VERSION strings in post-bump entries
  • Old function names in slices that renamed them

Flag each finding with line number + suggested correction.

Check 3 — MEMORY.md index vs disk parity. For each feedback_*.md / project_*.md / reference_*.md file in BOTH memory paths, confirm a corresponding entry in MEMORY.md exists with matching slug. Flag orphans (file exists, no index entry) AND broken entries (index points to non-existent file).

bash
ls memory/feedback_*.md | xargs -I {} basename {} .md
# Compare against MEMORY.md entry slugs

Check 4 — Memory dual-path parity (canonical vs secondary memory path). On the reference setup the memory layer exists at two on-disk paths under the project root: the canonical memory/ and a secondary path. (This replaced an earlier dual-write arrangement split across two machines/sync folders.) For each file that exists at BOTH paths, confirm the content matches; flag drift. CAVEAT: the two paths were NOT a strict byte-identical mirror on the reference setup (one held roughly twice as many files as the other, and the two used different slug conventions — underscored vs hyphenated). So treat "present at one path only" as INFORMATIONAL (Tier 3), not FAIL; treat genuine content drift on a same-named file as WARN. Confirm with the owner whether the secondary path is meant to be a full mirror or an intentional curated subset before flagging missing files as errors.

bash
cd <project-root>
for f in memory/*.md; do
  b=$(basename "$f")
  alt="<secondary-memory-path>/$b"
  if [ ! -f "$alt" ]; then echo "ONLY_IN_memory (info): $b"; continue; fi
  if ! diff -q "$f" "$alt" >/dev/null 2>&1; then echo "DRIFT: $b"; fi
done

Check 5 — PLAN section references inside CHANGES_PENDING/VERSION_HISTORY are valid. (Skip with N/A if the master plan file is absent.) For every Plan §<N.M> or §<N.M> reference inside CHANGES_PENDING.md + VERSION_HISTORY.md, confirm that section actually exists in the plan file.

bash
grep -oE "Plan §[0-9]+(\.[0-9]+)?|§[0-9]+(\.[0-9]+)?" CHANGES_PENDING.md VERSION_HISTORY.md | sort -u
# Cross-check each against grep -nE "^## §|^### §" PLAN.md

Check 6 — Cross-file sequence-number monotonicity. (Skip with N/A if CHANGES_PENDING.md is absent.) The reference project numbered its shipped work items ("One-hundred-and-thirteenth project slice" etc.). Verify the sequence numbers in CHANGES_PENDING.md descend monotonically + verify the top entry's number matches the last shipped number on record (cross-check against the latest ship breadcrumb the orchestrator has).

bash
grep -oE "[Oo]ne-hundred-and-[a-z\-]+ project slice|[a-z]+ project slice" CHANGES_PENDING.md | head -10

Step 3 — Output Consistency Report

Structured markdown:

markdown
## BRAIN CONSISTENCY REPORT — <timestamp>

### Check 1 — VERSION_HISTORY monotonicity: PASS / WARN / FAIL
[per-finding bullets]

### Check 2 — CHANGES_PENDING top entry body: PASS / WARN / FAIL
[per-finding bullets with line numbers]

### Check 3 — MEMORY.md index parity: PASS / WARN / FAIL
[orphans, broken entries listed]

### Check 4 — Memory dual-path parity (canonical vs secondary): PASS / WARN / INFO
[drift cases = WARN; present-at-one-path-only = INFO; see caveat in Check 4]

### Check 5 — PLAN section references: PASS / WARN / FAIL
[invalid references listed with citing file:line]

### Check 6 — Sequence-number monotonicity: PASS / WARN / FAIL
[non-monotonic sequences listed]

**Overall verdict:** N PASS / M WARN / K FAIL out of 6 checks.

**Auto-fixable (Tier 1):** [items the auditor can fix automatically with low risk — e.g., add missing MEMORY.md index entry for an orphan rule file]
**Owner-approval-needed (Tier 2):** [items requiring owner judgment — e.g., resolve a content drift between the canonical and secondary copies of a rule]
**Surface-only (Tier 3):** [items the auditor flags but doesn't propose fixes for — e.g., complex monotonicity decisions]

Step 4 — Auto-fix Tier 1 (Optional, Owner-configurable)

If auto_fix_tier_1 config enabled, auto-execute Tier 1 fixes:

  • Add missing MEMORY.md index entries (append at logical position)
  • ⛔ NOT auto-fixable: content drift between the canonical and secondary memory paths. An earlier version of this list allowed copying "toward whichever copy is newer" when the secondary path was confirmed to be a mirror. That contradicted the Tier 2 definition above, and it is unsafe on its own terms: confirming a path is a mirror establishes nothing about which copy is authoritative, and the newer file can easily be the wrong one. Recency is not authority. Surface it as Tier 2 and let the owner pick the winner.
  • Backfill obvious version-sequence stubs (only if the source-of-truth file is identifiable)

ALWAYS log auto-fixes to <project-root>/audits/brain_audit_autofixes_<date>.md for owner review.

Step 5 — Tier 2 + Tier 3 Surface

Tier 2 + Tier 3 findings get surfaced to the owner as a structured questionnaire (the orchestrator's ask-the-owner pattern) when invoked interactively, OR as a markdown report when invoked from cron.

Pitfalls

  1. Content-drift disposition: we follow Step 4 — Auto-fix Tier 1, which owns the rule for resolving drift between canonical and secondary memory paths.

  2. Don't flag intentional version skips. Some version segments are skipped legitimately (on the reference setup, one version was originally NOT supposed to have a VERSION_HISTORY entry per the project's version-suffix memory rule; it was backfilled as a stub later). Cross-reference against the suffix rule before flagging.

  3. Don't trigger during active brain-file edits. Race condition: if a brain file is mid-edit, the auditor might fire on an inconsistent intermediate state. Configure cooldown: wait 5 min after last brain-file mtime before firing.

  4. MEMORY.md is one-line per entry. Per the project's brain-file size-governance rule, entries should fit on one line ≤200 chars. Auto-fix shouldn't add multi-line entries.

  5. Don't change the dual-path arrangement without owner direction. Whether the secondary memory path is a full mirror or an intentional curated subset is an owner decision; don't unilaterally reconcile the two.

  6. Plan §X.Y references can be valid even if §X.Y not at literal line-start. Some plan sections are nested or appear in revision-history tables. Check by grepping the full plan file content, not just headers.

Verification

To test:

  1. Make a deliberate brain-file inconsistency (e.g., add an orphan <project-root>/memory/feedback_test_orphan.md without a MEMORY.md entry).
  2. Invoke this skill — interactively via your agent framework's skill invocation, or as a dispatch to a local agent.
  3. Verify the auditor flags the orphan in Check 3.
  4. If auto-fix enabled, verify MEMORY.md gains the entry; if disabled, verify Tier 1 surface only.
  5. Clean up: rm <project-root>/memory/feedback_test_orphan.md + remove the MEMORY.md entry.

Manual fallback (no agent framework): tools/brain_audit.py is not shipped in this repository. We perform Step 1's inventory and the six checks described in Step 2 manually, then write Step 3's report. For any fixes, we follow Step 4 — Auto-fix Tier 1 and Step 5's reporting procedure. The hook/cron integration mentioned above requires adopter setup; it is not supplied automation.

Related memory rules (reference setup)

  • The brain-file size-governance rule — sister rule on brain-file size ceilings + structural discipline
  • The memory-index-update-required rule — sister rule on MEMORY.md update requirement when adding rules
  • The orchestrator-executes-after-authorization discipline applies if auto-fix is enabled (the orchestrator executes the physical fix only after owner pre-authorization)
  • A historical rules batch added several critical rules at once; the auditor verifies batch-added rules are indexed at both memory paths

Config knobs

yaml
config:
  project_root:
    type: string
    default: "<project-root>"
  secondary_memory_path:
    type: string
    default: "<project-root>/memory-secondary"
    description: Secondary memory path checked for dual-path parity against the canonical memory/. May be a curated subset, not a full mirror (see Check 4).
  auto_fix_tier_1:
    type: bool
    default: false
    description: If true, we apply only the fixes authorized by Step 4 — Auto-fix Tier 1, following its logging requirement.
  brain_edit_cooldown_minutes:
    type: int
    default: 5
    description: Skip audit if any brain file modified within last N minutes (avoids race with active edits).
  strict_monotonicity:
    type: bool
    default: false
    description: If true, ANY version-sequence skip is FAIL (zero tolerance); if false, skip if accompanied by stub-entry pattern.

Câu hỏi thường gặp

Kỹ năng AI Brain Consistency Auditor làm được gì?

Use when a project's shared knowledge/brain files have been edited (CHANGES_PENDING.md, VERSION_HISTORY.md, the project README for agents, the master PLAN file, memory/*.md, MEMORY.md). Cross-references that the brain layer is internally consistent — CHANGES_PENDING headings vs PLAN sections, VERSION_HISTORY monotonicity, MEMORY.md index completeness vs disk files, and dual-path parity when memory lives at two on-disk locations. Flags stale references (e.g., a CHANGES_PENDING entry titled for one patch version while its body retains the previous version's references — a class of bug seen on...

Vì sao nên dùng Brain Consistency Auditor trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Brain Consistency Auditor là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Brain Consistency Auditor trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/sherifican/Agent-FleetOps/tree/main/skills/brain-consistency-auditor. TypingMind đọc tệp SKILL.md rồi cài đặt kỹ năng để bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Brain Consistency Auditor?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Brain Consistency Auditor với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Brain Consistency Auditor với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Brain Consistency Auditor có miễn phí không?

Có. Kỹ năng này được sherifican phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇