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
- AGENTS template installation is implemented for global and project workflows.
13
-
-one-shot watcher/relay batch ingestion is available through `ingest-imports`.
13
+
- watcher/relay import ingestion is available as one-shot batches through `ingest-imports` and as a checkpointed long-lived adapter through `follow-imports`.
14
14
15
15
Normative product docs live in [docs/spec/README.md](docs/spec/README.md).
16
16
Go implementation docs now live under [docs/go/README.md](docs/go/README.md), grouped into user, operator, and maintainer directories.
@@ -24,7 +24,7 @@ Use the docs by audience:
24
24
-[Operator docs](docs/go/operator/README.md)
25
25
Client registration, deployment/readiness, packaging, and troubleshooting.
Imports newline-delimited watcher or relay note events into durable imported notes plus audit records, with optional partial-success handling plus retry-oriented failure exports.
Follows a watcher or relay JSONL file incrementally, checkpoints the last consumed offset, and reuses the same imported-note workflow for newly appended complete lines.
81
83
-`codex-mem migrate`
82
84
Opens the configured SQLite database and applies embedded migrations.
Copy file name to clipboardExpand all lines: docs/go/maintainer/development-tracker.md
+30Lines changed: 30 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -313,6 +313,36 @@ Current blockers:
313
313
- In progress: none.
314
314
- Blockers: none.
315
315
- Next step: decide whether `ingest-imports` should remain the main watcher/relay bridge for now or whether a more direct long-lived integration path is worth adding later.
316
+
### 2026-03-16 Session Update
317
+
318
+
- Completed: Added `ingest-imports --continue-on-error` so watcher/relay batches can keep importing valid lines while collecting per-line decode/write failures in the text/JSON report. Default behavior remains fail-fast for compatibility, but partial-success mode now reports `status`, attempted/failed counts, and structured line errors; app coverage verifies partial success and the all-failed path.
319
+
- In progress: none.
320
+
- Blockers: none.
321
+
- Next step: decide whether partial-success mode is enough for watcher/relay operators for now, or whether they also need richer retry/export behavior for failed lines.
322
+
### 2026-03-16 Session Update
323
+
324
+
- Completed: Added `ingest-imports --failed-output <path>` for `--continue-on-error` batches so failed raw JSONL lines can be exported unchanged for later replay. The CLI report now includes the resolved failed-output path plus written count, and app coverage verifies both partial-success export and all-failed export behavior.
325
+
- In progress: none.
326
+
- Blockers: none.
327
+
- Next step: decide whether failed-line export is enough for operators or whether the next slice should add a richer retry manifest with error metadata alongside the raw replay file.
328
+
### 2026-03-16 Session Update
329
+
330
+
- Completed: Added `ingest-imports --failed-manifest <path>` so `--continue-on-error` batches can emit a JSON retry manifest with line numbers, error payloads, raw failed lines, and failed-output line numbers. The main report now surfaces the manifest path/count, and app coverage verifies manifest validation plus partial/all-failed export behavior.
331
+
- In progress: none.
332
+
- Blockers: none.
333
+
- Next step: decide whether the operator path is now sufficient, or whether the next import slice should focus on a more direct watcher/relay integration instead of more CLI/reporting polish.
334
+
### 2026-03-16 Session Update
335
+
336
+
- Completed: Extracted the import batch workflow into a reusable app-level entrypoint `(*App).IngestImports(...)` so future in-process watcher/relay integrations can reuse the same scope resolution, session creation, imported-note materialization, and failure-export behavior without shelling out to the CLI. The CLI command now delegates to that method, and app coverage verifies the embedded path directly.
337
+
- In progress: none.
338
+
- Blockers: none.
339
+
- Next step: decide whether to build an actual in-tree watcher/relay adapter on top of `App.IngestImports`, or stop here and treat the reusable app method as sufficient integration scaffolding for now.
340
+
### 2026-03-16 Session Update
341
+
342
+
- Completed: Added `follow-imports` as a checkpointed long-lived adapter on top of `App.IngestImports(...)`. The new command polls a JSONL file for newly appended complete lines, persists byte-offset state in a sidecar checkpoint file, resets cleanly on truncation, and derives per-batch failed-output / failed-manifest paths so operator retry artifacts are not overwritten.
343
+
- In progress: none.
344
+
- Blockers: none.
345
+
- Next step: decide whether polling-based follow mode is sufficient for watcher/relay integration for now, or whether a later slice should add native filesystem notifications, rotation metadata, or multi-input fan-in.
Copy file name to clipboardExpand all lines: docs/go/operator/import-ingestion.md
+67-4Lines changed: 67 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
## Purpose
4
4
5
-
This document explains how operators can use `codex-mem ingest-imports`to turn watcher or relay batches into durable imported notes plus import audit records.
5
+
This document explains how operators can use `codex-mem ingest-imports`for one-shot batches and `codex-mem follow-imports` for long-lived incremental consumption of watcher or relay JSONL feeds.
6
6
7
7
Audience:
8
8
@@ -12,6 +12,7 @@ Audience:
12
12
Use this when:
13
13
14
14
- you need a one-shot batch bridge into the imported-note workflow
15
+
- you need a checkpointed long-lived bridge for a growing JSONL file
15
16
- your upstream process can emit newline-delimited JSON events
16
17
17
18
Do not use this for:
@@ -21,6 +22,9 @@ Do not use this for:
21
22
22
23
## Command Shape
23
24
25
+
Use `ingest-imports` when you already have a bounded batch to replay.
26
+
Use `follow-imports` when another process keeps appending to the same JSONL file and you want `codex-mem` to checkpoint progress between polling passes.
27
+
24
28
Minimal stdin example:
25
29
26
30
```powershell
@@ -33,12 +37,43 @@ Read from a file and print JSON:
Required. Declares the provenance source for every event in the batch.
73
+
Required. Declares the provenance source for every event in the input stream.
40
74
-`--input <path>`
41
-
Optional. Reads JSONL from a file instead of stdin.
75
+
Optional for `ingest-imports`. Reads JSONL from a file instead of stdin.
76
+
Required for `follow-imports`.
42
77
-`--cwd <path>`
43
78
Optional. Resolves scope from a specific workspace root.
44
79
-`--branch-name <name>`
@@ -49,6 +84,20 @@ Useful flags:
49
84
Optional. Overrides the default ingestion session task summary.
50
85
-`--json`
51
86
Optional. Prints a structured report instead of line-oriented text output.
87
+
-`--continue-on-error`
88
+
`ingest-imports` only. Keeps scanning after per-line decode or import failures and returns a partial-success report when at least one event succeeds.
89
+
-`--failed-output <path>`
90
+
Optional. For `ingest-imports`, requires `--continue-on-error` and writes the original failed input lines to a JSONL file for manual fix-up or replay.
91
+
For `follow-imports`, each polling batch derives a range-suffixed file from the provided base path so earlier failures are not overwritten.
92
+
-`--failed-manifest <path>`
93
+
Optional. For `ingest-imports`, requires `--continue-on-error` and writes a JSON manifest with per-line error metadata and raw failed input.
94
+
For `follow-imports`, each polling batch derives a range-suffixed manifest path from the provided base path.
95
+
-`--state-file <path>`
96
+
`follow-imports` only. Optional. Stores the consumed byte offset checkpoint. Defaults to `<input>.offset.json`.
97
+
-`--poll-interval <duration>`
98
+
`follow-imports` only. Optional. Controls how often the input file is polled for appended complete lines. Defaults to `5s`.
99
+
-`--once`
100
+
`follow-imports` only. Optional. Runs one poll/ingest pass and exits instead of staying in the polling loop.
52
101
53
102
## Event Schema
54
103
@@ -103,11 +152,15 @@ Text mode prints a compact summary such as:
103
152
104
153
```text
105
154
ingest imports ok
155
+
status=ok
106
156
source=watcher_import
107
157
input=stdin
108
158
session_id=sess_20260316_001
109
159
resolved_by=repo_remote
160
+
continue_on_error=false
161
+
attempted=2
110
162
processed=2
163
+
failed=0
111
164
materialized=1
112
165
suppressed=1
113
166
note_deduplicated=0
@@ -116,10 +169,20 @@ warnings=1
116
169
```
117
170
118
171
JSON mode returns the same summary plus per-line results, including the created or reused `note_id` and `import_id`.
172
+
When a line fails in `--continue-on-error` mode, that result entry includes a structured `error` payload instead.
173
+
If `--failed-output` is set, the report also includes the resolved output path and how many failed lines were written there.
174
+
If `--failed-manifest` is set, the report also includes the manifest path and how many failures were captured there.
175
+
`follow-imports` reports the input path, checkpoint file, consumed offset, pending trailing bytes, truncation detection, and the nested batch report for whatever newly appended complete lines were imported during that poll.
119
176
120
177
## Operational Notes
121
178
122
179
-`ingest-imports` starts one fresh session for the whole batch after resolving scope.
180
+
-`follow-imports` starts one fresh session per consumed polling batch, not one session for the lifetime of the process.
123
181
- Each event uses the same imported-note workflow as `memory_save_imported_note`.
124
182
- Existing explicit memory wins over weaker imported duplicates in the same project.
125
-
- The current implementation is fail-fast: the first invalid line stops the batch and returns an error.
183
+
- The default implementation is fail-fast: the first invalid line stops the batch and returns an error.
184
+
-`--continue-on-error` preserves successful lines, reports per-line failures, and still exits with an error if nothing in the batch imports successfully.
185
+
-`--failed-output` writes the original failed JSONL lines without wrapping them, so operators can edit that file and replay it through the same command later.
186
+
-`--failed-manifest` writes a structured JSON sidecar with line numbers, error codes, error messages, raw failed lines, and failed-output line numbers when available.
187
+
-`follow-imports` only consumes complete newline-terminated lines. A partially written trailing line is left in place until a later poll sees its terminating newline.
188
+
- If the followed input file is truncated or rotated to a smaller size, `follow-imports` resets its checkpoint to byte offset `0` and continues from the start of the new file contents.
0 commit comments