Skip to content

About

Six-layer persistent memory system for CodeBuddy AI assistant — zero dependencies, pure Python stdlib

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

CodeBuddy Memory System

A six-layer persistent memory system for CodeBuddy — keeps your AI assistant aware of who you are, what you're working on, and what you've decided, across all sessions.

License: MIT Python 3.9+ Zero Dependencies

Language: 中文文档


Why This Exists

CodeBuddy sessions are stateless — each conversation starts fresh. Without a memory system, your AI assistant forgets:

  • What projects you're working on
  • Technical decisions you've made
  • Your preferences and coding style
  • Progress across multiple sessions

This project solves that with a six-layer persistent memory architecture that automatically records, consolidates, and surfaces the right context at the right time.

Architecture

L1  SOUL.md            AI behavior principles (e.g. "be proactive, not passive")
L2  USER.md            Your profile — skills, goals, preferences
L3  CODEBUDDY.md       Global config — environment, projects, imports
L4  MEMORY.md          Permanent memory — auto-consolidated nightly
L5  daily-memories/    Temporary memory — per-day work logs
L6  update_memory      Fragment memory — CodeBuddy's built-in persistence

Consolidation Pipeline

Every night at 23:00, the system runs a 6-stage pipeline:

daily-memories/*.md
  → 1. Extract info (decisions, preferences, todos, progress)
  → 2. Deduplicate (Jaccard similarity ≥ 0.8)
  → 3. Filter trivia (tests, typos, formatting)
  → 4. Score by priority (keywords: architecture, design, security)
  → 5. Categorize by project
  → 6. Write MEMORY.md (capped at 200 lines)

Quick Start

Prerequisites

  • Python 3.9 or later (standard library only — zero external dependencies)
  • macOS (for launchd scheduling)
  • CodeBuddy IDE or CLI

Installation

# Clone the repository
git clone https://github.com/Kylinx-code/memory-system.git
cd memory-system

# Verify your environment
python3 scripts/memory_consolidator.py status

Deploy Automated Scheduling

# Install launchd jobs (daily consolidation + weekly review)
bash scripts/schedule_setup.sh install

# Verify they're running
bash scripts/schedule_setup.sh status

Usage

Automatic (No Action Needed)

The system runs automatically in the background:

  • Daily at 23:00 — consolidates temporary memories into MEMORY.md
  • Weekly Sunday 22:00 — reviews, archives, and cleans up

Manual Commands

Quick execution via run.sh (recommended):

# Manual daily consolidation (same as 23:00 auto-task)
bash scripts/run.sh consolidate

# Manual weekly review (same as Sunday 22:00 auto-task)
bash scripts/run.sh review

# Check system status
bash scripts/run.sh status

Direct Python invocation:

python3 scripts/memory_consolidator.py status
python3 scripts/memory_consolidator.py consolidate
python3 scripts/memory_consolidator.py archive
python3 scripts/memory_consolidator.py review

Project Structure

.
├── scripts/
│   ├── memory_consolidator.py   # Core engine (500+ lines, pure stdlib)
│   ├── run.sh                   # Convenient manual execution entry point
│   └── schedule_setup.sh        # launchd deployment for macOS
├── docs/
│   └── memory-system-guide.md   # Full user guide (Chinese)
├── .gitignore
├── LICENSE                      # MIT
├── CHANGELOG.md
├── CODEBUDDY.md                 # Project guide for CodeBuddy IDE
├── README.md                    # You are here
└── README.zh-CN.md              # Chinese version

Key Design Decisions

Decision Rationale
Zero external dependencies Maximize portability across environments
Python stdlib only No pip install needed; works out of the box
Jaccard 0.8 threshold Balances dedup precision vs recall for Chinese text
200-line MEMORY.md cap Respects CodeBuddy's autoMemory context window
7-day daily-memory retention Keeps transient data manageable; archive for history

Roadmap

  • Cross-platform scheduler support (Linux systemd, Windows Task Scheduler)
  • Memory search with semantic relevance ranking
  • CI pipeline for automated testing
  • Plugin architecture for custom extractors

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you'd like to change.

License

MIT © 2026 段晓航 (Kylinx-code)


Built for CodeBuddy, inspired by the six-layer memory architecture from the CSDN community.

About

Six-layer persistent memory system for CodeBuddy AI assistant — zero dependencies, pure Python stdlib

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages