okf-memory-governor
Govern Git-native agent memory using OKF v0.2 protocols. Perform pre-edit governance scoping, sub-millisecond BM25 lexical search, atomic concept mutations, and trust-ordered schema validation. Do not use for unstructured web search, general file grep, or ad-hoc markdown editing.
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- okf-memory-governor
- version
- 1.0.0
- category
- memory_and_epistemics
- description
- Govern Git-native agent memory using OKF v0.2 protocols. Perform pre-edit governance scoping, sub-millisecond BM25 lexical search, atomic concept mutations, and trust-ordered schema validation. Do not use for unstructured web search, general file grep, or ad-hoc markdown editing.
02 资源文件 3
- 参考文档CARD.md4.4 KB
- 参考文档config.default.yaml688 B
- 脚本scripts/okf_engine.py8.8 KB
03 SKILL.md 正文
OKF Memory Governor — Agent Skill
This skill enforces the Open Knowledge Framework (OKF v0.2) protocol across repository memory bundles, providing pre-edit governance scoping, BM25 lexical ranking, atomic mutations, and normative validation.
Architectural Pillars
- The Visual Brief — Generate dark-mode HTML briefs in
%TEMP%for multi-concept topology and governance reviews. - The Mandatory Checkpoint — Require explicit user review (
RequestFeedback: true) prior to any destructive concept deletion. - Explicit Anti-Patterns — Rigid behavioral boundaries eliminating unverified self-attestation and blanket directory scans.
See CARD.md for companion card and stage checklist.
1. Pre-Edit Governance Scope Check
Before proposing or executing any code modification in the workspace, query the knowledge bundle for concepts that explicitly govern the target path.
python .agents/skills/okf-memory-governor/scripts/okf_engine.py scope --target "src/api/auth.py"
Evaluate any attached governance constraints. If a governing concept establishes negative boundaries or architectural invariants, incorporate them into the step plan before proceeding.
Completion criterion: Target code paths checked against bundle
code_refsand all active governance constraints extracted.
2. Search-First Lexical Retrieval
When querying repository knowledge, use sub-millisecond BM25 lexical search with progressive disclosure (default limit=3).
python .agents/skills/okf-memory-governor/scripts/okf_engine.py search "jwt token expiration revocation" --limit 3
Never perform blanket directory scans (list_dir) or full-text greps on the knowledge/ directory. Evaluate the 1-2 sentence descriptions of the top 3 candidates before loading full bodies.
Completion criterion: Relevant concepts identified by BM25 scoring without scanning the entire knowledge directory.
3. Atomic Mutation & Frontmatter Sanitization
When creating or modifying concepts, sanitize scalar fields (no unescaped newlines), preserve provenance, and automatically sync parent indexes and audit logs.
python .agents/skills/okf-memory-governor/scripts/okf_engine.py create \
--id "auth-jwt-revocation" \
--title "JWT Token Revocation Strategy" \
--type "architecture" \
--description "Implements Redis-backed token denylist for instant session invalidation." \
--governance "Never store raw JWT in denylist; use jti claim hash" \
--code-refs "src/api/auth.py,src/core/security.py"
Agents must never self-attest as human actors in verified.by. All automated additions must record generated.by: "agent:brain-harness".
Completion criterion: Concept file written within root boundary, scalar frontmatter sanitized,
index.mdtable updated, andlog.mdentry appended.
4. Relation Graph Linking
Maintain explicit semantic relationships between concepts in YAML frontmatter rather than relying on unstructured prose links.
python .agents/skills/okf-memory-governor/scripts/okf_engine.py relate \
--source "auth-jwt-revocation" \
--target "redis-connection-pool" \
--description "Denylist checks execute against shared Redis pool"
All relationship targets must resolve to existing concept identifiers within the bundle.
Completion criterion: Bidirectional relations updated in both concepts with zero dangling targets.
5. Normative Validation & Ledger Audit
Execute bundle validation before concluding any cognitive distillation or memory mutation session.
python .agents/skills/okf-memory-governor/scripts/okf_engine.py validate --strict
Verify that all concepts possess mandatory fields (id, title, type, description), valid concept types, unbroken relation links, and satisfy actor trust ordering invariants.
Completion criterion: Bundle validation passes with 0 critical errors and 0 unhandled hygiene warnings.
Anti-Patterns
- Blanket Directory Scans — Running
list_dirorgrepacross the entireknowledge/folder, wasting context tokens and degrading search accuracy. - Actor Trust Escalation — Marking automated agent-generated concepts as verified by human authorities without human review.
- Dangling Relation References — Linking to non-existent concept IDs in frontmatter
relations, fracturing the knowledge graph. - Unsanitized Frontmatter Newlines — Injecting multiline strings into scalar YAML fields (
title,id,type), corrupting the bundle parser. - Manual Bookkeeping Edits — Directly editing
index.mdorlog.mdinstead of allowing the mutation engine to maintain atomic synchronization.
04 同仓库更多 Skills
ui-behavior-primitive-architect
Architect, audit, and verify zero-dependency headless UI behavior primitives, WebMCP agent bridges, WAI-ARIA/SSR/RTL tri-modal checks, and framework expert routing. Do not use for static CSS theme styling or backend database migrations.
trustgraph-ontology-governor
Govern knowledge graphs, SHACL-AF triple policies, OntologyRAG subclass validation, PROV-O dual named graphs, and Laya entropy decision scoring. Do not use for relational SQL queries or generic web scraping.
shim-harness-governor
Govern universal CLI agent loops, 4-tier tool permissions, ancestor-symlink workspace sandboxes, deterministic-first command routing, collision-safe MCP namespacing, and layered skill loading. Do not use for static UI styling or external SQL analytics.
graphiti-zep-memory-governor
Govern bi-temporal knowledge graphs with Graphiti future-edge clamping, MinHash/LSH entity dedup, RRF/MMR reranking, and Zep typed ontologies. Do not use for static SQL joins or generic web crawling.
agora-mcp-workbench-architect
Architect, audit, and orchestrate Agora Workbench MCP servers, loopback sidecars, unified state graphs, gateway/dispatcher connectors, and policy-enforced data lakes. Do not use for static frontend CSS styling or non-MCP desktop GUI automation.
skill-eval-assurance-runner
Evaluate and assure agent skills using small-N Wilson confidence intervals, unbiased pass^k reliability, deterministic trajectory graders, preflight boundary honesty, and sealed digest verification. Do not use for subjective prose review or unconstrained production deployment.