waypoint-codex 0.1.9 → 0.1.11
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/package.json
CHANGED
|
@@ -2,9 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
This repository uses Waypoint as its operating system for Codex.
|
|
4
4
|
|
|
5
|
+
If the repo needs custom AGENTS guidance, write it outside the managed `waypoint:start/end` block in `AGENTS.md`. Treat the managed block as Waypoint-owned and replaceable.
|
|
6
|
+
|
|
5
7
|
## Session start
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
Run the Waypoint bootstrap only:
|
|
10
|
+
|
|
11
|
+
- at the start of every new session
|
|
12
|
+
- immediately after a compaction
|
|
13
|
+
- when the user explicitly asks for a rerun
|
|
14
|
+
|
|
15
|
+
Bootstrap sequence:
|
|
8
16
|
|
|
9
17
|
1. Run `node .waypoint/scripts/prepare-context.mjs`
|
|
10
18
|
2. Read `.waypoint/SOUL.md`
|
|
@@ -15,9 +23,10 @@ At the start of every session:
|
|
|
15
23
|
|
|
16
24
|
Do not skip this sequence.
|
|
17
25
|
|
|
18
|
-
- Do not
|
|
19
|
-
-
|
|
20
|
-
-
|
|
26
|
+
- Do not skip it at new-session start or after compaction.
|
|
27
|
+
- Do not rerun it mid-conversation just because a task becomes more substantial.
|
|
28
|
+
- Earlier chat context or partial memory from the current session does not count as a substitute when a new session starts or a compaction happens.
|
|
29
|
+
- If you are unsure whether a new session started or a compaction happened, rerun it instead of guessing.
|
|
21
30
|
|
|
22
31
|
## Repository memory model
|
|
23
32
|
|
|
@@ -213,7 +213,9 @@ function mergeConsecutiveTurns(turns) {
|
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
function parseSession(sessionFile, projectRoot) {
|
|
216
|
+
let sessionId = null;
|
|
216
217
|
let sessionCwd = null;
|
|
218
|
+
let sessionStartedAt = null;
|
|
217
219
|
let compactionCount = 0;
|
|
218
220
|
const rawTurns = [];
|
|
219
221
|
const compactionBoundaries = [];
|
|
@@ -231,10 +233,18 @@ function parseSession(sessionFile, projectRoot) {
|
|
|
231
233
|
}
|
|
232
234
|
|
|
233
235
|
if (parsed.type === "session_meta") {
|
|
236
|
+
const sessionMetaId = parsed.payload?.id;
|
|
237
|
+
if (typeof sessionMetaId === "string") {
|
|
238
|
+
sessionId = sessionMetaId;
|
|
239
|
+
}
|
|
234
240
|
const cwd = parsed.payload?.cwd;
|
|
235
241
|
if (typeof cwd === "string") {
|
|
236
242
|
sessionCwd = cwd;
|
|
237
243
|
}
|
|
244
|
+
const timestamp = parsed.payload?.timestamp;
|
|
245
|
+
if (typeof timestamp === "string") {
|
|
246
|
+
sessionStartedAt = timestamp;
|
|
247
|
+
}
|
|
238
248
|
continue;
|
|
239
249
|
}
|
|
240
250
|
|
|
@@ -279,14 +289,16 @@ function parseSession(sessionFile, projectRoot) {
|
|
|
279
289
|
|
|
280
290
|
return {
|
|
281
291
|
path: sessionFile,
|
|
292
|
+
sessionId,
|
|
282
293
|
sessionCwd,
|
|
283
294
|
turns,
|
|
284
295
|
compactionCount,
|
|
285
296
|
selectedFromPreCompaction,
|
|
297
|
+
sessionStartedAt,
|
|
286
298
|
};
|
|
287
299
|
}
|
|
288
300
|
|
|
289
|
-
function latestMatchingSession(projectRoot) {
|
|
301
|
+
function latestMatchingSession(projectRoot, threadIdOverride = null) {
|
|
290
302
|
const matches = [];
|
|
291
303
|
for (const dirName of SESSION_DIR_NAMES) {
|
|
292
304
|
for (const sessionFile of collectSessionFiles(path.join(codexHome(), dirName))) {
|
|
@@ -297,13 +309,28 @@ function latestMatchingSession(projectRoot) {
|
|
|
297
309
|
}
|
|
298
310
|
}
|
|
299
311
|
|
|
300
|
-
|
|
312
|
+
const requestedThreadId = threadIdOverride || process.env.CODEX_THREAD_ID || null;
|
|
313
|
+
if (requestedThreadId) {
|
|
314
|
+
const exact = matches.find((item) => item.sessionId === requestedThreadId);
|
|
315
|
+
if (exact) {
|
|
316
|
+
return exact;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
matches.sort((a, b) => {
|
|
321
|
+
const left = a.sessionStartedAt || "";
|
|
322
|
+
const right = b.sessionStartedAt || "";
|
|
323
|
+
if (left === right) {
|
|
324
|
+
return b.path.localeCompare(a.path);
|
|
325
|
+
}
|
|
326
|
+
return right.localeCompare(left);
|
|
327
|
+
});
|
|
301
328
|
return matches[0] || null;
|
|
302
329
|
}
|
|
303
330
|
|
|
304
|
-
function writeRecentThread(contextDir, projectRoot) {
|
|
331
|
+
function writeRecentThread(contextDir, projectRoot, threadIdOverride = null) {
|
|
305
332
|
const filePath = path.join(contextDir, "RECENT_THREAD.md");
|
|
306
|
-
const snapshot = latestMatchingSession(projectRoot);
|
|
333
|
+
const snapshot = latestMatchingSession(projectRoot, threadIdOverride);
|
|
307
334
|
const generatedAt = new Date().toString();
|
|
308
335
|
|
|
309
336
|
if (!snapshot) {
|
|
@@ -414,6 +441,11 @@ function main() {
|
|
|
414
441
|
const projectRoot = detectProjectRoot();
|
|
415
442
|
const contextDir = path.join(projectRoot, ".waypoint", "context");
|
|
416
443
|
ensureDir(contextDir);
|
|
444
|
+
const threadIdFlagIndex = process.argv.indexOf("--thread-id");
|
|
445
|
+
const threadIdOverride =
|
|
446
|
+
threadIdFlagIndex >= 0 && threadIdFlagIndex + 1 < process.argv.length
|
|
447
|
+
? process.argv[threadIdFlagIndex + 1]
|
|
448
|
+
: null;
|
|
417
449
|
|
|
418
450
|
const docsIndexPath = writeDocsIndex(projectRoot);
|
|
419
451
|
|
|
@@ -557,7 +589,7 @@ function main() {
|
|
|
557
589
|
"```",
|
|
558
590
|
].join("\n")
|
|
559
591
|
);
|
|
560
|
-
const recentThreadPath = writeRecentThread(contextDir, projectRoot);
|
|
592
|
+
const recentThreadPath = writeRecentThread(contextDir, projectRoot, threadIdOverride);
|
|
561
593
|
|
|
562
594
|
const manifestPath = path.join(contextDir, "MANIFEST.md");
|
|
563
595
|
const manifestLines = [
|
|
@@ -3,9 +3,18 @@
|
|
|
3
3
|
|
|
4
4
|
This repository uses Waypoint as its Codex operating system.
|
|
5
5
|
|
|
6
|
+
Waypoint owns only the text inside these `waypoint:start/end` markers.
|
|
7
|
+
If you need repo-specific AGENTS instructions, write them outside this managed block.
|
|
8
|
+
Do not put durable repo guidance inside the managed block, because `waypoint init` may replace it during upgrades.
|
|
9
|
+
|
|
6
10
|
Stop here if the bootstrap has not been run yet.
|
|
7
11
|
|
|
8
|
-
|
|
12
|
+
Run the Waypoint bootstrap only in these cases:
|
|
13
|
+
- at the start of a new session
|
|
14
|
+
- immediately after a compaction
|
|
15
|
+
- if the user explicitly tells you to rerun it
|
|
16
|
+
|
|
17
|
+
Bootstrap sequence:
|
|
9
18
|
1. Run `node .waypoint/scripts/prepare-context.mjs`
|
|
10
19
|
2. Read `.waypoint/SOUL.md`
|
|
11
20
|
3. Read `.waypoint/agent-operating-manual.md`
|
|
@@ -15,9 +24,10 @@ Before doing substantial work:
|
|
|
15
24
|
|
|
16
25
|
This is mandatory, not optional.
|
|
17
26
|
|
|
18
|
-
- Do not
|
|
19
|
-
-
|
|
20
|
-
-
|
|
27
|
+
- Do not skip it at session start or after compaction.
|
|
28
|
+
- Do not rerun it mid-conversation just because a task is substantial.
|
|
29
|
+
- Earlier chat context or earlier work in the session does not replace the bootstrap when a new session starts or a compaction happens.
|
|
30
|
+
- If you are not sure whether a new session started or a compaction happened, rerun it.
|
|
21
31
|
- Do not skip the context refresh or skip files in the manifest.
|
|
22
32
|
|
|
23
33
|
Working rules:
|