agentleFS
TencentCloudTencentCloud/octop-memory/AGENTS.md

octop-memory

AGENTS.md139 starsChanged 2 months agoMITView on GitHub

Shared working agreement for coding agents. Start with the README, documentation index, and CONTRIBUTING. Engineering knowledge lives in docs/agent/; host setup lives in the integration guide. Follow the clarification, implementation, validation, and documentation loop below. This file governs repository contributions. Hosts own the memory instructions, workspace templates, and file-access policies used by their running agents. octop-memory is an independently usable and releasable memory library, called at runtime by Octop, octop-harness, and other hosts. Maintain it as a reusable memory foundation;…

  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.

    Of the AGENTS.md files we read, the 35,117 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repositoryOne other file it gives its agents.

The file

Show its rules and text

We split this AGENTS.md into the rules it gives an agent

22 rules. About 1 is common, 15 are distinctive, and 6 are very specific to this project.

  • ≈1

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈15

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    Do not confuse the two MemoryRuntime classes: this package's application.runtime.MemoryRuntime is host-neutral orchestration.

    line 43
  2. Distinctive:

    Use validation across repositories.

    line 54
  3. Distinctive:

    Check git status --short and relevant diffs first.

    line 63
  4. Distinctive:

    Update affected code, tests, configuration, and documentation together.

    line 65
  5. Distinctive:

    Use English PR titles by default unless the requester explicitly asks for another language.

    line 68
  6. Common:

    Use generic placeholders and temporary databases.

    line 69
  7. Distinctive:

    Keep the README and integration guide available in English and Chinese, with reciprocal language links.

    line 74
  8. Distinctive:

    If such maintenance changes runtime behavior or data contracts, document that code impact rather than a maintenance diary.

    line 83
  9. Very specific:

    Check recall sources/order, public APIs, configuration, prompts, and validation commands.

    line 88
  10. Distinctive:

    Clarify in text: use the existing Issue/PR or HANDOFF to describe actual/expected behavior and a minimal reproduction, or the user …

    line 91
  11. Distinctive:

    Keep stable ADR numbers and supersession relationships, check statuses against implementation, and avoid dated activity logs.

    line 112
  12. Very specific:

    Never mark success before candidates persist, or equate that commit with successful promotion/page/Episode stages.

    line 124
  13. Distinctive:

    Check lower-level extractor failure semantics separately.

    line 125
  14. Distinctive:

    Verify host configuration forwarding, hook scheduling, and actual execution separately.

    line 130
  15. Distinctive:

    Do not change public APIs, data formats, configuration defaults, or production dependencies without task authorization.

    line 132
  16. Very specific:

    Use a real dedicated PostgreSQL database through TEST_POSTGRES_DSN.

    line 143
  17. Very specific:

    Keep backend-specific SQL in storage/backends/.

    line 145
  18. Distinctive:

    Run focused tests before the full gate for code changes.

    line 167
  19. Very specific:

    Use tests/test_agent_docs.py and tests/test_architecture_boundaries.py for documentation checks.

    line 169
  20. Distinctive:

    When adding/moving files or changing headings, update navigation, local links, and heading anchors.

    line 170
  21. Distinctive:

    If the environment or an existing issue prevents validation, report failures/skips and reproduction commands without claiming success.

    line 173
  22. Distinctive:

    Before delivery, confirm acceptance and alignment with code.

    line 174

≈ “Common” is an estimate: at least 1 in 5 of the 45,344 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md

Shared working agreement for coding agents. Start with the README, documentation index, and CONTRIBUTING. Engineering knowledge lives in docs/agent/; host setup lives in the integration guide. Follow the clarification, implementation, validation, and documentation loop below. This file governs repository contributions. Hosts own the memory instructions, workspace templates, and file-access policies used by their running agents.

Project overview

