Skip to content

Commit ce9ef8a

Browse files
committed
feat: add journal system with recall export, site generation, and slash commands
Recall improvements: - Fix CanParse to check 50 lines (was 5) - finds 57 vs 22 sessions - Add smart project matching: git remote → path relative to home → exact CWD - Add --all-projects flag to list/show/export commands - Label tool results as "Tool Output" instead of "User" New commands: - ctx recall export: Export sessions to .context/journal/ as Markdown - ctx journal site: Generate zensical static site from journal entries - ctx serve: Convenience wrapper for zensical serve New slash commands: - /ctx-journal-enrich: Add frontmatter, topics, tags to journal entries - /ctx-journal-summarize: Generate period summaries (weekly, monthly, feature) - /ctx-blog: Generate blog post from recent activity - /ctx-blog-changelog: Generate blog post from commit range with theme Documentation: - Add slash commands reference to integrations.md - Update TASKS.md with completed items Signed-off-by: Jose Alekhinne <alekhinejose@gmail.com>
1 parent 84c5fe1 commit ce9ef8a

45 files changed

Lines changed: 1680 additions & 89 deletions

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: 40 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
### Phase 1: Parser (DONE)
1010

11-
1211
## Phase 1.a: Cleanup and Release
1312

1413
- [x] T1.2.0.1b Add index markers to DECISIONS.md and LEARNINGS.md templates
@@ -22,36 +21,29 @@
2221
- [x] T1.2.7 feat: implement `--no-color` global flag to disable colored output
2322
Documented in cli-reference.md as planned. Currently `NO_COLOR=1` env var works.
2423
#priority:low #added:2026-01-28
25-
- [ ] T1.2.9: upstream CI is broken (again)
26-
- [ ] T1.2.10: Human code review
27-
- [ ] T1.2.11: Human to read all user-facing documentation and update as needed.
28-
- [ ] T1.2.12: cut a release (version number is already bumped)
29-
30-
### Phase 2: Export & Search
31-
32-
- [ ] feat: `ctx recall export` - export sessions to editable journal files
24+
- [x] Write AST-based test that warns if CLI functions use fmt.Print* instead of
25+
cmd.Print* #added:2026-01-29-171351 #done:2026-01-31
26+
- [x] feat: `ctx recall export` - export sessions to editable journal files
3327
- `ctx recall export <session-id>` - export one session
3428
- `ctx recall export --all` - export all sessions
3529
- Skip existing files (user may have edited), `--force` to overwrite
3630
- Output to `.context/journal/YYYY-MM-DD-slug-shortid.md`
37-
#added:2026-01-28
38-
39-
- [ ] feat: `ctx recall search <query>` - CLI-based search across sessions
40-
- Simple text search, no server needed
41-
- IDE grep is alternative, this is convenience
42-
#priority:low
43-
44-
- [ ] explore: `ctx recall stats` - analytics/statistics
45-
- Token usage over time, tool patterns, session durations
46-
- Explore when we have a clear use case
47-
#priority:deferred
31+
#added:2026-01-28 #done:2026-01-31
32+
- [x] feat: ctx journal - LLM-powered session analysis and synthesis
33+
- [x] ctx journal site - generate zensical static site #done:2026-01-31
34+
- [x] ctx serve - convenience wrapper for zensical serve #done:2026-01-31
35+
- [x] /ctx-journal-enrich - slash command for frontmatter/tags #done:2026-01-31
36+
- [x] /ctx-journal-summarize - slash command for timeline summaries #done:2026-01-31
37+
- [ ] T1.2.9: upstream CI is broken (again)
38+
- [ ] T1.2.10: Human code review
39+
- [ ] T1.2.11: Human to read all user-facing documentation and update as needed.
40+
- [ ] T1.2.12: cut a release (version number is already bumped)
41+
- [ ] T1.2.13: Compose two blog posts: 1) what has changed after the human-guided
42+
refactoring, and what we can learn about this.
43+
2) what has happened since the last release cut.
4844

4945
## Backlog
5046

51-
- [ ] Write AST-based test that warns if CLI functions use fmt.Print* instead of cmd.Print* #added:2026-01-29-171351
52-
53-
- [ ] feat: ctx journal - LLM-powered session analysis and synthesis
54-
5547
Parent command for working with exported sessions (.context/journal/):
5648

