Documentation Policy

June 17, 2026 · View on GitHub

1. Core Philosophy

Documentation in Anchor Engine must be concise, accurate, and maintainable. We prioritize high-signal technical writing over verbose explanations.

Guiding Principles:

  • Single Source of Truth: Each topic should have one authoritative location
  • Minimal Root: The project root contains only essential files
  • Clear Separation: specs/ for technical specifications, docs/ for user-facing guides
  • Actionable Content: Documentation should drive implementation and testing

2. Document Locations

2.1 Root Directory (/)

ALLOWED Files (Only):

FilePurpose
README.mdProject overview, quickstart, API reference, architecture
CHANGELOG.mdVersion history and release notes
LICENSELicense file (AGPL-3.0)
CONTRIBUTING.mdContribution guidelines and development setup
CODE_OF_CONDUCT.mdContributor Covenant Code of Conduct
CITATION.cffCitation metadata (CFF format)
.github/GitHub community files (CODEOWNERS, PR template)
.gitignoreGit ignore patterns
package.jsonPackage configuration
user_settings.json.templateConfiguration template → generates $HOME/.anchor/user_settings.json (see Runtime Object Storage)
validate-json.mjsScript to build user_settings.json from template (runs on pnpm install + pnpm start)
pnpm-lock.yamlPNPM dependency lock file
pnpm-workspace.yamlPNPM monorepo workspace configuration
pnpm.cmdWindows PNPM launcher
pnpm.ps1PowerShell PNPM launcher
.dockerignoreDocker build exclusions
.npmignoreNPM publish exclusions
.npmrcNPM/PNPM runtime configuration
.gitattributesGit line-ending and diff configuration
.envEnvironment variables (gitignored, never committed)
.scratch.mdAgent-only exception - Session notes for AI agents during development (never committed to main)
user_settings.docker.jsonDocker-specific user settings template
verify-anchor-config.jsScript to verify anchor configuration
setup-user-config.mjsScript to setup user configuration on first run
verify-schema.mjsScript to verify database schema
vite.config.tsVite build configuration
vitest-root.config.tsVitest root configuration
playwright.config.tsPlaywright e2e test configuration
.eslintrc.cjsESLint code linting configuration
README_TESTING.mdQuick reference for running tests
DockerfileDocker build file for containerization
docker-compose.ymlDocker Compose orchestration file
scripts/start-engine.ps1PowerShell script to start engine
scripts/stop-engine.batBatch script to stop engine
scripts/start-engine-bg.mjsNode.js background startup (Standard 015)
scripts/stop-engine-bg.mjsNode.js background shutdown (Standard 015)
scripts/sync-version.mjsPost-version hook — syncs version across package.json files
scripts/run-engine.batWindows batch launcher for engine
scripts/start-engine.batWindows batch startup script
scripts/build.tsTypeScript build script
scripts/engine_server.pyPython engine server wrapper

PROHIBITED in Root:

  • Phase completion reports
  • Implementation summaries
  • Git operation logs
  • Temporary documentation files
  • Any other .md files not listed above
  • skills.md (not allowed)

Note: user_settings.json.template, validate-json.mjs, verify-anchor-config.js, and setup-user-config.mjs are essential for runtime configuration generation. They are documented in the README's Configuration Guide.

Note: .scratch.md is an agent-only exception - these session notes should never be committed to main branch and are meant for temporary AI agent development work. The file is .gitignored when not in agent sessions.

2.2 Specs Directory (/specs/)

Core Files:

FilePurpose
spec.mdMain technical specification with architecture diagrams, web dashboard, engine core modules
plan.mdDevelopment roadmap and phased implementation
tasks.mdCurrent implementation tasks and priorities
doc_policy.mdThis documentation policy
DATA-MODEL.mdData model: Compound → Molecule → Atom → Tag hierarchy

Subdirectories:

  • current-standards/ - 38 active architecture standards (flat directory, numbered 001–038). README.md is allowed here as a quick-reference index for the standards.
  • INTEGRATIONS/ - Integration specifications (MCP)

PROHIBITED in specs root:

  • Duplicate documentation already in README
  • Phase reports or implementation logs
  • Redundant standards documentation
  • Architecture decision records (merge into relevant standards instead)

2.3 Docs Directory (/docs/)

Core Files:

FilePurpose
INDEX.mdDocumentation index and navigation hub
whitepaper.mdSTAR Algorithm whitepaper — theoretical foundation
paper.mdAcademic paper (JOSS/TechArxiv submission)
settings-configs.mdConsolidated settings and configuration reference
code-patterns.mdCode patterns used throughout the codebase
design-patterns.mdDesign patterns and architectural decisions
star-algebra-reference.mdSTAR algebra reference and search algorithm details
benchmarks.mdPerformance benchmark documentation
process-pipeline-refactor.mdProcessing pipeline refactoring notes
streaming-ingestion-test-plan.mdStreaming ingestion test plan for local agents
DOC_AUDIT_REPORT.mdLatest documentation audit report (June 2026)

Subdirectories:

  • workflows/ - User workflow guides (in-use.md, ideas.md, llm-testing.md)
  • integrations/ - Integration guides (CODE_OF_CONDUCT.md, CONTRIBUTING.md)

PROHIBITED in docs root:

  • Temporary files
  • Unfinished drafts
  • Phase-specific reports

3. Documentation Standards

3.1 README.md Structure

# Anchor Engine

## Quick Start (5-minute setup)
## Core Features
## Architecture Overview
## API Reference (summary)
## Configuration Guide
## Performance Benchmarks
## Security Hardening
## Contributing
## License

3.2 CHANGELOG.md Format

  • Follow Keep a Changelog format
  • Semantic versioning (MAJOR.MINOR.PATCH)
  • Group changes by: Added, Changed, Deprecated, Removed, Fixed, Security
  • Include date and version number
  • Link to GitHub releases when applicable

3.3 Standards (specs/current-standards/)

  • Numbered format: XXX-title.md
  • Include: Purpose, Problem Statement, Solution, Implementation Details, Testing
  • Reference related standards
  • Include code examples where applicable

4. Prohibited Documentation Patterns

DO NOT CREATE in Root:

  • ❌ Phase completion reports (PHASE_1_COMPLETE.md, etc.)
  • ❌ Implementation update logs (BATCHING_UPDATE.md, etc.)
  • ❌ Git operation logs (GIT_PUSH_COMPLETE.md, etc.)
  • ❌ Consolidation summaries (DOCS_CONSOLIDATION_SUMMARY.md, etc.)
  • ❌ Standard implementation reports (STANDARD_109_IMPLEMENTATION.md, etc.)

Instead, update:

  • README.md with new features and architecture
  • CHANGELOG.md with version changes
  • specs/current-standards/ with architecture standards
  • specs/spec.md with architectural changes
  • docs/ with user-facing guides

5. Runtime Object Storage

⚠️ CRITICAL: All runtime objects are stored in $home/.anchor

This includes:

  • Logs: .anchor/logs/ (search logs, distillation logs, engine logs)
  • Database: .anchor/context_data/ (PGlite database)
  • Distillation outputs: .anchor/notebook/distills/ (YAML/JSON summaries)
  • Test outputs: .anchor/test-output/ (test result files)
  • Audit files: .anchor/logs/.<hash>-audit.json
  • Session data: .anchor/sessions/
  • Inbox files: .anchor/inbox/, .anchor/external-inbox/
  • Mirrored brain: .anchor/mirrored_brain/
  • User settings: .anchor/user_settings.json (runtime configuration - NEVER in project root)

Never assume files are in the project root or engine/ directory. Always check .anchor/ first for runtime data.


6. Maintenance Guidelines

