Skip to content

Commit 12af82a

Browse files
authored
Merge pull request #5 from ActiveMemory/feature/cleanup-2
cleanup before v0.2.0 release cut.
2 parents 59784a0 + 039f9ed commit 12af82a

133 files changed

Lines changed: 3951 additions & 1088 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.context/TASKS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
- [ ] Add integration tests for CLI commands (drift, sync, decision, learnings, serve, recall) - test actual file operations and command execution #added:2026-02-01-062541
2+
13
# Tasks — Context CLI
24

35
# Tasks

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.3
1+
0.2.0

docs/blog/2026-01-27-building-ctx-using-ctx.md

Lines changed: 54 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,17 @@ date: 2026-01-27
44
author: Jose Alekhinne
55
---
66

7-
*Jose Alekhinne / 2026-01-27*
7+
# Building ctx Using ctx
8+
9+
![ctx](../images/ctx-banner.png)
810

9-
# Building ctx Using ctx: A Meta-Experiment in AI-Assisted Development
11+
## A Meta-Experiment in AI-Assisted Development
1012

11-
> What happens when you build a tool designed to give AI memory, using that very
12-
same tool to remember what you are building?
13+
*Jose Alekhinne / 2026-01-27*
14+
15+
!!! question "Can a tool design itself?"
16+
What happens when you build a tool designed to give AI memory,
17+
using that very same tool to remember what you are building?
1318

1419
This is the story of `ctx`, how it evolved from a hasty "*YOLO mode*" experiment
1520
to a disciplined system for **persistent AI context**, and what I have
@@ -29,7 +34,7 @@ Every developer who works with AI code generators knows the frustration:
2934
you have a deep, productive session where the AI understands your codebase,
3035
your conventions, your decisions. And then you close the terminal.
3136

32-
Tomorrow it's a blank slate. The AI has forgotten everything.
37+
Tomorrow; it's a blank slate. The AI has forgotten everything.
3338

3439
That is "*reset amnesia*", and it's not just annoying: it's expensive.
3540

@@ -52,7 +57,10 @@ Markdown files for decisions, learnings, tasks, and conventions.
5257
The AI reads these at session start and writes to them before the session ends.
5358

5459
**The first commit** was just scaffolding. But within hours, the
55-
**Ralph Loop**—an iterative AI development workflow—had produced a working CLI:
60+
[**Ralph Loop**][ralph]—an iterative AI development workflow—had produced
61+
a working CLI:
62+
63+
[ralph]: https://ctx.ist/autonomous-loop/ "Autonomous Loop"
5664

5765
```
5866
feat(cli): implement amem init command
@@ -62,10 +70,14 @@ feat(cli): implement amem agent command
6270
...
6371
```
6472

65-
Fourteen core commands shipped in rapid succession.
73+
Not one, not two, but a whopping **fourteen** core commands shipped in rapid
74+
succession!
6675

6776
I was YOLO'ing like there was no tomorrow:
68-
auto-accept every change, let the AI run free, ship features fast.
77+
78+
* auto-accept every change,
79+
* let the AI run free,
80+
* ship features fast.
6981

7082
## The Meta-Experiment: Using `amem` to Build `amem`
7183

@@ -75,8 +87,8 @@ Here's where it gets interesting: On January 20th, I asked:
7587
7688
The answer was yes—but with a gap:
7789