5749
Subcommands to explore:
@@ -104,19 +96,10 @@ Additional supporting context:
10496
Depends on: ctx recall export (Phase 2)
10597
#priority:low #phase:future #added:2026-01-28-071638
10698

107-
- [ ] feat: /ctx-blog slash command - generate blog post draft from recent activity
108-
109-
Analyzes what happened since last blog post:
110-
- Sessions and their summaries
111-
- Commits and features added
112-
- Decisions made and rationale
113-
- Learnings discovered
114-
115-
Outputs narrative markdown draft for human editing.
116-
Could integrate with ctx journal or work directly from sessions/git history.
117-
118-
Related: ctx journal summarize (internal) vs ctx-blog (external/public)
119-
#priority:low #phase:future #added:2026-01-28-072625
99+
- [x] feat: /ctx-blog slash command - generate blog post draft from recent activity
100+
- [x] /ctx-blog - from recent activity (sessions, commits, decisions)
101+
- [x] /ctx-blog-changelog - from commit range with theme
102+
#added:2026-01-28-072625 #done:2026-01-31
120103

121104
- [ ] feat: ctx enrich - retroactively expand sparse context entries
122105

@@ -134,3 +117,23 @@ Could run as:
134117

135118
#priority:low #phase:future #added:2026-01-28-073058
136119

120+
- [ ] feat: make config constants configurable via .contextrc
121+
122+
Some hardcoded constants in internal/config/config.go could be user-configurable:
123+
- MaxDecisionsToSummarize (default 3)
124+
- MaxLearningsToSummarize (default 5)
125+
- MaxPreviewLen (default 60)
126+
- WatchAutoSaveInterval (default 5)
127+
128+
Follow the pattern established for token_budget and archive_after_days in internal/rc.
129+
#priority:low #phase:future #added:2026-01-31
130+
131+
- [ ] explore: `ctx recall stats` - analytics/statistics
132+
- Token usage over time, tool patterns, session durations
133+
- Explore when we have a clear use case
134+
#priority:deferred
135+
136+
- [ ] feat: `ctx recall search <query>` - CLI-based search across sessions
137+
- Simple text search, no server needed
138+
- IDE grep is alternative, this is convenience
139+
#priority:low

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,5 @@ dist/
4242

4343
# Session transcripts (personal, potentially large)
4444
.context/sessions/
45+
.context/journal/
46+
.context/journal-site/