6.1 Before Merging PR

  • Verify no prohibited .md files in root
  • Ensure all new features documented in README or CHANGELOG
  • Update relevant standards in specs/current-standards/
  • Remove temporary documentation files after integration
  • Verify user_settings.json is NOT in project root (should be in .anchor/user_settings.json)

6.2 Automated Checks (Future CI/CD)

  • Reject PRs with prohibited .md files in root
  • Verify CHANGELOG.md updated for version changes
  • Check README.md includes new features
  • Validate documentation links and cross-references

6.3 Content Ownership

DomainOwnerPrimary Location
ArchitectureArchitecture Teamspecs/spec.md, specs/current-standards/
User GuidesDocumentation Teamdocs/ (whitepaper, workflows, integrations)
API ReferenceDevelopment Teamspecs/spec.md, engine/src/routes/v1/
DeploymentDevOps TeamREADME.md (Quick Start), Dockerfile
TestingQA Teamengine/tests/, README_TESTING.md

7. Migration Path

7.1 Root-to-Docs Migration

Move root-level documentation to appropriate docs/ subdirectories:

Root FileTarget LocationStatus
FRICTIONLESS_SPEC.mddocs/guides/frictionless-spec.md
MCP_AGENT_SETUP.mddocs/integrations/mcp-agent.md
RECURSIVE_SEARCH_FALLBACKS.mddocs/technical/recursive-search.md
PAIN_POINTS_DOCUMENTATION.mddocs/guides/pain-points.md
CLAW-CODE-INTEGRation.mddocs/integrations/claw-integration.md

7.2 Specs Consolidation

Current State:

  • specs/ contains 5 core files: spec.md, plan.md, tasks.md, doc_policy.md, DATA-MODEL.md
  • specs/current-standards/ has 38 active standards in a flat directory (numbered 001–038)
  • Architecture diagrams merged into spec.md (removed standalone ARCHITECTURE.md)
  • Decision records merged into relevant standards (removed decisions/ directory)

Target State:

  • No additional .md files in specs/ root
  • All standards in flat current-standards/ directory, ordered foundational → assistive
  • Integration specs remain in INTEGRATIONS/

8. Rationale

Why this policy?

  1. Prevents Documentation Sprawl: Clear boundaries prevent uncontrolled growth
  2. Ensures Single Source of Truth: Each topic has one authoritative location
  3. Makes Finding Information Easier: Users know where to look for specific content
  4. Reduces Maintenance Burden: Clear ownership and structure
  5. Keeps Repository Clean and Professional: Root remains focused on essentials

What to do with implementation notes?

  1. Update relevant standard in specs/current-standards/ (if architectural)
  2. Add to CHANGELOG.md (if user-facing change)
  3. Add to README.md (if new feature or major update)
  4. Archive to docs/ (if detailed guidance needed)
  5. Delete temporary notes after integration

9. Version History

VersionDateChanges
2.62026-06-16
2.42026-06-14Added streaming ingestion architecture (streaming-file-chunker.ts), removed stale schema-migration.sql, added streaming/worker_threads/cron to user_settings template, fixed ghost Standard 110/111→024 references, enabled empty-seed full-corpus distillation, added docs/streaming-ingestion-test-plan.md, deleted root clutter (0, build_errors.txt)
2.42026-06-13Renumbered standards 001-038 (unique), removed dead root core/services, dropped packages/, updated docs/ inventory, synced all versions to 5.3.0
2.32026-06-10Flattened standards (38, no subdirectories), merged ARCHITECTURE.md into spec.md, removed archive-legacy and decisions references, updated docs/ section to match reality, added restored docs files, dropped PM2, switched to pnpm-only
2.22026-06-05Cleaned WASM/NAPI references, fixed duplicate sections, updated standards count
2.12026-05-25Updated version to 2.1
2.02026-04-09Restructured for clarity, consolidated specs and docs
1.02026-02-20Initial documentation policy

Last Updated: June 16, 2026 Version: 2.6 Status: ✅ Active