Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

nanookclaw/ctx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

1,195 Commits

Repository files navigation

ctx

ctx (Context)

ctx is a system, not a prompt.

A lightweight, file-based system that enables AI coding assistants to persist, structure, and rehydrate project context across sessions.

ctx works with any AI tool that can read files; no model or vendor lock-in.

Full documentation: ctx.ist

The ctx Manifesto

Creation, not code. Context, not prompts. Verification, not vibes.

ctx is infrastructure for preserving intent under scale. Without durable context, intelligence resets. With ctx, creation compounds.

Read the full Manifesto | ctx.ist/manifesto

The Thesis

Context as State: A Persistence Layer for Human-AI Cognition

AI-assisted development systems assemble context at prompt time using heuristic retrieval from mutable sources. These approaches optimize relevance at the moment of generation but provide no mechanism for persistence, verification, or accumulated learning across sessions. ctx treats context as deterministic state.

Read the full Thesis

Core Documents

Document Context
Manifesto Philosophy: creation, context, verification
The Thesis Whitepaper: context as deterministic state
Design Invariants System properties that must always hold
Tool Comparison How ctx differs from .cursorrules, Aider, Copilot
ctx Blog Deep dives, architecture notes, learnings

The Problem

Most LLM-driven development fails not because models are weak: They fail because context is ephemeral. Every new session starts near zero:

  • You re-explain architecture
  • The AI repeats past mistakes
  • Decisions get rediscovered instead of remembered

The Solution

ctx treats context as infrastructure:

  • Persist: Tasks, decisions, learnings survive session boundaries
  • Reuse: Decisions don't get rediscovered; lessons stay learned
  • Align: Context structure mirrors how engineers actually think
  • Integrate: Works with any AI tool that can read files

Here's what that looks like in practice:

❯ "Do you remember?"
くろまる Yes. The PreToolUse hook runs ctx agent, and CLAUDE.md tells me to
 read the context files. I have context.
❯ "What have we been working on recently?"
くろまる Yes. I can run ctx journal source and review recent activity:
 - 2025年01月20日: The meta-experiment that started it all
 - 2025年01月21日: The ctx rename + Claude hooks session

That's the whole point: Temporal continuity across sessions.

Installation

Download pre-built binaries from the releases page, or build from source:

git clone https://github.com/ActiveMemory/ctx.git
cd ctx
CGO_ENABLED=0 go build -o ctx ./cmd/ctx
sudo mv ctx /usr/local/bin/

See installation docs for platform-specific instructions.

Quick Start

# Initialize context directory in your project
# (git is required: ctx refuses to operate without .git/.
# Run `git init` first if the project does not have a repo yet.)
ctx init
# Run subsequent commands from the project root. ctx always
# reads $PWD/.context/; there is no env-var or walk-up.
ctx status
# Get an AI-ready context packet
ctx agent --budget 4000
# Add tasks, decisions, learnings
ctx task add "Implement user authentication"
ctx decision add "Use PostgreSQL for primary database" \
 --context "Need a reliable database for production workloads" \
 --rationale "PostgreSQL offers ACID compliance, JSON support, and team familiarity" \
 --consequence "Team needs PostgreSQL training; must set up replication"
ctx learning add "Mock functions must be hoisted in Jest"

Knowledge-base workflow (Phase KB)

For knowledge-shaped work (research projects, vendor-spec analysis, post-incident reviews), ctx init also lays down an editorial pipeline distinct from the code-development surface above:

# Scaffold a folder-shaped topic page
ctx kb topic new "Cursor Hooks"
# Run an editorial ingest pass (in your AI assistant)
/ctx-kb-ingest ./inputs/2026-05-15-call.md "cursor hooks"
# Ask grounded questions, refuses to web-jump
/ctx-kb-ask "does the kb say hooks fire async?"
# Per-session handover; folds postdated closeouts automatically
ctx handover write "First session" \
 --summary "Drafted topic-page; minted EV-018..EV-024" \
 --next "Re-ingest the v1.1 release notes URL when available"

See the Build a Knowledge Base recipe for the full workflow, including the pass-mode contract, source-coverage state-machine ledger, and the closeout/fold mechanism.

ctx reads $PWD/.context/ — run commands from the project root (the directory that holds both .git/ and .context/). A small allowlist (init, version, help, system bootstrap, doctor, guide, why, config switch/status, hub *) runs without .context/ present; every other command exits with a next-step hint when it is missing.

Documentation

This README is a map, not the territory. The full documentation lives at ctx.ist and carries the recipes, runbooks, threat model, and design rationale that this file intentionally doesn't try to fit. If you're past install and wondering "how do I actually use this in a real session," the recipes are the right next stop.

Guide Description
Getting Started Installation, quick start, first steps
Recipes Practical workflow guides
CLI Reference All commands and options
Context Files File formats and structure
Integrations Claude Code, Cursor, Aider setup
Operations Runbooks, day-to-day, hub deployment
Security Trust model, audit trail, permissions

Contributing

Contributions welcome. See CONTRIBUTING.md for guidelines.

All commits must be signed off (git commit -s) to certify the DCO.

Community

Open source is better together.

Join the community to ask questions, share feedback, and connect with other users:

Join the ctx Discord

License

Apache 2.0

About

ctx: do you remember? — a single-binary, local-first, convergent memory system for humans and machines.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

Contributors

Languages

  • HTML 64.5%
  • Go 34.3%
  • TypeScript 0.6%
  • Shell 0.4%
  • Python 0.1%
  • Makefile 0.1%

AltStyle によって変換されたページ (->オリジナル) /