docs/integrations.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,62 @@ ctx agent --budget 4000
126126
cat .context/TASKS.md
127127
```
128128

129+
### Slash Commands
130+
131+
`ctx init` installs slash commands to `.claude/commands/`. These are shortcuts
132+
you can invoke in Claude Code with `/command-name`.
133+
134+
#### Context Commands
135+
136+
| Command | Description |
137+
|---------|-------------|
138+
| `/ctx-status` | Show context summary (tasks, decisions, learnings) |
139+
| `/ctx-agent` | Get AI-optimized context packet |
140+
| `/ctx-save` | Save current session to `.context/sessions/` |
141+
| `/ctx-reflect` | Review session and suggest what to persist |
142+
143+
#### Adding Context
144+
145+
| Command | Description |
146+
|---------|-------------|
147+
| `/ctx-add-task` | Add a task to TASKS.md |
148+
| `/ctx-add-learning` | Add a learning to LEARNINGS.md |
149+
| `/ctx-add-decision` | Add a decision with context/rationale/consequences |
150+
| `/ctx-archive` | Archive completed tasks |
151+
152+
#### Session History
153+
154+
| Command | Description |
155+
|---------|-------------|
156+
| `/ctx-recall` | Browse AI session history |
157+
| `/ctx-journal-enrich` | Enrich a journal entry with frontmatter/tags |
158+
| `/ctx-journal-summarize` | Generate summary of sessions over a time period |
159+
160+
#### Blogging
161+
162+
| Command | Description |
163+
|---------|-------------|
164+
| `/ctx-blog` | Generate blog post from recent activity |
165+
| `/ctx-blog-changelog` | Generate blog post from commit range with theme |
166+
167+
#### Development
168+
169+
| Command | Description |
170+
|---------|-------------|
171+
| `/ctx-loop` | Generate a Ralph Loop iteration script |
172+
| `/ctx-prompt-audit` | Analyze session logs for vague prompts |
173+
174+
#### Usage Examples
175+
176+
```text
177+
/ctx-status
178+
/ctx-add-learning "Token refresh requires explicit cache invalidation"
179+
/ctx-journal-enrich twinkly-stirring-kettle
180+
/ctx-journal-summarize last week
181+
```
182+
183+
Slash commands support partial matching where applicable (e.g., session slugs).
184+
129185
---
130186

131187
## Cursor IDE

internal/bootstrap/bootstrap.go

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,22 @@ import (
2323
"github.com/ActiveMemory/ctx/internal/cli/agent"
2424
"github.com/ActiveMemory/ctx/internal/cli/compact"
2525
"github.com/ActiveMemory/ctx/internal/cli/complete"
26-
"github.com/ActiveMemory/ctx/internal/cli/decisions"
26+
"github.com/ActiveMemory/ctx/internal/cli/decision"
2727
"github.com/ActiveMemory/ctx/internal/cli/drift"
2828
"github.com/ActiveMemory/ctx/internal/cli/hook"
2929
"github.com/ActiveMemory/ctx/internal/cli/initialize"
30+
"github.com/ActiveMemory/ctx/internal/cli/journal"
3031
"github.com/ActiveMemory/ctx/internal/cli/learnings"
3132
"github.com/ActiveMemory/ctx/internal/cli/load"
3233
"github.com/ActiveMemory/ctx/internal/cli/loop"
3334
"github.com/ActiveMemory/ctx/internal/cli/recall"
35+
"github.com/ActiveMemory/ctx/internal/cli/serve"
3436
"github.com/ActiveMemory/ctx/internal/cli/session"
3537
"github.com/ActiveMemory/ctx/internal/cli/status"
3638
"github.com/ActiveMemory/ctx/internal/cli/sync"
3739
"github.com/ActiveMemory/ctx/internal/cli/task"
3840
"github.com/ActiveMemory/ctx/internal/cli/watch"
39-
"github.com/ActiveMemory/ctx/internal/config"
41+
"github.com/ActiveMemory/ctx/internal/rc"
4042
)
4143

4244
// version is set at build time via ldflags
@@ -49,7 +51,6 @@ const version = "dev"
4951
//
5052
// Global flags:
5153
// - --context-dir: Override the context directory path (default: .context)
52-
// - --quiet: Suppress non-essential output
5354
// - --no-color: Disable colored output
5455
//
5556
// Returns:
@@ -71,7 +72,7 @@ func RootCmd() *cobra.Command {
7172
PersistentPreRun: func(cmd *cobra.Command, args []string) {
7273
// Apply global flag values
7374
if contextDir != "" {
74-
config.SetContextDir(contextDir)
75+
rc.OverrideContextDir(contextDir)
7576
}
7677
if noColor {
7778
color.NoColor = true
@@ -86,12 +87,6 @@ func RootCmd() *cobra.Command {
8687
"",
8788
"Override context directory path (default: .context)",
8889
)
89-
cmd.PersistentFlags().BoolVar(
90-
&config.Quiet,
91-
"quiet",
92-
false,
93-
"Suppress non-essential output",
94-
)
9590
cmd.PersistentFlags().BoolVar(
9691
&noColor,
9792
"no-color",
@@ -124,14 +119,16 @@ func Initialize(cmd *cobra.Command) *cobra.Command {
124119
drift.Cmd,
125120
sync.Cmd,
126121
compact.Cmd,
127-
decisions.Cmd,
122+
decision.Cmd,
128123
watch.Cmd,
129124
hook.Cmd,
130125
learnings.Cmd,
131126
session.Cmd,
132127
task.Cmd,
133128
loop.Cmd,
134129
recall.Cmd,
130+
journal.Cmd,
131+
serve.Cmd,
135132
} {
136133
cmd.AddCommand(c())
137134
}

internal/cli/add/content.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package add

internal/cli/add/err.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package add

internal/cli/add/insert.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package add

internal/cli/add/normalize.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package add

internal/cli/add/pos.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package add

0 commit comments

Comments
 (0)