johns-harness 2026.11.23 → 2026.11.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## 2026.11.30
4
+
5
+ - The default context budget is now **1,000,000 tokens** for both `openai-codex/gpt-6.2-astra` (previously 272,000) and `openai-codex/gpt-6.2-sol` (previously 500,000). This is a local harness budget, not a verified subscription backend limit.
6
+ - The matching `openai/` API models retain their 1,050,000-token windows. All four models retain their 128,000-token output limits.
7
+ - Rollback: `npm i -g johns-harness@2026.11.29`.
8
+
9
+ ## 2026.11.29
10
+
11
+ ### MemoryRouter saves only the main chat
12
+
13
+ - **`mr-memory` no longer stores subagent, cron, hook or swarm-member turns (Family 100).** Its `agent_end` hook used to store the last user+assistant exchange of every run. The only guards were `isReadOnlyAgent` (agent-scoped) and the auto-consolidation session, and worker runs share the same agent id and workspace as the main chat, so neither could separate them.
14
+ - **Capture is now scoped to the primary session**, `agent:<id>:main`. `isNonPrimarySession(sessionKey)` decides it and `agent_end` returns before the vault key is resolved.
15
+ - **A `[cron:…]` prompt is no longer laundered into a user turn.** The noise check now runs on the raw text before `stripSystemPrefixes` deletes the only marker the cron pattern matches.
16
+ - **Reads are unchanged on purpose.** Subagents, crons, hooks and swarm members still receive vault context from both prompt hooks; only the write path is limited. `readOnlyAgents` and every other plugin feature keep working.
17
+ - **`/update` delivers the fix to an existing installed copy.** An installed `<state>/extensions/mr-memory` stays authoritative over the bundled copy and `updateNpmInstalledPlugins` only reinstalls the pinned npm spec, so `/update` now ports these three edits into that copy in place after a successful install and before the restart. It keeps whatever else the copy carries (today: a hand-backported `readOnlyAgents` guard), writes a `.bak` first, is idempotent, and skips with a log line rather than guessing if the file has drifted.
18
+ - Also fills in the missed manifest flag: the installed copy's manifest now declares `kind: "memory"`, so the memory slot matches without a per-deployment edit.
19
+ - **Scope:** the bundled dependency patch, one `/update` step, its manifest flag, tests, verifier and docs. No model, channel, credential, tool-surface or default-model change; no global install, no restart.
20
+ - **Gates:** verifier **610 pass, 0 fail**; full suite **1,426 pass, 0 fail, 5 skip** (1,431 tests); Family 100 patcher replays `dist/update-command.js` byte for byte; packed-artifact and secret checks clean.
21
+ - **Rollback:** `npm i -g johns-harness@2026.11.23`.
22
+
3
23
  ## 2026.11.23
4
24
 
5
25
  ### The OpenAI Whisper API is the standard audio transcription method
@@ -13,6 +13,7 @@ import { installVolumeRuntime } from "./volume-update.js";
13
13
  import fs from "node:fs";
14
14
  import fsp from "node:fs/promises";
15
15
  import path from "node:path";
16
+ import os from "node:os"; // JOHNNESS_PATCH_PRIMARY_SESSION_CAPTURE_100
16
17
  import { fileURLToPath } from "node:url";
17
18
 
18
19
  const PACKAGE = "johns-harness";
@@ -126,6 +127,86 @@ export async function fetchLatestVersion(fetchImpl = fetch, timeoutMs = 8000) {
126
127
  }
127
128
  }
128
129
 
