grapeot/context-infrastructure
A context and memory system for AI coding agents. Persistent memory, personal rules, skills, and scheduled observations
What it is
Context Infrastructure is a reference implementation of a year‑long “context” system for an AI assistant. It shows how to organise data, let the model remember past interactions, and personalise its behaviour. The repo is not a ready‑to‑run product; it is meant to be cloned, examined, and adapted as a blueprint for your own AI‑driven workflow.
Core ideas
| Layer | What it contains | How you use it |
|---|---|---|
| Presentation layer (read‑only) | rules/axioms/ (43 distilled decision axioms) and rules/skills/ (39 skill markdowns) – examples of the author’s accumulated knowledge. |
Look at the structure and wording to inspire your own rules; do not copy them verbatim as they are personal to the author. |
| Reusable layer (editable) | Templates: rules/SOUL.md (AI identity), rules/USER.md (your preferences), rules/COMMUNICATION.md (style guide). Small scripts in periodic_jobs/ai_heartbeat/ that implement a three‑level memory system. |
Fill the templates with your own data, configure the scripts, and run them (usually via cron) to give the assistant a personalized context. |
| Non‑reusable layer | The concrete content of the axioms and the experience behind each skill. | Use them as a model for how to capture and organise your own observations and reflections. |
Quick start (≈5 min)
git clone https://github.com/grapeot/context-infrastructure
cd context-infrastructure
# Open the folder in Claude Code / OpenCode / Cursor (any IDE you like)
- Open
rules/USER.mdand fill in your basic information – this is the step that immediately personalises the AI. - Follow the detailed steps in
setup_guide.mdto finish configuration (environment variables, cron jobs, etc.). - If you want to add extra capabilities, consult
docs/SKILL_ECOSYSTEM.md, which lists optional public‑skill repos (web search, Google Docs, maps, email, etc.).
Repository layout (high‑level)
- Root files – routing table (
AGENTS.md), setup guide,.env.example. docs/– cron‑job guide and a catalogue of optional skill repos.rules/– templates (SOUL.md,USER.md,COMMUNICATION.md), a workspace index, 43 decision axioms, and 39 skill markdowns.contexts/– where the system stores its memory:memory/OBSERVATIONS.md– the three‑level L1/L2 memory store.daily_records/,survey_sessions/,thought_review/– folders for raw logs, reports, and reflection notes.
periodic_jobs/ai_heartbeat/– code that runs daily (observer.py) and weekly (reflector.py) to update the memory store; includes design docs.tools/– a report‑sharing helper (Tier 2).adhoc_jobs/– place for one‑off tasks you might add.
How it works (conceptually)
- Data collection – you (or other scripts) write observations into
contexts/memory/OBSERVATIONS.mdand other daily logs. - Periodic jobs – a cron‑triggered
observer.pyingests new logs each day; a weeklyreflector.pyprocesses them into higher‑level summaries. - Rule files – the AI reads
rules/SOUL.md(its persona) andrules/USER.md(your preferences) at the start of each session, shaping its responses. - Skill plugins – optional public skill repos can be added to extend functionality (search, calendar, payments, etc.). The core repo stays lightweight; capabilities are added on demand.
Intended use case
- Individuals who want an AI assistant that remembers their past interactions, decisions, and personal preferences.
- Developers looking for a concrete example of how to structure a “memory‑augmented” AI system, including data flow, periodic processing, and rule‑based personalization.
- Anyone interested in the design of long‑term context management for LLM‑driven agents.
License
MIT – you can freely copy, modify, and redistribute the code, respecting the license terms.
Related
- Project
- Project
- Project
- Project
- Project