octop-memory is an independently usable and releasable memory library, called at runtime by Octop, octop-harness, and other hosts. Maintain it as a reusable memory foundation; users need neither an Octop deployment nor adjacent repository checkouts. This repository owns evidence-capture rules, fact extraction, recall, storage, and migration. Upper layers own agent-turn wiring, execution scheduling, and product interfaces. The core uses the standard library and SQLite; PostgreSQL, vector indexes, and LLMs use optional backends/interfaces.

  • Public entry points: Memory (core.py) and MemoryService (service.py); shared orchestration is in application/.
  • Business pipelines live in pipeline/, persistence in storage/, and CLI/JSON-RPC adapters in adapters/.
  • plugins/<host>/ adapts external hosts, currently OpenClaw, Hermes, and the terminal client installer in plugins/harness. New adapters reuse shared business logic.
  • Find implementation and validation entry points in PROJECT_MAP and TEST_MATRIX. Package paths above are relative to src/octop_memory/.

Repository ownership and collaboration

Dependencies flow Octop → octop-harness → octop-memory; Octop's memory-management API also calls octop-memory directly. Production code here must not depend on the other two repositories. Identify the owner of a behavior before editing; a problem appearing in Octop's UI does not justify copying memory algorithms or agent-turn logic into Octop.

ChangePrimary repositoryCheck related consumers
Extraction results, promotion/conflict rules, recall sources/ranking, evidence, data contractsoctop-memoryCheck Harness consumers and Octop's management API when public interfaces/results change. Algorithm fixes with unchanged interfaces need no duplicate implementations upstream.
Capture/extraction timing, prompt injection/replay, memory-tool binding, background review/maintenance, instance lifecycleoctop-harnessReuse memory APIs; involve Octop for product switches, persisted settings, or status display.
Auxiliary-model selection, retries, timeouts, and configuration forwarding for Octop agentsoctop-harnessOctop owns configuration UI/storage/mapping; memory owns the generic LLM protocol and algorithm budgets. Fix host calls rather than hiding failures with prompt changes.
Session loading of USER.md/MEMORY.md, agent write protection, runtime memory instructionsoctop-harnessOctop owns user editing, owner permissions, and file saving; memory owns semantic reconciliation, conflict candidates, and recall suppression.
User memory settings, HTTP/CLI, permissions, memory/review UI, proactive-reminder product flowsOctopApply settings through Harness configuration/public memory APIs. Put new algorithms or generic turn behavior in the owning library.
Schema, SQL, namespaces, checkpoint encoding, migrations, generic space maintenanceoctop-memoryCheck Harness resource reuse/closure and Octop statistics, backup/restore, thread cleanup, and online-pause coordination.
OpenClaw/Hermes hooks, tool schemas, installation configurationThis repository's plugins/<host>/Reuse this repository's Runtime; external hosts need no changes to octop-harness or Octop.
Terminal client hooks for Claude Code, Codex, Cursor, Kiro, and DSHThis repository's plugins/harnessCall an Octop memory MCP with a user token. Parse transcripts locally and send memory_capture(events=...). DSH uses the native plugin.

Do not confuse the two MemoryRuntime classes: this package's application.runtime.MemoryRuntime is host-neutral orchestration; octop_harness.memory.runtime.MemoryRuntime adapts assembly and lifecycle to agents. See the repository integration map for files and call chains.

For work spanning repositories:

  1. State the primary repository, affected consumers, API/configuration/data compatibility, and acceptance criteria in the Issue/PR. Read the other repository's AGENTS before editing it.
  2. Trace real consumers when public fields, RPC results, configuration, or persistent formats change; library unit tests alone are insufficient. Audit Octop's existing direct table readers, but do not use those management paths as a template for new business logic that bypasses library APIs.
  3. Use validation across repositories. Record the versions/source revisions actually loaded. A green library suite, a green old installation, or skipped PostgreSQL/host cases cannot establish cross-repository acceptance.
  4. Link related PRs and state dependency order. To consume new interfaces, release the lower-level library first, then update Harness/Octop dependency declarations and lockfiles and verify the consumer loads the new version. Local source integration does not mean released users have the fix. UI-only work needs no unrelated library edits.

Working practices

  • Check git status --short and relevant diffs first; preserve existing user changes.
  • For nontrivial work, state the goal, files, expected behavior, minimal validation, and risks. Stage large work and keep scope focused.
  • Update affected code, tests, configuration, and documentation together. Avoid unrelated refactors and per-task document proliferation.
  • When adding, changing, or removing a memory setting, update the memory configuration reference in the same change. Record its key, default, units or allowed values, which entry points read it, and how to apply and verify it. Follow the value from the host to its consumer before documenting its effect.
  • Communicate in the requester's language; preserve code identifiers, CLI flags, environment variables, and error messages verbatim.
  • Use English PR titles by default unless the requester explicitly asks for another language.
  • Use generic placeholders and temporary databases. Never commit personal paths, runtime records, credentials, memory exports, or real databases.

Documentation language

Maintain AGENTS.md, CONTRIBUTING.md, and docs/agent/ in English as the engineering source of truth. Keep the README and integration guide available in English and Chinese, with reciprocal language links; keep their technical contracts, commands, and examples aligned. The documentation index is in English and links both user-facing languages.

Engineering documentation workflow

Scope: docs/agent/ records business logic, architecture, public APIs, data contracts, recall/write behavior, and related bugs, requirements, design tradeoffs, and unresolved risks. Routine banner, layout, wording, link, Python/dependency/lockfile, build/CI, and personal-tool maintenance belongs in the affected files and necessary README/CONTRIBUTING/CHANGELOG updates; do not create HANDOFF entries or ADRs for it. If such maintenance changes runtime behavior or data contracts, document that code impact rather than a maintenance diary. The following requirements apply according to actual impact, not file count or whether source files changed.

  1. Check in: inspect relevant code, diffs, and recent related commits against HANDOFF and PROJECT_MAP. Check recall sources/order, public APIs, configuration, prompts, and validation commands. Judge freshness from implementation, not dates or commit counts. Correct drift; record out-of-scope gaps in KNOWN_RISKS.
  2. Clarify in text: use the existing Issue/PR or HANDOFF to describe actual/expected behavior and a minimal reproduction, or the user scenario, scope, exclusions, and verifiable acceptance criteria. List assumptions and unresolved questions. Resolve questions affecting scope, compatibility, or data safety; continue already-authorized work without asking for the same permission again.
  3. Implement and validate: complete the smallest verifiable loop and run relevant tests and the full gate. Apply the mandatory recall/write and backend rules below when affected.
  4. Update knowledge: for nontrivial code work, update HANDOFF with current status, key files, actual validation, risks, and next steps. Update PROJECT_MAP for modules/call chains/runtime configuration; DECISIONS for important tradeoffs; TEST_MATRIX for validation changes; KNOWN_RISKS for code-related gaps; GLOSSARY for terms; and check README_AUDIT when public behavior changes.
  5. Sync GitHub Wiki: whenever docs/ changes issue descriptions, status, known risks, or development plans, update the corresponding pages in this repository's GitHub Wiki in the same work session. Keep affected English/Chinese pages aligned, cite the source Issue/PR/revision, and distinguish proposed, merged, and released behavior. Check the actual PR state before publishing; a validated PR is not a released fix. If Wiki access prevents synchronization, report the exact pending pages.

Each document owns its facts. HANDOFF keeps active work and unresolved items; move merged tasks out of active work, retaining only useful history links and follow-up boundaries. Put durable knowledge in the map, decisions, tests, or risks. Merged code is not evidence of fresh validation in the current environment. Keep stable ADR numbers and supersession relationships, check statuses against implementation, and avoid dated activity logs. Correct documentation drift in the relevant knowledge files without recording documentation cleanup as a new code task. Updating only HANDOFF while omitting affected maps or test guidance is incomplete.

