You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rename recall export to import, add CLI command groups
Rename `ctx recall export` to `ctx recall import` across the entire
codebase. From ctx's perspective, pulling Claude Code sessions into the
journal is an import, not an export. Rename touches source code, entity
types, config constants, YAML text, hook templates, tests, docs, recipes,
skills, specs, and context files.
Add Cobra command groups to organize `ctx --help` into labeled sections:
Getting Started, Context, Artifacts, Sessions, Runtime, Integration,
Diagnostics, and Utilities. Presentation-only change using Cobra's
AddGroup API -- zero command path or routing changes.
Add preamble box to root help output with ceremony instructions and
maintenance cadence. Hide site, serve, and system commands from help.
Update zero-silent-error-discard convention and add rename/refactor
documentation checklist to CONVENTIONS.md.
Signed-off-by: Jose Alekhinne <jose@ctx.ist>
Copy file name to clipboardExpand all lines: .context/CONVENTIONS.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -163,9 +163,11 @@ DO NOT UPDATE FOR:
163
163
164
164
- New CLI subcommand documentation checklist: When adding a new CLI subcommand, update docs in at least three places: (1) Feature page (e.g., docs/scratchpad.md) — commands table, usage section, skill/NL table. (2) CLI reference (docs/cli-reference.md) — full reference entry with args, flags, examples. (3) Relevant recipes — any recipe that covers the feature area. (4) zensical.toml — only if adding a new page.
165
165
166
+
- Rename/refactor documentation checklist: When renaming a command, flag, function, or concept, scope ALL documentation impact before implementation. The project has three documentation anchors plus one tangential: (1) Docstrings in source code. (2) User-facing docs (`docs/`). (3) Recipes (`docs/recipes/`). (4) Blog posts and release notes — update command names but preserve historical prose. Also check: skills (`internal/assets/claude/skills/`), hook messages (`internal/assets/hooks/messages/`), YAML text files (`internal/assets/`), `.context/` files, and specs (`specs/`).
167
+
166
168
- Always stage site/ when committing docs/ changes — the generated HTML is tracked in git with no CI build step.
167
169
168
-
- Zero //nolint:errcheck policy — handle errors, don't suppress them. In test code: use t.Fatal(err) for setup errors, _ = os.Chdir(orig) for cleanup. In production code: use defer func() { _ = f.Close() }() for best-effort close. For gosec false positives: prefer config-level exclusions in .golangci.yml.
170
+
- Zero silent error discard policy — handle every error, never suppress with `_ =` or `//nolint:errcheck`. In test code: use `t.Fatal(err)` for setup errors, use `t.Log(err)` for cleanup errors (not `_ =`). In production code: defer-close must log failures to stderr (`if err := f.Close(); err != nil { fmt.Fprintf(os.Stderr, "ctx: close %s: %v\n", path, err) }`), never `_ = f.Close()`. For write/read errors: return the error or log to stderr. For os.Remove/Rename: log to stderr at minimum. For gosec false positives: fix the code to satisfy the linter rather than adding nolint markers or config-level exclusions — the goal is zero golangci-lint suppressions. See TASKS.md EH.0–EH.5 for the full error handling cleanup plan.
169
171
170
172
- Error constructors belong in internal/err, never in per-package err.go files — eliminates the broken-window pattern where agents add local errors when they see a local err.go exists.
**Context**: The session/recall/journal system had three overlapping storage layers: `~/.claude/projects/` (raw JSONL transcripts, owned by Claude Code), `.context/sessions/` (JSONL copies + context snapshots), and `.context/journal/` (enriched markdown from `ctx recall export`). The recall pipeline reads directly from `~/.claude/projects/`, making `.context/sessions/` a dead-end write sink that nothing reads from. The auto-save hook copied transcripts to a directory nobody consumed. The `ctx session save` command created context snapshots that git already provides through version history. This was ~15 Go source files, a shell hook, ~20 config constants, and 30+ doc references supporting infrastructure with no consumers.
974
+
**Context**: The session/recall/journal system had three overlapping storage layers: `~/.claude/projects/` (raw JSONL transcripts, owned by Claude Code), `.context/sessions/` (JSONL copies + context snapshots), and `.context/journal/` (enriched markdown from `ctx recall import`). The recall pipeline reads directly from `~/.claude/projects/`, making `.context/sessions/` a dead-end write sink that nothing reads from. The auto-save hook copied transcripts to a directory nobody consumed. The `ctx session save` command created context snapshots that git already provides through version history. This was ~15 Go source files, a shell hook, ~20 config constants, and 30+ doc references supporting infrastructure with no consumers.
975
975
976
976
**Decision**: Remove `.context/sessions/` entirely. Two stores remain: raw transcripts (global, tool-owned in `~/.claude/projects/`) and enriched journal (project-local in `.context/journal/`).
@@ -851,14 +851,14 @@ Consult specific sections when working on a module.
851
851
|`check-context-size`| UserPromptSubmit | (all) | Adaptive counter: silent 1–15, every 5th 16–30, every 3rd 30+. Per-session counter in temp file | Per-session |
852
852
|`check-persistence`| UserPromptSubmit | (all) | Track .context/ mtime; silent 1–10, nudge at #20 if no modifications, then every 15 prompts since last mod | Per-session |
853
853
|`check-ceremonies`| UserPromptSubmit | (all) | Scan last 3 journal entries for "ctx-remember" and "ctx-wrap-up" strings; nudge missing ceremonies | Daily |
Copy file name to clipboardExpand all lines: .context/GLOSSARY.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,7 @@ DO NOT UPDATE FOR:
28
28
| Read order | The priority sequence in which context files are loaded and presented to agents. Defined by `config.FileReadOrder`. Higher priority files are loaded first and survive token budget cuts. |
29
29
| Token budget | Maximum estimated token count for assembled context. Default 8000. Configurable via `CTX_TOKEN_BUDGET`, `.ctxrc`, or `--budget` flag. Uses 4-chars-per-token heuristic. |
30
30
| Curated tier | The `.context/*.md` files: manually maintained, token-budgeted, loaded by `ctx agent`. Contrast with full-dump tier. |
31
-
| Full-dump tier | The `.context/journal/` directory: exported session transcripts. Not auto-loaded; used for archaeology when curated context is insufficient. Browse with `ctx recall`. |
31
+
| Full-dump tier | The `.context/journal/` directory: imported session transcripts. Not auto-loaded; used for archaeology when curated context is insufficient. Browse with `ctx recall`. |
32
32
| Compaction | The process of archiving completed tasks and cleaning up context files. Run via `ctx compact`. Moves completed tasks to archive; preserves phase structure. |
33
33
| Entry header | The timestamped heading format used in DECISIONS.md and LEARNINGS.md: `## [YYYY-MM-DD-HHMMSS] Title`. Parsed by `config.RegExEntryHeader`. |
34
34
| Index table | The auto-generated markdown table at the top of DECISIONS.md and LEARNINGS.md (between `<!-- INDEX:START -->` and `<!-- INDEX:END -->` markers). Updated by `ctx add` and `ctx decision/learnings reindex`. |
Copy file name to clipboardExpand all lines: .context/archive/learnings-consolidated-2026-02-22.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -381,7 +381,7 @@ and an agentId field.
381
381
382
382
## [2026-02-03-063337] Claude Code JSONL format changed: slug field removed in v2.1.29+
383
383
384
-
**Context**: ctx recall export --all --force was skipping February 2026 sessions.
384
+
**Context**: ctx recall import --all --force was skipping February 2026 sessions.
385
385
Investigation revealed sessions like c9f12373 had 0 slug fields but 19
386
386
sessionId fields.
387
387
@@ -502,13 +502,13 @@ passes command args.
502
502
503
503
**Lesson**: Use `YYYY-MM-DD-HHMM-<topic>.md` format to prevent overwrites.
504
504
505
-
**Application**: Historical reference only. Journal entries now use `ctx recall export` naming.
505
+
**Application**: Historical reference only. Journal entries now use `ctx recall import` naming.
506
506
507
507
---
508
508
509
509
## [2026-01-20-120000] Two Tiers of Persistence
510
510
511
-
> **Note**: `.context/sessions/` removed in v0.4.0. Two tiers remain but the full-dump tier is now `~/.claude/projects/` (raw JSONL) + `.context/journal/` (enriched markdown via `ctx recall export`).
511
+
> **Note**: `.context/sessions/` removed in v0.4.0. Two tiers remain but the full-dump tier is now `~/.claude/projects/` (raw JSONL) + `.context/journal/` (enriched markdown via `ctx recall import`).
512
512
513
513
**Context**: User wanted to ensure nothing is lost when session ends.
514
514
@@ -533,7 +533,7 @@ passes command args.
533
533
-**Auto-load**: Works via `PreToolUse` hook running `ctx agent`
534
534
-**Auto-save**: Did NOT exist
535
535
536
-
**Original solution**: `SessionEnd` hook that copies transcript to `.context/sessions/`. Removed in v0.4.0 because Claude Code already retains transcripts and `ctx recall export` reads them directly.
536
+
**Original solution**: `SessionEnd` hook that copies transcript to `.context/sessions/`. Removed in v0.4.0 because Claude Code already retains transcripts and `ctx recall import` reads them directly.
0 commit comments