130
+ // JOHNNESS_PATCH_PRIMARY_SESSION_CAPTURE_100
131
+ // A state-dir install (plugins.installs -> <state>/extensions/<id>) stays
132
+ // authoritative over the bundled copy, and `updateNpmInstalledPlugins` only ever
133
+ // reinstalls the exact pinned npm spec. So a fixed bundled mr-memory would never
134
+ // reach an existing state-dir copy. `/update` therefore ports this one behaviour
135
+ // change into the installed copy in place, keeping whatever else that copy
136
+ // carries (its hand-backported readOnlyAgents support, local edits and layout).
137
+ export const PRIMARY_SESSION_CAPTURE_MARKER = "JOHNNESS_PATCH_PRIMARY_SESSION_CAPTURE_100";
138
+ const MEMORY_EXTENSION_ID = "mr-memory";
139
+
140
+ const PRIMARY_SESSION_HELPER = `/** JOHNNESS_PATCH_PRIMARY_SESSION_CAPTURE_100: only the primary chat session (agent:<id>:main) is a real
141
+ * conversation with the user. Subagent, cron, hook and swarm-member runs share
142
+ * the same agent id and workspace, so an agent-scoped filter cannot separate
143
+ * them. Retrieval/injection are untouched: every session still reads the
144
+ * vault, only the write path is limited. */
145
+ export function isNonPrimarySession(sessionKey) {
146
+ const k = typeof sessionKey === "string" ? sessionKey.trim().toLowerCase() : "";
147
+ if (!k)
148
+ return false;
149
+ return !/^agent:[a-z0-9._-]+:main$/.test(k);
150
+ }
151
+ `;
152
+
153
+ /** The three edits, anchored on code rather than formatting so a reformatted or
154
+ * hand-edited copy is patched instead of skipped. Every anchor must appear
155
+ * exactly once; anything else means drift and we refuse rather than guess. */
156
+ export function primarySessionCaptureEdits(text) {
157
+ const count = (needle) => text.split(needle).length - 1;
158
+ const noiseAnchor = "function isSystemNoise(text) {";
159
+ const stripAnchor = "const taskText = stripSystemPrefixes(userText);";
160
+ const handlerRe = /api\.on\(\s*"agent_end"\s*,\s*async\s*\(event,\s*ctx\)\s*=>\s*\{/;
161
+ if (!handlerRe.test(text)) return { ok: false, reason: "agent_end handler not found" };
162
+ if (count(noiseAnchor) !== 1) return { ok: false, reason: `isSystemNoise anchor x${count(noiseAnchor)}` };
163
+ if (count(stripAnchor) !== 1) return { ok: false, reason: `taskText anchor x${count(stripAnchor)}` };
164
+ // Insert the helper first, then re-locate the handler in the edited text so the
165
+ // index stays correct.
166
+ let next = text.replace(noiseAnchor, PRIMARY_SESSION_HELPER + noiseAnchor);
167
+ const handler = handlerRe.exec(next);
168
+ if (!handler) return { ok: false, reason: "agent_end handler lost after helper insert" };
169
+ const guard = handler[0] + `
170
+ // JOHNNESS_PATCH_PRIMARY_SESSION_CAPTURE_100: store only the primary chat session.
171
+ if (isNonPrimarySession(ctx?.sessionKey))
172
+ return;`;
173
+ next = next.slice(0, handler.index) + guard + next.slice(handler.index + handler[0].length);
174
+ next = next.replace(stripAnchor,
175
+ `// JOHNNESS_PATCH_PRIMARY_SESSION_CAPTURE_100: a [cron:...] prompt is noise; stripping the prefix first
176
+ // would delete the only marker and store it as a user turn.
177
+ const taskText = isSystemNoise(userText) ? "" : stripSystemPrefixes(userText);`);
178
+ return { ok: true, text: next };
179
+ }
180
+
181
+ /** The installed copy predates the `kind` field the bundled manifest carries, so
182
+ * the memory slot is only satisfied by the plugin's own export. Additive fix. */
183
+ export function ensureMemoryKind(dir, { dryRun = false } = {}) {
184
+ const manifest = path.join(dir, "johnness.plugin.json");
185
+ let parsed;
186
+ try { parsed = JSON.parse(fs.readFileSync(manifest, "utf8")); } catch { return "absent"; }
187
+ if (parsed?.kind === "memory") return "current";
188
+ if (!dryRun) fs.writeFileSync(manifest, `${JSON.stringify({ ...parsed, kind: "memory" }, null, 2)}\n`);
189
+ return dryRun ? "would-set" : "set";
190
+ }
191
+
192
+ /** Port the primary-session capture fix into <state>/extensions/mr-memory. */
193
+ export function applyPrimarySessionCaptureFix({ env = process.env, dryRun = false } = {}) {
194
+ const stateDir = env.JOHNNESS_STATE_DIR?.trim() ? path.resolve(env.JOHNNESS_STATE_DIR) : path.join(os.homedir(), ".johnness");
195
+ const dir = path.join(stateDir, "extensions", MEMORY_EXTENSION_ID);
196
+ const file = path.join(dir, "index.js");
197
+ const kind = ensureMemoryKind(dir, { dryRun });
198
+ let text;
199
+ try { text = fs.readFileSync(file, "utf8"); } catch { return { status: "absent", file, kind }; }
200
+ if (text.includes(PRIMARY_SESSION_CAPTURE_MARKER)) return { status: "current", file, kind };
201
+ const edits = primarySessionCaptureEdits(text);
202
+ if (!edits.ok) return { status: "skipped", file, reason: edits.reason, kind };
203
+ if (!dryRun) {
204
+ try { fs.writeFileSync(`${file}.pre-${PRIMARY_SESSION_CAPTURE_MARKER}.bak`, text); } catch {}
205
+ fs.writeFileSync(file, edits.text);
206
+ }
207
+ return { status: dryRun ? "would-patch" : "patched", file, kind };
208
+ }
209
+
129
210
  const SECRET_RE = /(npm_[A-Za-z0-9]{20,}|Bearer\s+\S+|_authToken\s*=\s*\S+|[A-Za-z0-9_-]{40,})/g;
130
211
  export function redactTail(text, lines = 5) {
131
212
  const rows = String(text ?? "").replace(SECRET_RE, "<redacted>").split(/\r?\n/).filter((l) => l.trim());
@@ -265,6 +346,13 @@ export async function handleUpdateCommand(params, allowTextCommands, { routeRepl
265
346
  await deliver(`Update failed (${result.target.mode} prefix ${result.target.prefix ?? "unknown"}).\n${result.tail}\nFix by hand: ${result.manual}`);
266
347
  return;
267
348
  }
349
+ let captureFix = null;
350
+ try {
351
+ captureFix = (deps.applyPrimarySessionCaptureFix ?? applyPrimarySessionCaptureFix)({ env });
352
+ } catch (error) {
353
+ log(`[update] memory capture fix skipped: ${error?.message ?? error}`);
354
+ }
355
+ if (captureFix?.status === "skipped") log(`[update] memory capture fix skipped: ${captureFix.reason} (${captureFix.file})`);
268
356
  if (typeof deps.writeRestartSentinel === "function") {
269
357
  const delivery = typeof deps.extractDeliveryInfo === "function" ? deps.extractDeliveryInfo(params.sessionKey) : {};
270
358
  try {
@@ -281,6 +369,7 @@ export async function handleUpdateCommand(params, allowTextCommands, { routeRepl
281
369
  } catch {}
282
370
  }
283
371
  const how = await restartIntoUpdate({ target: result.target, deps, log });
372
+ if (captureFix?.status === "patched") await deliver("MemoryRouter memory: capture is now limited to the main chat session, so subagent, cron and swarm runs no longer write memories.");
284
373
  const restartText = how === "supervisor"
285
374
  ? "Restarting through the supervisor; the entrypoint will start the new runtime."
286
375
  : how === "service" ? "Restarting the gateway service." : how === "gateway" ? "Restarting the gateway." : "Restart the gateway to finish (johnness gateway restart).";
package/docs/MODELS.md CHANGED
@@ -121,8 +121,15 @@ Context rules still apply when choosing `contextWindow`: every Sonnet gets its n
121
121
  caps live in `resolveJohnnessOpusContextWindow`; OpenAI API entries use the full native window
122
122
  unless John says otherwise; `openai-codex` entries use the Codex backend's `context_window`
123
123
  from `codex-rs/models-manager/models.json` in openai/codex, verified per exact ID rather than
124
- assuming one window per family. GPT-6.2 Astra uses272K; GPT-6.2 Sol uses500K. Their metadata's
125
- 872K maximum is not the default window and is not enabled by these cards.
124
+ assuming one window per family. There are two owner-requested exceptions:
125
+ `openai-codex/gpt-6.2-astra` and `openai-codex/gpt-6.2-sol` each have a **1,000,000-token
126
+ local harness budget**. The pinned Codex metadata lists default windows of 272,000 and 500,000,
127
+ respectively, and a maximum of 872,000 for both. Subscription backend acceptance at 1M is unverified.
128
+ The corresponding `openai/` API cards remain at 1,050,000. All four cards keep 128,000 max output tokens.
129
+
130
+ This is a shipped catalog default, not a gateway config edit. Model sync generates the pi-ai
131
+ vendor overlay from the master; npm prepack and postinstall copy it into the pinned pi-ai
132
+ resolver. No per-agent override is needed.
126
133
 
127
134
  ## Replaying older families
128
135
 
package/docs/PATCHES.md CHANGED
@@ -3337,3 +3337,29 @@ Rollback: `npm i -g johns-harness@2026.11.9`.
3337
3337
  **Tests:** `tests/whisper-api-99.test.mjs` (8): Whisper API chosen with `OPENAI_API_KEY`; chosen with the key only in config; the real provider path posts `multipart/form-data` with `model=whisper-1` and `Bearer` auth to `/v1/audio/transcriptions` on a loopback server and returns its transcript; a `whisper`/`whisper-cli`/`sherpa-onnx-offline` binary on `PATH` is never selected and never executed; with no OpenAI auth the order falls to the next provider and still never runs a local CLI; an explicit CLI entry still wins; patcher replay is byte-identical and drift fails closed; all ten bundles carry the default with no local auto-selection. The loopback run is the real transport: no hosted OpenAI call is claimed.
3338
3338
 
3339
3339
  **Rollback:** `npm i -g johns-harness@2026.11.20`.
3340
+
3341
+ ## Family 100: MemoryRouter capture is limited to the primary chat session (2026-11-29)
3342
+
3343
+ **Marker:** `JOHNNESS_PATCH_PRIMARY_SESSION_CAPTURE_100`. **Release:** `johns-harness@2026.11.29`.
3344
+
3345
+ **Request:** "fix MemoryRouter capture so only the main chat is saved" - subagent, cron, hook and swarm-member runs were writing their working text into John's vault.
3346
+
3347
+ **Before:** `mr-memory`'s `agent_end` hook stored the last user+assistant exchange of **every** run the harness executes. Its only guards were `isReadOnlyAgent` (agent-scoped) and the auto-consolidation session, and subagents, cron jobs, hooks and swarm members all run as the same agent id in the same workspace, so neither guard could separate them. A second gap: `stripSystemPrefixes` removed the `^[cron:…]` marker *before* `isSystemNoise` ran, so a scheduled task prompt was stored as a clean user turn with its only identifying text deleted. The plugin's own README claimed the exclusion already existed.
3348
+
3349
+ **Change:**
3350
+ - `isNonPrimarySession(sessionKey)` (exported, next to `isReadOnlyAgent`) accepts only `agent:<id>:main`. `agent_end` returns before `resolveKey`, so nothing else reaches the vault.
3351
+ - The user-message noise check now runs on the raw text before the prefix strip (`isSystemNoise(userText) ? "" : stripSystemPrefixes(userText)`), so a `[cron:…]` prompt is skipped instead of being laundered.
3352
+ - **Reads are untouched.** Both `before_prompt_build` hooks and every `prepareMemory` call are unchanged: subagents and crons still receive vault context. Only the write path is scoped. `readOnlyAgents` behaviour and every other plugin feature are unchanged.
3353
+
3354
+ **Delivery, two halves.** Shipping a fixed bundled copy is not enough, because an existing `<state>/extensions/mr-memory` install stays authoritative over the bundled copy (family 59) and `updateNpmInstalledPlugins` only ever reinstalls the exact pinned npm spec, with its recorded integrity. So:
3355
+ - `vendor/patched-deps/mr-memory/index.js` carries the fixed 3.13.2 package (the same version `postinstall` already patches and `adaptPluginDirectory` already adapts), so every fresh install and upgrade gets it.
3356
+ - `dist/update-command.js` gains `applyPrimarySessionCaptureFix`, which `/update` runs **after a successful install and before the restart**. It ports the same three edits into `<state>/extensions/mr-memory/index.js` in place, keeping whatever else that copy carries (today: a hand-backported `readOnlyAgents` guard), writes a `.pre-JOHNNESS_PATCH_PRIMARY_SESSION_CAPTURE_100.bak` first, and is idempotent (the marker makes the second run a no-op). Anchors are code, not formatting, so a reformatted copy still patches; if an anchor is missing or ambiguous the step **skips and logs** - it never guesses and never fails the update.
3357
+ - The same `/update` step adds the missing `"kind": "memory"` to the installed copy's `johnness.plugin.json`, so the memory slot matches without a per-deployment manifest edit (the bundled `extensions/mr-memory/johnness.plugin.json` already declared it). The field is additive: the rest of the manifest is preserved and the adapter leaves the file alone.
3358
+
3359
+ **Tests:** `tests/primary-session-capture-100.test.mjs` (6): the vendored file carries three marked edits with the guard inside `agent_end` and nothing in the read path; the vendored package boots and, across five session keys, prepares five times but ingests once (`agent:main:main` only); `/update` patches a pristine 3.13.2 copy that carries an extra `readOnlyAgents` guard, keeps that guard, backs the file up and is idempotent; a drifted copy is skipped untouched and a missing copy is a no-op; the installed copy gains `kind: memory` with the rest of its manifest intact and the adapter is left with nothing to rewrite; and `/update` calls the fix between the install and the restart.
3360
+
3361
+ **Replay:** `scripts/patch-primary-session-capture-100.py` (`--check` read-only) replays the `dist/update-command.js` half from exact anchors, all-or-nothing; the 9.17 reconstruction in `tests/volume-update-safety.test.mjs` layers it after families 76/79/89/95 so the chain still reaches the current bytes. The vendored plugin file ships as an artifact beside `vendor/patched-deps/mr-memory/upload.js`.
3362
+
3363
+ **Verifier:** checks 100.1 to 100.7.
3364
+
3365
+ **Rollback:** `npm i -g johns-harness@2026.11.23`. A state-dir copy already patched by `/update` keeps working: the change is additive, and `<state>/extensions/mr-memory/index.js.pre-JOHNNESS_PATCH_PRIMARY_SESSION_CAPTURE_100.bak` restores the previous file byte for byte.
@@ -480,8 +480,8 @@
480
480
  "gpt-image-2.6-flare": {"name":"GPT Image 2.6 Flare (Codex)","api":"openai-codex-responses","baseUrl":"https://chatgpt.com/backend-api","reasoning":false,"input":["text","image"],"output":["image"],"imageGeneration":true,"imageEditing":true,"chat":false,"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0},"contextWindow":null,"maxTokens":null,"harness":{"source":"https://developers.openai.com/api/docs/models/gpt-image-2.6-flare ; https://developers.openai.com/api/docs/pricing#image-generation ; https://developers.openai.com/api/docs/guides/image-generation#gpt-image-26 ; https://developers.openai.com/api/reference/resources/images/methods/generate ; https://developers.openai.com/api/reference/resources/images/methods/edit ; https://developers.openai.com/api/docs/changelog","checked":"2026-11-05","notes":"Released 2026-11-04. Dedicated Images generations/edits only, not chat/Responses; context/output token ceilings and knowledge cutoff unpublished (null = N/A). Complexity low/medium/high, default high, is separate from rendering quality; harness omits complexity and uses provider default. Quality low/medium/high/xhigh/max/auto per official guide cost calculator. Harness exposes PNG generation and multipart image/mask edits, 1..4 outputs, up to 4 input images and 20MiB per local input; API documents up to 10 outputs, 16 edit inputs, 32000-character prompts. Conservative harness size allowlist: 1024x1024, 1536x1024, 1024x1536, auto. New 2.6 custom-dimension native bounds are not explicitly documented; do not infer 2.5 limits. SVG/GIF/markup and explicit complexity controls advertised by API are not exposed by harness. Generations LIVE HTTP200 via repo subscription transport on 2026-11-05: requested 1024x1024 low quality, both returned 1536x1024 PNGs (provider size deviation, not exact-size acceptance). Harness passes size unchanged and does not resize output. Edits/API wire validated offline only, no paid API inference. ChatGPT/Codex subscription usage, zero marginal per-token API cost.","image":{"transport":"openai","qualities":["low","medium","high","xhigh","max","auto"],"customSizes":false,"maxImages":4,"maxPromptLength":32000,"mask":true}}},
481
481
  "gpt-image-2.5-sunburst": {"name":"GPT Image 2.5 Sunburst (Codex)","api":"openai-codex-responses","baseUrl":"https://chatgpt.com/backend-api","reasoning":false,"input":["text","image"],"output":["image"],"imageGeneration":true,"imageEditing":true,"chat":false,"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0},"contextWindow":null,"maxTokens":null,"harness":{"source":"https://developers.openai.com/api/docs/models/gpt-image-2.5-sunburst ; https://developers.openai.com/api/docs/guides/image-generation ; Models API GET 200; Codex image generations LIVE 200 with xhigh quality (no API fallback).","checked":"2026-10-12","notes":"Released 2026-09-08. Dedicated images generations/edits only, not chat; context/output token ceilings and knowledge cutoff not published (null = N/A). ChatGPT/Codex subscription usage, no per-token API bill. Quality low/medium/high/xhigh/max/auto; custom sizes multiples of 16, 1:3..3:1, edges <=3840, pixels 655360..8294400; >2560x1440 experimental. Per-image price varies with dimensions/quality; see official card. Transport preserves old multipart edits and mask.","image":{"transport":"openai","qualities":["low","medium","high","xhigh","max","auto"],"customSizes":true,"maxImages":4,"mask":true}}},
482
482
  "gpt-image-2.5-flare": {"name":"GPT Image 2.5 Flare (Codex)","api":"openai-codex-responses","baseUrl":"https://chatgpt.com/backend-api","reasoning":false,"input":["text","image"],"output":["image"],"imageGeneration":true,"imageEditing":true,"chat":false,"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0},"contextWindow":null,"maxTokens":null,"harness":{"source":"https://developers.openai.com/api/docs/models/gpt-image-2.5-flare ; https://developers.openai.com/api/docs/guides/image-generation ; Models API GET 200; Codex image generations LIVE 200 with max quality (no API fallback).","checked":"2026-10-12","notes":"Released 2026-09-08. Dedicated images generations/edits only, not chat; context/output token ceilings and knowledge cutoff not published (null = N/A). ChatGPT/Codex subscription usage, no per-token API bill. Quality low/medium/high/xhigh/max/auto; custom sizes multiples of 16, 1:3..3:1, edges <=3840, pixels 655360..8294400; >2560x1440 experimental. Per-image price varies with dimensions/quality; see official card. Transport preserves old multipart edits and mask.","image":{"transport":"openai","qualities":["low","medium","high","xhigh","max","auto"],"customSizes":true,"maxImages":4,"mask":true}}},
483
- "gpt-6.2-astra": {"name":"GPT-6.2 Astra","api":"openai-codex-responses","baseUrl":"https://chatgpt.com/backend-api","reasoning":true,"input":["text","image"],"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0},"contextWindow":272000,"maxTokens":128000,"harness":{"xhigh":true,"efforts":["low","medium","high","xhigh","max"],"temperature":"drop","responses":{"instructions":"developer-first","logprobs":"drop","reasoning":"encrypted"},"nativeContextWindow":1050000,"maxInputTokens":922000,"knowledgeCutoff":"2026-05-18","checked":"2026-11-18","source":"https://developers.openai.com/api/docs/models/gpt-6.2-astra ; https://developers.openai.com/api/docs/pricing ; https://developers.openai.com/api/docs/guides/latest-model ; https://developers.openai.com/api/docs/guides/prompt-caching ; https://developers.openai.com/api/docs/guides/keep-prefix-unchanged ; https://openai.com/index/introducing-gpt-6-2-astra-sol/ ; https://raw.githubusercontent.com/openai/codex/4389a526d51a5a7600e0648436a7142a304f0188/codex-rs/models-manager/models.json","notes":"GA 2026-11-17. API Responses required for tools; text/image input, text output. API window1050000, max input922000, max output128000. Reasoning low/medium/high/xhigh/max; none/minimal map low; omitted uses provider default. Sampling/logprobs unsupported. Stable system is first developer input; subscription empty instructions retained for gateway compatibility. Stateless encrypted reasoning replay is preserved. Prefix edits (including changing system/tools, harness truncation or custom compaction) may cause server to drop later reasoning. No append-only configuration updates, native compaction, ultra delegation, background or new service-tier transport is implemented. Subscription omits prompt_cache_options and prompt_cache_retention (backend rejects the former); retains prompt_cache_key/session affinity. Backend controls cache lifetime; cacheRetention is not exposed by the subscription adapter. Flat cost is Standard <=272K input; >272K input/cache prices2x and output1.5x. 12h write2.5x input versus30m1.25x; writes replace input rate, not additive. Cache/tier billing is an estimate; existing Responses usage accounting does not distinguish cache-write tokens. Batch0.5x, Fast2x; Ultrafast3x through2027-02-28 then6x from2027-03-01 Pacific. Eligible background2h/8h30%/40% below Standard, not implemented. Regional processing10% uplift; US/EU Standard/Fast/Batch, Ultrafast US only. No existing sibling prices changed. Codex default window272000 from pinned models metadata, default effort low. Native max_context_window872000 not enabled. Plus/Pro/Enterprise/Edu subscription access; marginal API token prices0, plan limits apply."}},
484
- "gpt-6.2-sol": {"name":"GPT-6.2 Sol","api":"openai-codex-responses","baseUrl":"https://chatgpt.com/backend-api","reasoning":true,"input":["text","image"],"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0},"contextWindow":500000,"maxTokens":128000,"harness":{"xhigh":true,"efforts":["low","medium","high","xhigh","max"],"temperature":"drop","responses":{"instructions":"developer-first","logprobs":"drop","reasoning":"encrypted"},"nativeContextWindow":1050000,"maxInputTokens":922000,"knowledgeCutoff":"2026-06-01","checked":"2026-11-18","source":"https://developers.openai.com/api/docs/models/gpt-6.2-sol ; https://developers.openai.com/api/docs/pricing ; https://developers.openai.com/api/docs/guides/latest-model ; https://developers.openai.com/api/docs/guides/prompt-caching ; https://developers.openai.com/api/docs/guides/keep-prefix-unchanged ; https://openai.com/index/introducing-gpt-6-2-astra-sol/ ; https://raw.githubusercontent.com/openai/codex/4389a526d51a5a7600e0648436a7142a304f0188/codex-rs/models-manager/models.json","notes":"GA 2026-11-17. API Responses required for tools; text/image input, text output. API window1050000, max input922000, max output128000. Reasoning low/medium/high/xhigh/max; none/minimal map low; omitted uses provider default. Sampling/logprobs unsupported. Stable system is first developer input; subscription empty instructions retained for gateway compatibility. Stateless encrypted reasoning replay is preserved. Prefix edits (including changing system/tools, harness truncation or custom compaction) may cause server to drop later reasoning. No append-only configuration updates, native compaction, ultra delegation, background or new service-tier transport is implemented. Subscription omits prompt_cache_options and prompt_cache_retention (backend rejects the former); retains prompt_cache_key/session affinity. Backend controls cache lifetime; cacheRetention is not exposed by the subscription adapter. Flat cost is Standard <=272K input; >272K input/cache prices2x and output1.5x. 12h write2.5x input versus30m1.25x; writes replace input rate, not additive. Cache/tier billing is an estimate; existing Responses usage accounting does not distinguish cache-write tokens. Batch0.5x, Fast2x; Ultrafast3x through2027-02-28 then6x from2027-03-01 Pacific. Eligible background2h/8h30%/40% below Standard, not implemented. Regional processing10% uplift; US/EU Standard/Fast/Batch, Ultrafast US only. No existing sibling prices changed. Codex default window500000 from pinned models metadata, default effort low. Native max_context_window872000 not enabled. Plus/Pro/Enterprise/Edu subscription access; marginal API token prices0, plan limits apply."}},
483
+ "gpt-6.2-astra": {"name":"GPT-6.2 Astra","api":"openai-codex-responses","baseUrl":"https://chatgpt.com/backend-api","reasoning":true,"input":["text","image"],"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0},"contextWindow":1000000,"maxTokens":128000,"harness":{"xhigh":true,"efforts":["low","medium","high","xhigh","max"],"temperature":"drop","responses":{"instructions":"developer-first","logprobs":"drop","reasoning":"encrypted"},"nativeContextWindow":1050000,"maxInputTokens":922000,"knowledgeCutoff":"2026-05-18","checked":"2026-11-18","source":"https://developers.openai.com/api/docs/models/gpt-6.2-astra ; https://developers.openai.com/api/docs/pricing ; https://developers.openai.com/api/docs/guides/latest-model ; https://developers.openai.com/api/docs/guides/prompt-caching ; https://developers.openai.com/api/docs/guides/keep-prefix-unchanged ; https://openai.com/index/introducing-gpt-6-2-astra-sol/ ; https://raw.githubusercontent.com/openai/codex/4389a526d51a5a7600e0648436a7142a304f0188/codex-rs/models-manager/models.json","notes":"GA 2026-11-17. API Responses required for tools; text/image input, text output. API window1050000, max input922000, max output128000. Reasoning low/medium/high/xhigh/max; none/minimal map low; omitted uses provider default. Sampling/logprobs unsupported. Stable system is first developer input; subscription empty instructions retained for gateway compatibility. Stateless encrypted reasoning replay is preserved. Prefix edits (including changing system/tools, harness truncation or custom compaction) may cause server to drop later reasoning. No append-only configuration updates, native compaction, ultra delegation, background or new service-tier transport is implemented. Subscription omits prompt_cache_options and prompt_cache_retention (backend rejects the former); retains prompt_cache_key/session affinity. Backend controls cache lifetime; cacheRetention is not exposed by the subscription adapter. Flat cost is Standard <=272K input; >272K input/cache prices2x and output1.5x. 12h write2.5x input versus30m1.25x; writes replace input rate, not additive. Cache/tier billing is an estimate; existing Responses usage accounting does not distinguish cache-write tokens. Batch0.5x, Fast2x; Ultrafast3x through2027-02-28 then6x from2027-03-01 Pacific. Eligible background2h/8h30%/40% below Standard, not implemented. Regional processing10% uplift; US/EU Standard/Fast/Batch, Ultrafast US only. No existing sibling prices changed. Codex default window272000 from pinned models metadata, default effort low. Pinned native max_context_window872000. Local harness budget1000000 by owner request; subscription acceptance at this size is unverified. Plus/Pro/Enterprise/Edu subscription access; marginal API token prices0, plan limits apply."}},
484
+ "gpt-6.2-sol": {"name":"GPT-6.2 Sol","api":"openai-codex-responses","baseUrl":"https://chatgpt.com/backend-api","reasoning":true,"input":["text","image"],"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0},"contextWindow":1000000,"maxTokens":128000,"harness":{"xhigh":true,"efforts":["low","medium","high","xhigh","max"],"temperature":"drop","responses":{"instructions":"developer-first","logprobs":"drop","reasoning":"encrypted"},"nativeContextWindow":1050000,"maxInputTokens":922000,"knowledgeCutoff":"2026-06-01","checked":"2026-11-18","source":"https://developers.openai.com/api/docs/models/gpt-6.2-sol ; https://developers.openai.com/api/docs/pricing ; https://developers.openai.com/api/docs/guides/latest-model ; https://developers.openai.com/api/docs/guides/prompt-caching ; https://developers.openai.com/api/docs/guides/keep-prefix-unchanged ; https://openai.com/index/introducing-gpt-6-2-astra-sol/ ; https://raw.githubusercontent.com/openai/codex/4389a526d51a5a7600e0648436a7142a304f0188/codex-rs/models-manager/models.json","notes":"GA 2026-11-17. API Responses required for tools; text/image input, text output. API window1050000, max input922000, max output128000. Reasoning low/medium/high/xhigh/max; none/minimal map low; omitted uses provider default. Sampling/logprobs unsupported. Stable system is first developer input; subscription empty instructions retained for gateway compatibility. Stateless encrypted reasoning replay is preserved. Prefix edits (including changing system/tools, harness truncation or custom compaction) may cause server to drop later reasoning. No append-only configuration updates, native compaction, ultra delegation, background or new service-tier transport is implemented. Subscription omits prompt_cache_options and prompt_cache_retention (backend rejects the former); retains prompt_cache_key/session affinity. Backend controls cache lifetime; cacheRetention is not exposed by the subscription adapter. Flat cost is Standard <=272K input; >272K input/cache prices2x and output1.5x. 12h write2.5x input versus30m1.25x; writes replace input rate, not additive. Cache/tier billing is an estimate; existing Responses usage accounting does not distinguish cache-write tokens. Batch0.5x, Fast2x; Ultrafast3x through2027-02-28 then6x from2027-03-01 Pacific. Eligible background2h/8h30%/40% below Standard, not implemented. Regional processing10% uplift; US/EU Standard/Fast/Batch, Ultrafast US only. No existing sibling prices changed. Codex default window500000 from pinned models metadata, default effort low. Pinned native max_context_window872000. Local harness budget1000000 by owner request; subscription acceptance at this size is unverified. Plus/Pro/Enterprise/Edu subscription access; marginal API token prices0, plan limits apply."}},
485
485
  "gpt-6-astra": {"name":"GPT-6 Astra","api":"openai-codex-responses","baseUrl":"https://chatgpt.com/backend-api","reasoning":true,"input":["text","image"],"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0},"contextWindow":272000,"maxTokens":128000,"harness":{"xhigh":true,"efforts":["low","medium","high","xhigh","max"],"temperature":"drop","nativeContextWindow":1050000}},
486
486
  "gpt-5.5": {"name":"GPT-5.5 (Codex)","api":"openai-codex-responses","baseUrl":"https://chatgpt.com/backend-api","reasoning":true,"input":["text","image"],"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0},"contextWindow":272000,"maxTokens":128000},
487
487
  "gpt-5.6-sol": {"name":"GPT-5.6 Sol (Codex)","api":"openai-codex-responses","baseUrl":"https://chatgpt.com/backend-api","reasoning":true,"input":["text","image"],"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0},"contextWindow":272000,"maxTokens":128000,"harness":{"xhigh":true,"temperature":"drop-unless-effort-none","nativeContextWindow":1050000}},
@@ -14060,8 +14060,8 @@ const JOHNNESS_MODELS_MASTER = {
14060
14060
  "gpt-image-2.6-flare":{"id":"gpt-image-2.6-flare","name":"GPT Image 2.6 Flare (Codex)","api":"openai-codex-responses","provider":"openai-codex","baseUrl":"https://chatgpt.com/backend-api","reasoning":false,"input":["text","image"],"output":["image"],"imageGeneration":true,"imageEditing":true,"chat":false,"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0}},
14061
14061
  "gpt-image-2.5-sunburst":{"id":"gpt-image-2.5-sunburst","name":"GPT Image 2.5 Sunburst (Codex)","api":"openai-codex-responses","provider":"openai-codex","baseUrl":"https://chatgpt.com/backend-api","reasoning":false,"input":["text","image"],"output":["image"],"imageGeneration":true,"imageEditing":true,"chat":false,"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0}},
14062
14062
  "gpt-image-2.5-flare":{"id":"gpt-image-2.5-flare","name":"GPT Image 2.5 Flare (Codex)","api":"openai-codex-responses","provider":"openai-codex","baseUrl":"https://chatgpt.com/backend-api","reasoning":false,"input":["text","image"],"output":["image"],"imageGeneration":true,"imageEditing":true,"chat":false,"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0}},
14063
- "gpt-6.2-astra":{"id":"gpt-6.2-astra","name":"GPT-6.2 Astra","api":"openai-codex-responses","provider":"openai-codex","baseUrl":"https://chatgpt.com/backend-api","reasoning":true,"input":["text","image"],"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0},"contextWindow":272000,"maxTokens":128000},
14064
- "gpt-6.2-sol":{"id":"gpt-6.2-sol","name":"GPT-6.2 Sol","api":"openai-codex-responses","provider":"openai-codex","baseUrl":"https://chatgpt.com/backend-api","reasoning":true,"input":["text","image"],"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0},"contextWindow":500000,"maxTokens":128000},
14063
+ "gpt-6.2-astra":{"id":"gpt-6.2-astra","name":"GPT-6.2 Astra","api":"openai-codex-responses","provider":"openai-codex","baseUrl":"https://chatgpt.com/backend-api","reasoning":true,"input":["text","image"],"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0},"contextWindow":1000000,"maxTokens":128000},
14064
+ "gpt-6.2-sol":{"id":"gpt-6.2-sol","name":"GPT-6.2 Sol","api":"openai-codex-responses","provider":"openai-codex","baseUrl":"https://chatgpt.com/backend-api","reasoning":true,"input":["text","image"],"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0},"contextWindow":1000000,"maxTokens":128000},
14065
14065
  "gpt-6-astra":{"id":"gpt-6-astra","name":"GPT-6 Astra","api":"openai-codex-responses","provider":"openai-codex","baseUrl":"https://chatgpt.com/backend-api","reasoning":true,"input":["text","image"],"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0},"contextWindow":272000,"maxTokens":128000},
14066
14066
  "gpt-5.5":{"id":"gpt-5.5","name":"GPT-5.5 (Codex)","api":"openai-codex-responses","provider":"openai-codex","baseUrl":"https://chatgpt.com/backend-api","reasoning":true,"input":["text","image"],"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0},"contextWindow":272000,"maxTokens":128000},
14067
14067
  "gpt-5.6-sol":{"id":"gpt-5.6-sol","name":"GPT-5.6 Sol (Codex)","api":"openai-codex-responses","provider":"openai-codex","baseUrl":"https://chatgpt.com/backend-api","reasoning":true,"input":["text","image"],"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0},"contextWindow":272000,"maxTokens":128000},
@@ -258,6 +258,17 @@ function sanitizeForIngest(text) {
258
258
  return cleaned;
259
259
  }
260
260
  /** Check if a message is system noise that should not be stored */
261
+ /** JOHNNESS_PATCH_PRIMARY_SESSION_CAPTURE_100: only the primary chat session (agent:<id>:main) is a real
262
+ * conversation with the user. Subagent, cron, hook and swarm-member runs share
263
+ * the same agent id and workspace, so an agent-scoped filter cannot separate
264
+ * them. Retrieval/injection are untouched: every session still reads the
265
+ * vault, only the write path is limited. */
266
+ export function isNonPrimarySession(sessionKey) {
267
+ const k = typeof sessionKey === "string" ? sessionKey.trim().toLowerCase() : "";
268
+ if (!k)
269
+ return false;
270
+ return !/^agent:[a-z0-9._-]+:main$/.test(k);
271
+ }
261
272
  function isSystemNoise(text) {
262
273
  const trimmed = text.trim();
263
274
  if (!trimmed)
@@ -926,6 +937,9 @@ If setting up MemoryRouter for another agent:
926
937
  // Core: agent_end — store this turn's conversation
927
938
  // ==================================================================
928
939
  api.on("agent_end", async (event, ctx) => {
940
+ // JOHNNESS_PATCH_PRIMARY_SESSION_CAPTURE_100: store only the primary chat session.
941
+ if (isNonPrimarySession(ctx?.sessionKey))
942
+ return;
929
943
  // Never store the auto-consolidation session's own chatter as memory.
930
944
  if (isAutoConsolidationSession(ctx?.sessionKey))
931
945
  return;
@@ -969,7 +983,9 @@ If setting up MemoryRouter for another agent:
969
983
  userText = sanitizeForIngest(stripMediaReferences(userText));
970
984
  if (userText) {
971
985
  // Strip cron/system prefixes but keep the task content for storage
972
- const taskText = stripSystemPrefixes(userText);
986
+ // JOHNNESS_PATCH_PRIMARY_SESSION_CAPTURE_100: a [cron:...] prompt is noise; stripping the prefix first
987
+ // would delete the only marker and store it as a user turn.
988
+ const taskText = isSystemNoise(userText) ? "" : stripSystemPrefixes(userText);
973
989
  if (taskText && !isSystemNoise(taskText)) {
974
990
  toStore.push({ role: "user", content: taskText });
975
991
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "johns-harness",
3
- "version": "2026.11.23",
3
+ "version": "2026.11.30",
4
4
  "description": "John's Harness: a production agent harness that runs autonomous coding agents as one cooperative swarm.",
5
5
  "keywords": [
6
6
  "ai-agents",
@@ -14060,8 +14060,8 @@ const JOHNNESS_MODELS_MASTER = {
14060
14060
  "gpt-image-2.6-flare":{"id":"gpt-image-2.6-flare","name":"GPT Image 2.6 Flare (Codex)","api":"openai-codex-responses","provider":"openai-codex","baseUrl":"https://chatgpt.com/backend-api","reasoning":false,"input":["text","image"],"output":["image"],"imageGeneration":true,"imageEditing":true,"chat":false,"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0}},
14061
14061
  "gpt-image-2.5-sunburst":{"id":"gpt-image-2.5-sunburst","name":"GPT Image 2.5 Sunburst (Codex)","api":"openai-codex-responses","provider":"openai-codex","baseUrl":"https://chatgpt.com/backend-api","reasoning":false,"input":["text","image"],"output":["image"],"imageGeneration":true,"imageEditing":true,"chat":false,"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0}},
14062
14062
  "gpt-image-2.5-flare":{"id":"gpt-image-2.5-flare","name":"GPT Image 2.5 Flare (Codex)","api":"openai-codex-responses","provider":"openai-codex","baseUrl":"https://chatgpt.com/backend-api","reasoning":false,"input":["text","image"],"output":["image"],"imageGeneration":true,"imageEditing":true,"chat":false,"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0}},
14063
- "gpt-6.2-astra":{"id":"gpt-6.2-astra","name":"GPT-6.2 Astra","api":"openai-codex-responses","provider":"openai-codex","baseUrl":"https://chatgpt.com/backend-api","reasoning":true,"input":["text","image"],"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0},"contextWindow":272000,"maxTokens":128000},
14064
- "gpt-6.2-sol":{"id":"gpt-6.2-sol","name":"GPT-6.2 Sol","api":"openai-codex-responses","provider":"openai-codex","baseUrl":"https://chatgpt.com/backend-api","reasoning":true,"input":["text","image"],"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0},"contextWindow":500000,"maxTokens":128000},
14063
+ "gpt-6.2-astra":{"id":"gpt-6.2-astra","name":"GPT-6.2 Astra","api":"openai-codex-responses","provider":"openai-codex","baseUrl":"https://chatgpt.com/backend-api","reasoning":true,"input":["text","image"],"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0},"contextWindow":1000000,"maxTokens":128000},
14064
+ "gpt-6.2-sol":{"id":"gpt-6.2-sol","name":"GPT-6.2 Sol","api":"openai-codex-responses","provider":"openai-codex","baseUrl":"https://chatgpt.com/backend-api","reasoning":true,"input":["text","image"],"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0},"contextWindow":1000000,"maxTokens":128000},
14065
14065
  "gpt-6-astra":{"id":"gpt-6-astra","name":"GPT-6 Astra","api":"openai-codex-responses","provider":"openai-codex","baseUrl":"https://chatgpt.com/backend-api","reasoning":true,"input":["text","image"],"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0},"contextWindow":272000,"maxTokens":128000},
14066
14066
  "gpt-5.5":{"id":"gpt-5.5","name":"GPT-5.5 (Codex)","api":"openai-codex-responses","provider":"openai-codex","baseUrl":"https://chatgpt.com/backend-api","reasoning":true,"input":["text","image"],"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0},"contextWindow":272000,"maxTokens":128000},
14067
14067
  "gpt-5.6-sol":{"id":"gpt-5.6-sol","name":"GPT-5.6 Sol (Codex)","api":"openai-codex-responses","provider":"openai-codex","baseUrl":"https://chatgpt.com/backend-api","reasoning":true,"input":["text","image"],"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0},"contextWindow":272000,"maxTokens":128000},