# Repository Briefing: okf-memory/okf-agent-memory
> Source: https://repoforai.com/repo/okf-memory/okf-agent-memory (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/okf-memory/okf-agent-memory
- **Official Docs / Website**: https://okf-memory.dev
- **Category**: Coding, Skills & MCP (AI 编程 / Skills / MCP)
- **Primary Language**: Go
- **License**: MIT
- **Engineering Health**: A+ (90/100 · Maintenance 35/35 · Adoption 15/25 · Releases 20/20 · License 20/20)
- **Latest Release**: v0.9.1 (2026-11-29) — https://github.com/okf-memory/okf-agent-memory/releases
- **Review Snapshot**: 2026-12-03
- **Deployment / Stack Signals**: Self-Hosted, MCP, CLI
- **Momentum**: 882 ★ total (+2 24h / +9 7d) · 71 forks
- **Topics**: `agent-memory`, `ai-agents`, `bm25`, `coding-agents`, `developer-tools`, `git-native`, `go`, `golang`, `knowledge-base`, `knowledge-graph`, `llm-memory`, `markdown`
- **When to Use**: Best for: Teams using MCP-capable coding agents that want Git-reviewed decisions, runbooks, and file-specific constraints without loading all project knowledge into every session. Skip if: A short `AGENTS.md` already covers the project, or your primary need is semantic recall across a large or loosely structured corpus rather than curated Markdown records.

## Overview
```text
### Architecture & Core Mechanics
OKF Agent Memory splits persistent project context into two layers. At session start, `AGENTS.md` supplies standing rules and search-before-write triggers, with Agent Action Grammar as the compact notation. Facts, decisions, and runbooks live in a linked Open Knowledge Format bundle under `knowledge/`. An agent can query the in-memory BM25 index with `okf_search` and open a specific record with `okf_show`, rather than loading the entire bundle into context.

`cmd/okf` builds the CLI and embedded stdio MCP server into one executable. `go.mod` targets Go 1.26.0 and lists `golang.org/x/crypto` v0.59.0 directly and `golang.org/x/sys` v0.50.0 indirectly. Markdown with YAML frontmatter is the durable store; Git supplies a reviewable history, and local retrieval requires neither a database nor an inference runtime. The triggers guide the agent, but are not a runtime policy enforcement mechanism.

### Key Capabilities & Differentiators
Search and lookup resolve duplicate concept IDs in project > vendor > user > system order, with explicit identifiers available for nonproject scopes. All four scopes are active by default; an allowlist in `knowledge/index.md` limits both default discovery and explicit queries to permitted layers. `search --for-path` finds constraints and active holds tied to a source path, `validate --drift-git` detects referenced files that changed after governing concepts, and `changes --since 7d --json` supports handoffs and reviews.

Bundle validation covers conformance, graph connectivity, and description drift. The scorecard assigns 35% to maintenance, 35% to human stewardship, and 30% to graph integrity. JSON output supports automation, while `--min-score` can gate validation, vendor pulls, and restoration of locked bundles. Retrieval is lexical and model-independent. Gemma, Qwen, and Llama are examples for the separate benchmark suite through LM Studio or Ollama, not inference dependencies of the memory service.

### Trade-offs & Limitations
Compared with keeping all project knowledge in `AGENTS.md`, selective retrieval reduces always-loaded context but creates a new failure mode: the agent may not query memory when it should. Compared with embedding-backed RAG, BM25 avoids an embedding pipeline and a separate vector service, and is a good fit for exact identifiers and established project vocabulary. It is less suited to paraphrases with little term overlap. Evaluate representative queries and measure prompt savings end to end; an index lookup does not include MCP overhead, tool-call tokens, or model latency.

Git provides familiar diffs and code review, but teams still need to maintain frontmatter, review stale records, and decide who can change shared knowledge. Because user and system scopes are enabled by default, explicitly restrict scopes for client or public repositories where personal or machine-wide notes should not be visible. Treat vendor content as untrusted input: a passing quality score or write protection does not make retrieved instructions authoritative.

### Hardware & Deployment Guide
Build from source with `make build` using the Go 1.26.0 target in `go.mod`; the executable is written to `bin/okf`. Use `okf init` for a bare bundle or `okf bootstrap` to scaffold the bundle, agent skill, `AGENTS.md`, and Makefile. Run `./bin/okf mcp knowledge` from the project or configure the client with absolute executable and bundle paths. Local operation needs no separate database, container, or GPU; budget CPU and RAM against the size of the enabled corpus rather than model parameters.

Registry and Git pulls, vendor restoration, and encrypted Hub sync are optional paths, not prerequisites for local retrieval. v0.8.0 introduced scope isolation and concurrent-write safeguards. v0.9.0 added OKF v0.3 conformance with v0.2 fallbacks, programmatic write protection, change history, and Git freshness checks. v0.9.1 fixes CommonMark angle-bracket link destinations and out-of-bundle path classification. For upgrades from v0.9.0, revalidate bundles that use either link form.
```

## Key Capabilities
```text
- Progressive disclosure: A compact `AGENTS.md` keeps standing rules separate from linked Markdown/YAML knowledge retrieved on demand.
- MCP transport: `okf mcp <bundle>` serves tools over stdio from the same Go binary as the CLI.
- Scope resolution: Project > vendor > user > system for duplicate IDs; an explicit `scopes` allowlist rejects queries to disabled layers.
- Code-aware lookup: `search --for-path` surfaces file-specific constraints, while `validate --drift-git` flags referenced files changed after their governing concepts.
- CI governance: `validate --scorecard --json` reports maintenance, human stewardship, and graph integrity; `--min-score` enforces a threshold.
- Format evolution: v0.9.0 adds OKF v0.3 support with v0.2 fallbacks; v0.9.1 fixes angle-bracket destinations and external path classification.
```

## Quick Start / Clone
```bash
make build
```