78-
Auto-load worked (*via Claude Code's `PreToolUse` hook*), but auto-save was
79-
missing. If the user quit with Ctrl+C, everything since the last manual save
90+
Autoload worked (*via Claude Code's `PreToolUse` hook*), but auto-save was
91+
missing. If the user quit, with Ctrl+C, everything since the last manual save
8092
was lost.
8193

8294
That session became the first real test of the system.
@@ -95,10 +107,15 @@ development workflow. They're complementary but separate.
95107

96108
### 2. Two Tiers of Context Persistence
97109

98-
| Tier | What | Why | Where |
99-
|-----------|-----------------------------|-------------------------------|------------------------|
100-
| Curated | Learnings, decisions, tasks | Quick reload, token-efficient | .context/*.md |
101-
| Full dump | Entire conversation | Safety net, nothing lost | .context/sessions/*.md |
110+
| Tier | What | Why |
111+
|-----------|-----------------------------|-------------------------------|
112+
| Curated | Learnings, decisions, tasks | Quick reload, token-efficient |
113+
| Full dump | Entire conversation | Safety net, nothing lost |
114+
115+
| Where |
116+
|------------------------|
117+
| .context/*.md |
118+
| .context/sessions/*.md |
102119
```
103120

104121
This session file—written by the AI to preserve its own context—became the
@@ -161,7 +178,8 @@ Human-Guided Mode (Post-040ce99)
161178
- Canonical naming: Package name = folder name
162179
```
163180

164-
The fix required a human-guided refactoring session.
181+
The fix required a **human-guided refactoring session**. I continued to do
182+
that before every major release, from that point on.
165183

166184
We introduced `internal/config/config.go` with semantic prefixes:
167185

@@ -178,8 +196,7 @@ const (
178196
What I begrudgingly learned was:
179197
**YOLO mode is effective for velocity but accumulates debt**.
180198

181-
So I took a mental note to schedule **periodic consolidation sessions**
182-
from that point onward.
199+
So I took a mental note to schedule **periodic consolidation sessions**.
183200

184201
## The Dogfooding Test That Failed
185202

@@ -220,7 +237,7 @@ So I added:
220237
## The Constitution versus Conventions
221238

222239
As lessons accumulated, there was the temptation to add everything to
223-
`CONSTITUTION.md` as "inviolable rules".
240+
`CONSTITUTION.md` as "*inviolable rules*".
224241

225242
But I resisted.
226243

@@ -307,7 +324,7 @@ Each **session file** is a timestamped Markdown with:
307324
* Tasks for the next session
308325
* Technical context (*platform, versions*)
309326

310-
These files are **not auto-loaded** (*that would bust the token budget*).
327+
These files are **not autoloaded** (*that would bust the token budget*).
311328

312329
They are what I see as the "*archaeological record*" of `ctx`:
313330
When the AI needs deeper information about why something was done, it
@@ -347,7 +364,8 @@ and LEARNINGS.md.
347364
**Context**: Original implementation hardcoded absolute paths in hooks.
348365
This breaks when sharing configs with other developers.
349366

350-
**Decision**: Hooks use `ctx` from PATH. `ctx init` checks PATH before proceeding.
367+
**Decision**: Hooks use `ctx` from PATH. `ctx init` checks PATH before
368+
proceeding.
351369
```
352370

353371
**Generic core with Claude enhancements (2026-01-20)**
@@ -368,8 +386,10 @@ forgotten. Each has Context, Lesson, and Application sections:
368386
**CGO on ARM64**
369387

370388
```markdown
371-
**Context**: `go test` failed with `gcc: error: unrecognized command-line option '-m64'`
372-
**Lesson**: On ARM64 Linux, CGO causes cross-compilation issues. Always use `CGO_ENABLED=0`.
389+
**Context**: `go test` failed with
390+
`gcc: error: unrecognized command-line option '-m64'`
391+
**Lesson**: On ARM64 Linux, CGO causes cross-compilation issues.
392+
Always use `CGO_ENABLED=0`.
373393
```
374394

375395
**Claude Code skills format**
@@ -382,7 +402,8 @@ frontmatter (*description, argument-hint, allowed-tools*). Body is the prompt.
382402
**"Do you remember?" handling**
383403

384404
```markdown
385-
**Lesson**: In a `ctx`-enabled project, "*do you remember?*" has an obvious meaning:
405+
**Lesson**: In a `ctx`-enabled project, "*do you remember?*"
406+
has an obvious meaning:
386407
check the `.context/` files. Don't ask for clarification—just do it.
387408
```
388409

@@ -487,7 +508,16 @@ If you are reading this, chances are that you already have heard about `ctx`.
487508
[github.com/ActiveMemory/ctx](https://github.com/ActiveMemory/ctx),
488509
* and the documentation lives at [ctx.ist](https://ctx.ist).
489510

490-
If you're a mere mortal tired of reset amnesia, give `ctx` a try.
511+
!!! note "Session Records are a Gold Mine"
512+
By the time of this writing, I have **more than 70 megabytes** of
513+
**text-only** session capture, spread across >100 markdown and JSONL
514+
files.
515+
516+
I am analyzing, synthesizing, encriching them with AI, running RAG
517+
(*Retrieval-Augmented Generation*) models on them, and the outcome
518+
surprises me every day.
519+
520+
If you are a mere mortal tired of reset amnesia, give `ctx` a try.
491521

492522
And when you do, check `.context/sessions/` sometime.
493523

docs/blog/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Blog
33
icon: lucide/newspaper
44
---
55

6-
# Blog
6+
![ctx](../images/ctx-banner.png)
77

88
Stories, insights, and lessons learned from building and using ctx.
99

@@ -25,4 +25,4 @@ persistence, architectural decisions
2525

2626
---
2727

28-
*More posts coming soon.*
28+
*more posts are coming soon*

docs/cli-reference.md

Lines changed: 76 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,49 @@ ctx compact --no-auto-save
348348

349349
---
350350

351+
### `ctx completion`
352+
353+
Generate shell autocompletion scripts.
354+
355+
```bash
356+
ctx completion <shell>
357+
```
358+
359+
#### Subcommands
360+
361+
| Shell | Command |
362+
|--------------|--------------------------|
363+
| `bash` | `ctx completion bash` |
364+
| `zsh` | `ctx completion zsh` |
365+
| `fish` | `ctx completion fish` |
366+
| `powershell` | `ctx completion powershell` |
367+
368+
#### Installation
369+
370+
=== "Bash"
371+
372+
```bash
373+
# Add to ~/.bashrc
374+
source <(ctx completion bash)
375+
```
376+
377+
=== "Zsh"
378+
379+
```bash
380+
# Add to ~/.zshrc
381+
source <(ctx completion zsh)
382+
```
383+
384+
=== "Fish"
385+
386+
```bash
387+
ctx completion fish | source
388+
# Or save to completions directory
389+
ctx completion fish > ~/.config/fish/completions/ctx.fish
390+
```
391+
392+
---
393+
351394
### `ctx tasks`
352395

353396
Manage task archival and snapshots.
@@ -485,11 +528,12 @@ ctx recall list [flags]
485528

486529
**Flags**:
487530

488-
| Flag | Short | Description |
489-
|-------------------|-------|------------------------------------------|
490-
| `--limit` | `-n` | Maximum sessions to display (default: 20)|
491-
| `--project` | `-p` | Filter by project name |
492-
| `--tool` | `-t` | Filter by tool (e.g., `claude-code`) |
531+
| Flag | Short | Description |
532+
|------------------|-------|-------------------------------------------|
533+
| `--limit` | `-n` | Maximum sessions to display (default: 20) |
534+
| `--project` | `-p` | Filter by project name |
535+
| `--tool` | `-t` | Filter by tool (e.g., `claude-code`) |
536+
| `--all-projects` | | Include sessions from all projects |
493537

494538
Sessions are sorted by date (newest first) and display slug, project,
495539
start time, duration, turn count, and token usage.
@@ -513,10 +557,11 @@ ctx recall show [session-id] [flags]
513557

514558
**Flags**:
515559

516-
| Flag | Description |
517-
|------------|------------------------------------|
518-
| `--latest` | Show the most recent session |
519-
| `--full` | Show full message content |
560+
| Flag | Description |
561+
|------------------|------------------------------------|
562+
| `--latest` | Show the most recent session |
563+
| `--full` | Show full message content |
564+
| `--all-projects` | Search across all projects |
520565

521566
The session ID can be a full UUID, partial match, or session slug name.
522567

@@ -539,10 +584,11 @@ ctx recall export [session-id] [flags]
539584

540585
**Flags**:
541586

542-
| Flag | Description |
543-
|-----------|------------------------------------------|
544-
| `--all` | Export all sessions |
545-
| `--force` | Overwrite existing files |
587+
| Flag | Description |
588+
|------------------|------------------------------------------|
589+
| `--all` | Export all sessions |
590+
| `--force` | Overwrite existing files |
591+
| `--all-projects` | Export from all projects |
546592

547593
Exported files include session metadata, tool usage summary, and the full
548594
conversation. Existing files are skipped by default to preserve your edits.
@@ -578,16 +624,17 @@ ctx journal site [flags]
578624

579625
**Flags**:
580626

581-
| Flag | Short | Description |
582-
|------------|-------|------------------------------------------|
627+
| Flag | Short | Description |
628+
|------------|-------|---------------------------------------------------|
583629
| `--output` | `-o` | Output directory (default: .context/journal-site) |
584-
| `--build` | | Run zensical build after generating |
585-
| `--serve` | | Run zensical serve after generating |
630+
| `--build` | | Run zensical build after generating |
631+
| `--serve` | | Run zensical serve after generating |
586632

587-
Creates a zensical-compatible site structure with an index page listing
633+
Creates a `zensical`-compatible site structure with an index page listing
588634
all sessions by date, and individual pages for each journal entry.
589635

590-
Requires zensical to be installed for `--build` or `--serve`:
636+
Requires `zensical` to be installed for `--build` or `--serve`:
637+
591638
```bash
592639
pip install zensical
593640
```
@@ -605,15 +652,16 @@ ctx journal site --serve # Generate and serve locally
605652

606653
### `ctx serve`
607654

608-
Serve a static site locally via zensical.
655+
Serve a static site locally via `zensical`.
609656

610657
```bash
611658
ctx serve [directory]
612659
```
613660

614661
If no directory is specified, serves the journal site (`.context/journal-site`).
615662

616-
Requires zensical to be installed:
663+
Requires `zensical` to be installed:
664+
617665
```bash
618666
pip install zensical
619667
```
@@ -800,13 +848,13 @@ ctx loop [flags]
800848

801849
**Flags**:
802850

803-
| Flag | Short | Description | Default |
804-
|--------------------------|-------|-------------------------------------------------|--------------------|
805-
| `--tool <tool>` | `-t` | AI tool: `claude`, `aider`, or `generic` | `claude` |
806-
| `--prompt <file>` | `-p` | Prompt file to use | `PROMPT.md` |
807-
| `--max-iterations <n>` | `-n` | Maximum iterations (0 = unlimited) | `0` |
808-
| `--completion <signal>` | `-c` | Completion signal to detect | `SYSTEM_CONVERGED` |
809-
| `--output <file>` | `-o` | Output script filename | `loop.sh` |
851+
| Flag | Short | Description | Default |
852+
|--------------------------|-------|------------------------------------------|--------------------|
853+
| `--tool <tool>` | `-t` | AI tool: `claude`, `aider`, or `generic` | `claude` |
854+
| `--prompt <file>` | `-p` | Prompt file to use | `PROMPT.md` |
855+
| `--max-iterations <n>` | `-n` | Maximum iterations (0 = unlimited) | `0` |
856+
| `--completion <signal>` | `-c` | Completion signal to detect | `SYSTEM_CONVERGED` |
857+
| `--output <file>` | `-o` | Output script filename | `loop.sh` |
810858

811859
**Example**:
812860

0 commit comments

Comments
 (0)