Skip to content

feat: layered memory loading #21

@GoDiao

Description

@GoDiao

Summary

Propose a layered memory system for MiniCode, inspired by Claude Code's CLAUDE.md hierarchy.

Claude Code's design

Claude Code loads CLAUDE.md files from multiple layers at startup:

  • ~/.claude/CLAUDE.md — user global preferences
  • ./CLAUDE.md or ./.claude/CLAUDE.md — project-level rules
  • Nested directories — walks upward from cwd collecting CLAUDE.md files
  • ./CLAUDE.local.md — personal project config, not committed to Git
  • ~/.claude/projects/<path>/memory/ — auto-generated project memory
  • @path include — CLAUDE.md can reference other files like @docs/architecture.md
  • .claude/rules/*.md — modular rule files

All memory is injected into the model's context. More specific rules naturally take priority over broader ones.

What I plan to implement

Phase 1 — the basics:

  • Read ~/.mini-code/CLAUDE.md (user global)
  • Read ./CLAUDE.md or ./.mini-code/CLAUDE.md (project root), also scan ./.claude/ for compatibility
  • Walk upward from cwd collecting CLAUDE.md files
  • Concatenate everything into the system prompt
  • Cap total content at ~50k chars

Phase 2 — follow-up PRs:

  • @path include resolution
  • CLAUDE.local.md
  • .mini-code/rules/*.md auto-discovery
  • Auto memory read/write
  • /memory command to inspect loaded files

Why

Session persistence (just merged) gives MiniCode cross-session continuity. Layered memory gives it cross-session context — project knowledge and preferences persist without re-explaining every time.

Does this scope look reasonable?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions