Skip to content

Commit 6e9deb3

Browse files
committed
✨ feat(cli): add --command and --format filtering to list-command-examples
- Add --command flag to filter example catalog by command family - Add --format flag to filter by text or json output format - Support repeated flags and comma-separated values for both filters - Validate filter values against known commands and formats - Update operator docs with filtering examples 📝 docs(spec): add MCP tool surface documentation and example payloads - Document current 11-tool MCP surface for maintainers - Add example request/response payloads for resolve_scope, start_session, get_recent, get_note, and install_agents tools - Add imported artifact onboarding flow section - Document suppression behavior for replayed and privacy-blocked imports
1 parent c96a967 commit 6e9deb3

12 files changed

Lines changed: 687 additions & 43 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ They are not MCP tools and are not the normal end-user interaction path.
8585
- `codex-mem audit-follow-imports [--target-profile all|artifacts|state|retry|health] [...]`
8686
Reports the same hygiene targets without deleting them. `--target-profile` can enable common audit target sets before you add path, age, fail-if-matched, or `--summary-only` controls.
8787
- `codex-mem list-command-examples`
88-
Prints the embedded import/follow example-manifest catalog shipped with the binary so operators and maintainers can discover the checked-in sample outputs without browsing the source tree. Add `--json` for a machine-readable catalog.
88+
Prints the embedded import/follow example-manifest catalog shipped with the binary so operators and maintainers can discover the checked-in sample outputs without browsing the source tree. Add `--json` for a machine-readable catalog, `--command <name>` to filter to one command family, or `--format text|json` to keep only one example-output format.
8989
- `codex-mem migrate`
9090
Opens the configured SQLite database and applies embedded migrations.
9191
- `codex-mem serve`

docs/go/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,14 @@ If you are deploying or operating the MCP server:
2424

2525
- [Client Examples](./operator/client-examples.md)
2626
- [Import Ingestion](./operator/import-ingestion.md)
27+
Batch import, long-lived follow mode, cleanup/audit hygiene commands, and packaged example-catalog lookup.
2728
- [Release Readiness](./operator/release-readiness.md)
2829
- [Troubleshooting](./operator/troubleshooting.md)
2930

3031
If you are maintaining or testing the Go implementation:
3132

3233
- [MCP Integration](./maintainer/mcp-integration.md)
34+
Stdio/HTTP transport behavior, current 11-tool MCP surface, and source-tree smoke tests.
3335
- [Development Tracker](./maintainer/development-tracker.md)
3436
- [Development Kickoff](./maintainer/dev-kickoff.md)
3537
- [Implementation Plan](./maintainer/implementation-plan.md)

docs/go/maintainer/development-tracker.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,20 @@ Immediate next tasks:
151151

152152
### 2026-03-18 Session Update
153153

154+
- Completed: Added `--format` filtering to `list-command-examples`, including repeated and comma-separated format selectors. Text and JSON output now share the same embedded-manifest filtering path across command and format filters, runtime coverage verifies mixed command+format filtering plus argument rejection, and operator docs now show how to browse only text or JSON fixtures.
155+
- In progress: none.
156+
- Blockers: none.
157+
- Next step: decide whether operators now need richer catalog metadata such as fixture purpose/category tags, or whether command plus format filtering is enough.
158+
159+
### 2026-03-18 Session Update
160+
161+
- Completed: Added `--command` filtering to `list-command-examples`, including repeated and comma-separated command selectors. Text and JSON output now share the same parsed embedded manifest path, so filtered operator lookup stays consistent across both formats without introducing another source of truth.
162+
- In progress: none.
163+
- Blockers: none.
164+
- Next step: decide whether list-command-examples now has enough discovery power, or whether operators also need format-level filtering such as `--format json`.
165+
166+
### 2026-03-18 Session Update
167+
154168
- Completed: Extended `list-command-examples` with a `--json` mode that parses the embedded text manifest into a stable structured report. Runtime coverage now verifies both text and JSON output, so the packaged-binary example catalog can serve human lookup and simple automation without introducing a second checked-in source of truth.
155169
- In progress: none.
156170
- Blockers: none.

docs/go/maintainer/mcp-integration.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,29 @@ Use this document when you need one of these:
8585

8686
If you only want to register the packaged binary with Codex CLI, use [client-examples.md](../operator/client-examples.md).
8787

88+
## Current Tool Surface
89+
90+
`tools/list` should currently expose these 11 MCP tools:
91+
92+
- `memory_bootstrap_session`
93+
- `memory_resolve_scope`
94+
- `memory_start_session`
95+
- `memory_save_note`
96+
- `memory_save_handoff`
97+
- `memory_save_import`
98+
- `memory_save_imported_note`
99+
- `memory_search`
100+
- `memory_get_recent`
101+
- `memory_get_note`
102+
- `memory_install_agents`
103+
104+
For maintainers, the most important v1 extension additions beyond the continuity baseline are the import-audit and imported-note tools:
105+
106+
- `memory_save_import` records durable provenance for imported watcher or relay artifacts, even when note materialization is suppressed.
107+
- `memory_save_imported_note` keeps imported-note materialization aligned with the same scope, privacy, and explicit-memory precedence rules as the operator-facing import commands.
108+
109+
If a client caches tool metadata, refresh that cache after upgrades instead of assuming the older baseline surface.
110+
88111
## Fastest Source-Tree Smoke Test
89112

90113
Run the checked-in smoke test:

docs/go/operator/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Start here:
77
- [Client Examples](./client-examples.md)
88
Real MCP client registration examples for local stdio and remote HTTP.
99
- [Import Ingestion](./import-ingestion.md)
10-
JSONL batch ingestion through `ingest-imports` plus checkpointed follow-mode ingestion through `follow-imports`, including notify-vs-poll operator guidance.
10+
JSONL batch ingestion through `ingest-imports`, checkpointed follow-mode ingestion through `follow-imports`, hygiene commands such as `cleanup-follow-imports` and `audit-follow-imports`, and `list-command-examples` discovery.
1111
- [Release Readiness](./release-readiness.md)
1212
Packaging, readiness, and release checklist.
1313
- [Troubleshooting](./troubleshooting.md)

docs/go/operator/import-ingestion.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,18 @@ If automation needs a stable machine-readable catalog, use:
330330
codex-mem.exe list-command-examples --json
331331
```
332332

333+
If you only want one command family while browsing the catalog, filter it in place:
334+
335+
```powershell
336+
codex-mem.exe list-command-examples --command follow-imports
337+
```
338+
339+
If you only want one output format while browsing the catalog, filter it the same way:
340+
341+
```powershell
342+
codex-mem.exe list-command-examples --format json
343+
```
344+
333345
If a deliberate output change makes those fixtures drift, refresh the ingest fixtures from the repository root through the test-only maintainer helper:
334346

335347
```powershell

docs/spec/appendices/example-payloads.md

Lines changed: 249 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Purpose
44

5-
This appendix provides language-neutral example request and response shapes for key `codex-mem` tools.
5+
This appendix provides language-neutral example request and response shapes for the current `codex-mem` v1 MCP tools.
66

77
These examples illustrate intent and semantics. They are not tied to one implementation language.
88

@@ -133,6 +133,86 @@ These examples illustrate intent and semantics. They are not tied to one impleme
133133
}
134134
```
135135

136+
## `memory_resolve_scope`
137+
138+
### Example request
139+
140+
```json
141+
{
142+
"cwd": "D:/Code/go/order-web",
143+
"branch_name": "fix/order-validation",
144+
"repo_remote": "git@github.com:example/order-web.git",
145+
"project_name_hint": "order-web",
146+
"system_name_hint": "order-platform"
147+
}
148+
```
149+
150+
### Example response
151+
152+
```json
153+
{
154+
"ok": true,
155+
"data": {
156+
"scope": {
157+
"system_id": "sys_order_platform",
158+
"system_name": "order-platform",
159+
"project_id": "proj_order_web",
160+
"project_name": "order-web",
161+
"workspace_id": "ws_order_web_main",
162+
"workspace_root": "D:/Code/go/order-web",
163+
"branch_name": "fix/order-validation",
164+
"resolved_by": "repo_remote"
165+
},
166+
"resolved_by": "repo_remote"
167+
},
168+
"warnings": []
169+
}
170+
```
171+
172+
## `memory_start_session`
173+
174+
### Example request
175+
176+
```json
177+
{
178+
"scope": {
179+
"system_id": "sys_order_platform",
180+
"system_name": "order-platform",
181+
"project_id": "proj_order_web",
182+
"project_name": "order-web",
183+
"workspace_id": "ws_order_web_main",
184+
"workspace_root": "D:/Code/go/order-web",
185+
"branch_name": "fix/order-validation",
186+
"resolved_by": "repo_remote"
187+
},
188+
"task": "Continue fixing order submission validation",
189+
"branch_name": "fix/order-validation"
190+
}
191+
```
192+
193+
### Example response
194+
195+
```json
196+
{
197+
"ok": true,
198+
"data": {
199+
"session": {
200+
"session_id": "sess_20260313_001",
201+
"scope": {
202+
"system_id": "sys_order_platform",
203+
"project_id": "proj_order_web",
204+
"workspace_id": "ws_order_web_main"
205+
},
206+
"status": "active",
207+
"task": "Continue fixing order submission validation",
208+
"branch_name": "fix/order-validation",
209+
"started_at": "2026-03-13T10:30:00Z"
210+
}
211+
},
212+
"warnings": []
213+
}
214+
```
215+
136216
## `memory_save_note`
137217

138218
### Example request
@@ -299,6 +379,8 @@ These examples illustrate intent and semantics. They are not tied to one impleme
299379
}
300380
```
301381

382+
Replay of the same imported artifact or a privacy-blocked import still returns `ok: true`, but the payload flips to `suppressed: true` and includes warning visibility instead of silently writing another durable record.
383+
302384
## `memory_save_imported_note`
303385

304386
### Example request
@@ -370,6 +452,8 @@ These examples illustrate intent and semantics. They are not tied to one impleme
370452
}
371453
```
372454

455+
When explicit project memory already covers the same artifact, or privacy rules exclude durable storage, the response still preserves the import audit while `materialized` becomes `false` and `suppressed` becomes `true`.
456+
373457
## `memory_search`
374458

375459
### Example request
@@ -431,3 +515,167 @@ These examples illustrate intent and semantics. They are not tied to one impleme
431515
"warnings": []
432516
}
433517
```
518+
519+
## `memory_get_recent`
520+
521+
### Example request
522+
523+
```json
524+
{
525+
"scope": {
526+
"system_id": "sys_order_platform",
527+
"project_id": "proj_order_web",
528+
"workspace_id": "ws_order_web_main"
529+
},
530+
"limit": 3,
531+
"include_handoffs": true,
532+
"include_notes": true,
533+
"include_related_projects": false
534+
}
535+
```
536+
537+
### Example response
538+
539+
```json
540+
{
541+
"ok": true,
542+
"data": {
543+
"handoffs": [
544+
{
545+
"handoff_id": "handoff_115",
546+
"scope": {
547+
"system_id": "sys_order_platform",
548+
"project_id": "proj_order_web",
549+
"workspace_id": "ws_order_web_main"
550+
},
551+
"session_id": "sess_20260313_001",
552+
"kind": "final",
553+
"task": "Fix order validation mismatch",
554+
"summary": "Validation logic has been aligned, but draft checkout regression still needs confirmation.",
555+
"next_steps": [
556+
"Run regression test on saved draft checkout flow",
557+
"Confirm no legacy alias references remain"
558+
],
559+
"status": "open",
560+
"created_at": "2026-03-13T11:10:00Z"
561+
}
562+
],
563+
"notes": [
564+
{
565+
"note_id": "note_488",
566+
"scope": {
567+
"system_id": "sys_order_platform",
568+
"project_id": "proj_order_web",
569+
"workspace_id": "ws_order_web_main"
570+
},
571+
"session_id": "sess_20260313_001",
572+
"type": "discovery",
573+
"title": "Watcher captured checkout retry regression",
574+
"content": "A local watcher run showed the checkout retry button still posts a legacy payment alias after draft restore.",
575+
"importance": 4,
576+
"status": "active",
577+
"source": "watcher_import",
578+
"created_at": "2026-03-13T11:24:00Z"
579+
},
580+
{
581+
"note_id": "note_402",
582+
"scope": {
583+
"system_id": "sys_order_platform",
584+
"project_id": "proj_order_web",
585+
"workspace_id": "ws_order_web_main"
586+
},
587+
"session_id": "sess_20260313_001",
588+
"type": "bugfix",
589+
"title": "Order validation now uses generated backend enum list",
590+
"content": "Client-side validation now reads generated enum metadata instead of maintaining a stale manual list.",
591+
"importance": 4,
592+
"status": "active",
593+
"source": "codex_explicit",
594+
"created_at": "2026-03-13T10:52:00Z"
595+
}
596+
]
597+
},
598+
"warnings": []
599+
}
600+
```
601+
602+
## `memory_get_note`
603+
604+
### Example request
605+
606+
```json
607+
{
608+
"id": "note_488",
609+
"kind": "note"
610+
}
611+
```
612+
613+
### Example response
614+
615+
```json
616+
{
617+
"ok": true,
618+
"data": {
619+
"record": {
620+
"note_id": "note_488",
621+
"scope": {
622+
"system_id": "sys_order_platform",
623+
"project_id": "proj_order_web",
624+
"workspace_id": "ws_order_web_main"
625+
},
626+
"session_id": "sess_20260313_001",
627+
"type": "discovery",
628+
"title": "Watcher captured checkout retry regression",
629+
"content": "A local watcher run showed the checkout retry button still posts a legacy payment alias after draft restore.",
630+
"importance": 4,
631+
"status": "active",
632+
"source": "watcher_import",
633+
"created_at": "2026-03-13T11:24:00Z"
634+
}
635+
},
636+
"warnings": []
637+
}
638+
```
639+
640+
## `memory_install_agents`
641+
642+
### Example request
643+
644+
```json
645+
{
646+
"target": "project",
647+
"mode": "safe",
648+
"cwd": "D:/Code/go/order-web",
649+
"project_name": "order-web",
650+
"system_name": "order-platform",
651+
"related_repositories": [
652+
"order-api",
653+
"order-worker"
654+
],
655+
"preferred_tags": [
656+
"spec",
657+
"api",
658+
"go"
659+
],
660+
"allow_related_project_memory": true
661+
}
662+
```
663+
664+
### Example response
665+
666+
```json
667+
{
668+
"ok": true,
669+
"data": {
670+
"written_files": [
671+
{
672+
"path": "D:/Code/go/order-web/AGENTS.md",
673+
"target": "project",
674+
"mode": "safe"
675+
}
676+
],
677+
"skipped_files": []
678+
},
679+
"warnings": []
680+
}
681+
```

0 commit comments

Comments
 (0)