Architecture constraints

  • Memory is the public storage API. Shared host operations in MemoryService/Bridge reuse application.MemoryRuntime. MemoryService.recall() calls the prompt pipeline directly; verify tool-search and prompt-recall configuration/sources separately.
  • pipeline/storage/domain must not depend on adapters; storage must not depend on pipeline; service must not depend on bridge.
  • New hosts use shared application logic. The source dashboard's direct SQLite access is an existing exception, not a new-adapter template.
  • AtomCard is the canonical fact; tree leaves reference atoms. Chroma/Qdrant are optional indexes, not relational backends.
  • Runtime incremental extraction commits candidates and the durable cursor in one transaction, then advances in-memory progress. Never mark success before candidates persist, or equate that commit with successful promotion/page/Episode stages. Check lower-level extractor failure semantics separately.
  • Automatic page regeneration passes and atomically checks the snapshot's mutation_version; failed guards must not fall back to unconditional writes. Preserve legacy public low-level page calls without version conditions; all page writers maintain revision semantics.
  • MemoryService.save() stores the fact and notifies a nonblocking scheduler. Hosts run synchronous review_new_memory() in the background. Current manual files govern reconciliation; the actual chat snapshot governs recall deduplication. Keep those inputs distinct.
  • Verify host configuration forwarding, hook scheduling, and actual execution separately. A configured model does not prove extraction ran; do not assume profiles have identical semantics across hosts.
  • Do not change public APIs, data formats, configuration defaults, or production dependencies without task authorization.

Detailed contracts are in PROJECT_MAP; host capabilities and limits are in the integration guide and KNOWN_RISKS.

SQLite and PostgreSQL gate

Both are supported production memory backends. Changes to public reads/writes, persistence orchestration, backend contracts, schema, SQL, transactions, FTS, or lifecycle must:

  1. Maintain both implementations and validate the same behavior assertions, preferably in tests/test_backend_parity.py.
  2. Use a real dedicated PostgreSQL database through TEST_POSTGRES_DSN; confirm relevant PG cases did not skip.
  3. Explicitly reject the other backend for deliberately backend-specific capabilities, documenting the reason in KNOWN_RISKS.
  4. Keep backend-specific SQL in storage/backends/. Existing capability gaps do not justify new silent divergence.

Sensitive recall and write paths

AreaExplain the effect on
core.py, storage/backends/Public writes, transactions, schema, indexes, namespaces
pipeline/extractor/, pipeline/promotion/, pipeline/episode/What becomes a Candidate, AtomCard, or Episode
pipeline/recall/, pipeline/page/Sources, ranking, raw policy, deduplication, budgets, page content
application/runtime.py, application/path_projection.py, application/host_files.pyTool search, readable paths, host files
adapters/bridge/handlers.py, host hooksHost capture/extraction and memory_search/memory_get behavior

Mark behavior changes with ⚠️ Recall/write path change, naming the affected sources/layers and validation commands. For documentation/build-list edits, state that behavior is unchanged; do not describe documentation cleanup as a runtime change.

Validation and delivery

make install-hooks    # Once per clone; never bypass a failed gate.
make all              # Format + lint + strict mypy + pytest.

Run focused tests before the full gate for code changes. Documentation-only work needs relevant documentation checks; the full gate still runs before a commit. Use tests/test_agent_docs.py and tests/test_architecture_boundaries.py for documentation checks. When adding/moving files or changing headings, update navigation, local links, and heading anchors; check public-document coverage, directory contracts, and the sdist allowlist. Find the first failure's cause, make the smallest in-scope fix, and rerun. If the environment or an existing issue prevents validation, report failures/skips and reproduction commands without claiming success. Before delivery, confirm acceptance and alignment with code. For work within the engineering-documentation scope, record actual validation and unresolved items in HANDOFF. Never label an unvalidated state as accepted. Summarize changes, validation, and remaining limits; no fixed multi-section handoff response is required.

Without explicit user authorization, do not push, rewrite Git history, delete large directories, deploy production, or change secrets. See TEST_MATRIX for backend/environment commands and CONTRIBUTING for branching and release checks (develop integration and the /publish skill).

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.