Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ CLAUDE.md
CLAUDE.local.md
AI_REVIEW.local.md

# Internal AI / review artifacts should stay local-only
AGENTS.md
CHANGELOG.md
Copy link

@cubic-dev-ai cubic-dev-ai bot Mar 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: CHANGELOG.md is a standard project-level file name that most release tooling and contributors expect to be tracked. The other entries in this block are clearly internal artifacts, but gitignoring CHANGELOG.md will silently prevent any future public changelog from being committed. Consider using a more specific name for the internal artifact (e.g., AI_CHANGELOG.md) or removing this entry now that the internal file is already purged from history.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .gitignore, line 30:

<comment>`CHANGELOG.md` is a standard project-level file name that most release tooling and contributors expect to be tracked. The other entries in this block are clearly internal artifacts, but gitignoring `CHANGELOG.md` will silently prevent any future public changelog from being committed. Consider using a more specific name for the internal artifact (e.g., `AI_CHANGELOG.md`) or removing this entry now that the internal file is already purged from history.</comment>

<file context>
@@ -25,6 +25,14 @@ CLAUDE.md
 
+# Internal AI / review artifacts should stay local-only
+AGENTS.md
+CHANGELOG.md
+docs/progress-log.md
+docs/review-guide.md
</file context>
Fix with Cubic

docs/progress-log.md
docs/review-guide.md
docs/reviewer-handoff.md
docs/next-phase-brief.md

# OS / editor noise
.DS_Store
*.log
6 changes: 1 addition & 5 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ cam audit # check the repository for unexpected sensitive content

- `cam audit`: repository-level privacy and secret-hygiene audit.
- `cam memory --recent [count]`: durable sync audit for recent `applied`, `no-op`, and `skipped` sync events, without mixing in manual `remember` / `forget`.
- `cam session save|load|status`: continuity audit surface for the latest diagnostics and latest audit drill-down; `load` / `status` text output additionally shows a compact recent preview, all three `--json` variants return recent audit entries, and a pending continuity recovery marker appears when continuity Markdown was written but audit persistence failed.
- `cam session save|load|status`: continuity audit surface for the latest diagnostics, latest rollout, and latest audit drill-down; `load` / `status` text output additionally shows a compact prior preview that excludes the latest entry and coalesces consecutive repeats, all three `--json` variants continue to return raw recent audit entries, and a pending continuity recovery marker appears when continuity Markdown was written but audit persistence failed.

## How it works

Expand Down Expand Up @@ -252,9 +252,6 @@ See the architecture docs for the full storage and boundary breakdown.
### Maintainer and reviewer docs

- [Session continuity design](docs/session-continuity.md)
- [Progress log](docs/progress-log.md)
- [Review guide](docs/review-guide.md)
- [Reviewer handoff](docs/reviewer-handoff.md)
- [Release checklist](docs/release-checklist.md)
- [Contributing](CONTRIBUTING.md)

Expand Down Expand Up @@ -294,7 +291,6 @@ Current public-ready status:
## Contributing and license

- Contribution guide: [CONTRIBUTING.md](./CONTRIBUTING.md)
- Changelog: [CHANGELOG.md](./CHANGELOG.md)
- License: [Apache-2.0](./LICENSE)

If you ever find a mismatch between the README, official docs, and local runtime observations, prefer:
Expand Down
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ cam audit # 检查仓库有没有意外的敏感内容

- `cam audit`: 仓库级的 privacy / secret hygiene 审计。
- `cam memory --recent [count]`: durable sync audit,查看 recent `applied` / `no-op` / `skipped` sync 事件,不混入 manual `remember` / `forget`。
- `cam session save|load|status`: continuity audit surface,查看最新 continuity diagnostics 与 latest audit drill-down;其中 `load` / `status` 的文本输出会额外显示 compact recent preview三个命令的 `--json` 都会返回 recent audit entries;当 continuity Markdown 已写入但 audit 失败时,还会暴露 pending continuity recovery marker。
- `cam session save|load|status`: continuity audit surface,查看最新 continuity diagnostics、latest rollout 与 latest audit drill-down;其中 `load` / `status` 的文本输出会额外显示 compact prior preview(排除 latest,并收敛连续重复项),三个命令的 `--json` 都会继续返回 raw recent audit entries;当 continuity Markdown 已写入但 audit 失败时,还会暴露 pending continuity recovery marker。

## 工作方式

Expand Down Expand Up @@ -252,9 +252,6 @@ Session continuity:
### 维护与审查文档

- [Session continuity 设计](docs/session-continuity.md)
- [Progress log](docs/progress-log.md)
- [Review guide](docs/review-guide.md)
- [Reviewer handoff](docs/reviewer-handoff.md)
- [Release checklist](docs/release-checklist.md)
- [Contributing](CONTRIBUTING.md)

Expand Down Expand Up @@ -294,7 +291,6 @@ Session continuity:
## 贡献与许可

- 贡献指南:[CONTRIBUTING.md](./CONTRIBUTING.md)
- Changelog:[CHANGELOG.md](./CHANGELOG.md)
- License:[Apache-2.0](./LICENSE)

如果你在 README、官方文档和本地运行时观察之间发现冲突,请优先相信:
Expand Down
18 changes: 7 additions & 11 deletions docs/README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@

1. [Architecture](./architecture.en.md)
2. [Session continuity design](./session-continuity.md)
3. [Progress log](./progress-log.md)
4. [Next phase brief](./next-phase-brief.md)
3. [Release checklist](./release-checklist.md)
4. [ClaudeCode patch audit](./claudecode-patch-audit.md)

### Reviewers and external tools

1. [Review guide](./review-guide.md)
2. [Reviewer handoff](./reviewer-handoff.md)
3. [Release checklist](./release-checklist.md)
4. [ClaudeCode patch audit](./claudecode-patch-audit.md)
1. [Session continuity design](./session-continuity.md)
2. [Release checklist](./release-checklist.md)
3. [ClaudeCode patch audit](./claudecode-patch-audit.md)

## Core design docs

Expand All @@ -41,18 +40,15 @@
| Document | Purpose | Current language |
| :-- | :-- | :-- |
| [Session continuity design](./session-continuity.md) | continuity boundaries, paths, and reviewer surfaces | English |
| [Progress log](./progress-log.md) | milestone history, current state, and known gaps | English |
| [Review guide](./review-guide.md) | what reviewers should read first and which risks matter most | English |
| [Reviewer handoff](./reviewer-handoff.md) | shortest complete handoff packet for AI tools and external review | English |
| [Release checklist](./release-checklist.md) | release-time product, runtime, and docs checks | English |
| [Next phase brief](./next-phase-brief.md) | recommended next implementation window | English |
| [ClaudeCode patch audit](./claudecode-patch-audit.md) | historical patch-migration and comparison notes | English |

## Language policy

- the default public landing page is the Chinese `README.md`
- English readers can switch through [README.en.md](../README.en.md) or this page
- the three core design docs are maintained in both Chinese and English
- reviewer and maintainer docs currently stay English-first to avoid internal drift
- supplementary maintainer docs currently stay English-first to avoid internal drift

## Documentation principles

Expand Down
18 changes: 7 additions & 11 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@

1. [架构设计](./architecture.md)
2. [Session continuity 设计](./session-continuity.md)
3. [Progress log](./progress-log.md)
4. [Next phase brief](./next-phase-brief.md)
3. [Release checklist](./release-checklist.md)
4. [ClaudeCode patch audit](./claudecode-patch-audit.md)

### Reviewer / 外部审查工具

1. [Review guide](./review-guide.md)
2. [Reviewer handoff](./reviewer-handoff.md)
3. [Release checklist](./release-checklist.md)
4. [ClaudeCode patch audit](./claudecode-patch-audit.md)
1. [Session continuity 设计](./session-continuity.md)
2. [Release checklist](./release-checklist.md)
3. [ClaudeCode patch audit](./claudecode-patch-audit.md)

## 核心设计文档

Expand All @@ -41,18 +40,15 @@
| 文档 | 作用 | 当前语言 |
| :-- | :-- | :-- |
| [Session continuity 设计](./session-continuity.md) | 临时 continuity layer 的边界、路径和 reviewer surface | English |
| [Progress log](./progress-log.md) | 阶段进度、里程碑与已知缺口 | English |
| [Review guide](./review-guide.md) | reviewer 应该从哪里开始看、看什么、关注什么风险 | English |
| [Reviewer handoff](./reviewer-handoff.md) | 外部工具或 AI 接手时的最短完整 handoff packet | English |
| [Release checklist](./release-checklist.md) | 发布前的产品、运行时和文档核查清单 | English |
| [Next phase brief](./next-phase-brief.md) | 下一阶段推荐执行简报 | English |
| [ClaudeCode patch audit](./claudecode-patch-audit.md) | 历史 patch 迁移与对照记录 | English |

## 语言策略

- 默认公开首页使用中文 `README.md`
- 英文访客可从 [README.en.md](../README.en.md) 或 [docs/README.en.md](./README.en.md) 进入英文入口
- 3 篇核心设计文档提供中英双版本
- reviewer / maintainer 文档当前仍以英文为主,以减少内部维护漂移
- 维护类补充文档当前仍以英文为主,以减少内部维护漂移

## 文档设计原则

Expand Down
7 changes: 1 addition & 6 deletions docs/release-checklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,10 @@ Use this checklist before cutting any alpha or beta release of `codex-auto-memor
- `cam forget "..."`
- `cam doctor`

## Review packet checks
## Documentation checks
Copy link

@cubic-dev-ai cubic-dev-ai bot Mar 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The renamed section removes the CHANGELOG update checklist item, but the "Release decision" section at the bottom of this file still gates releases on "changelog is updated" and "review artifacts are in place." Either add a CHANGELOG bullet back under this section or update the release decision criteria to match.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At docs/release-checklist.md, line 35:

<comment>The renamed section removes the CHANGELOG update checklist item, but the "Release decision" section at the bottom of this file still gates releases on "changelog is updated" and "review artifacts are in place." Either add a CHANGELOG bullet back under this section or update the release decision criteria to match.</comment>

<file context>
@@ -32,15 +32,10 @@ Use this checklist before cutting any alpha or beta release of `codex-auto-memor
   - `cam doctor`
 
-## Review packet checks
+## Documentation checks
 
-- Update `CHANGELOG.md` with the new milestone and commit hash.
</file context>
Fix with Cubic


- Update `CHANGELOG.md` with the new milestone and commit hash.
- Update `docs/progress-log.md` to reflect the current phase and remaining gaps.
- Update `docs/review-guide.md` if a new high-risk area or review order is introduced.
- Update `docs/reviewer-handoff.md` so external review tools can pick up the current state quickly.
- Update the bilingual docs entry pages (`docs/README.md` and `docs/README.en.md`) if the public reading path changed.
- Re-check the current official Codex and Claude public docs before changing migration wording; if the public posture is unchanged, say so explicitly in the handoff.
- Refresh the local ignored AI handoff file `AI_REVIEW.local.md` with current review/test instructions before handing off to another agent.
- Ensure the latest milestone commit is focused enough to review independently.
Comment on lines +35 to 39
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Documentation checks now underspecify release-gate prerequisites.

The checklist still gates release on changelog/review artifacts later, but this section no longer tells maintainers to prepare them explicitly. Please add a direct prep step here to avoid release-time ambiguity.

Suggested patch
 ## Documentation checks
 
 - Update the bilingual docs entry pages (`docs/README.md` and `docs/README.en.md`) if the public reading path changed.
 - Re-check the current official Codex and Claude public docs before changing migration wording; if the public posture is unchanged, say so explicitly in the handoff.
+- Confirm where release notes/changelog updates are recorded for this milestone and update them before tagging.
+- Confirm required reviewer artifacts for this milestone are present at their current canonical location.
 - Ensure the latest milestone commit is focused enough to review independently.

Based on learnings: "Keep release hygiene explicit about paired bilingual public-doc checks and companion-first wording".

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
## Documentation checks
- Update `CHANGELOG.md` with the new milestone and commit hash.
- Update `docs/progress-log.md` to reflect the current phase and remaining gaps.
- Update `docs/review-guide.md` if a new high-risk area or review order is introduced.
- Update `docs/reviewer-handoff.md` so external review tools can pick up the current state quickly.
- Update the bilingual docs entry pages (`docs/README.md` and `docs/README.en.md`) if the public reading path changed.
- Re-check the current official Codex and Claude public docs before changing migration wording; if the public posture is unchanged, say so explicitly in the handoff.
- Refresh the local ignored AI handoff file `AI_REVIEW.local.md` with current review/test instructions before handing off to another agent.
- Ensure the latest milestone commit is focused enough to review independently.
## Documentation checks
- Update the bilingual docs entry pages (`docs/README.md` and `docs/README.en.md`) if the public reading path changed.
- Re-check the current official Codex and Claude public docs before changing migration wording; if the public posture is unchanged, say so explicitly in the handoff.
- Confirm where release notes/changelog updates are recorded for this milestone and update them before tagging.
- Confirm required reviewer artifacts for this milestone are present at their current canonical location.
- Ensure the latest milestone commit is focused enough to review independently.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/release-checklist.md` around lines 35 - 39, The "Documentation checks"
checklist underspecifies release-gate prerequisites; add a concrete prep step
under the "## Documentation checks" heading that instructs maintainers to (1)
prepare the changelog and review artifacts (e.g., ensure a drafted CHANGELOG
entry and linked PR/review notes are ready) and (2) perform paired bilingual
public-doc verification of docs/README.md and docs/README.en.md using
companion-first wording (confirm public reading paths and companion-focused
phrasing). Update the checklist text to explicitly require both the
changelog/review artifacts be prepared before release and the paired bilingual
review be completed.


## Native compatibility checks
Expand Down
9 changes: 5 additions & 4 deletions docs/session-continuity.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,11 @@ cam session clear
- project-local continuity
- the effective merged resume brief
- the latest continuity generation path and fallback status
- the latest rollout path
- a small latest-generation drill-down for evidence counts and written continuity paths
- a compact recent generation preview sourced from the continuity audit log
- a compact prior-generation preview sourced from the continuity audit log that excludes the latest entry and coalesces consecutive repeats

`cam session status` now renders the latest generation path, the audit-log location, the same latest-generation drill-down, and the same compact recent generation preview without printing the full shared/local continuity bodies.
`cam session status` now renders the latest generation path, the latest rollout path, the audit-log location, the same latest-generation drill-down, and the same compact prior-generation preview without printing the full shared/local continuity bodies.

Automatic injection and automatic saving are disabled by default.

Expand Down Expand Up @@ -191,8 +192,8 @@ Reason:
- reviewer/debug data belongs in an audit surface, not in the working-state note itself
- the latest audit entry now remains exposed explicitly as `latestContinuityAuditEntry` through `cam session save --json`, `cam session load --json`, and `cam session status --json`
- the compatibility summary field `latestContinuityDiagnostics` still exposes the latest path/fallback view for existing consumers
- the same commands now also expose recent audit entries so reviewers can verify short history without opening the JSONL directly
- the default text surfaces now show the latest evidence counts and written paths without becoming a dedicated history browser
- the same commands now also expose raw recent audit entries so reviewers can verify short history without opening the JSONL directly
- the default `load` / `status` text surfaces now show the latest rollout, the latest evidence counts and written paths, plus a compact prior preview without becoming a dedicated history browser

## Startup behavior

Expand Down
18 changes: 15 additions & 3 deletions src/lib/commands/audit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ interface AuditCommandOptions {
noHistory?: boolean;
}

function resolveIncludeHistory(options: AuditCommandOptions): boolean {
if (typeof options.history === "boolean") {
return options.history;
}

if (options.noHistory === true) {
return false;
}

return true;
}

function formatFinding(finding: AuditFinding): string[] {
return [
`- [${finding.severity}] ${finding.classification} ${finding.location}`,
Expand All @@ -28,10 +40,10 @@ function formatSummary(report: AuditReport): string[] {
}

export async function runAudit(options: AuditCommandOptions = {}): Promise<string> {
const includeHistory = options.noHistory ? false : true;
const includeHistory = resolveIncludeHistory(options);
const report = await runAuditScan({
cwd: options.cwd ?? process.cwd(),
includeHistory: options.history ? true : includeHistory
includeHistory
});

if (options.json) {
Expand All @@ -42,7 +54,7 @@ export async function runAudit(options: AuditCommandOptions = {}): Promise<strin
"Codex Auto Memory Audit",
`Generated at: ${report.generatedAt}`,
`Repository: ${report.cwd}`,
`History scan: ${options.noHistory ? "disabled" : "enabled"}`,
`History scan: ${includeHistory ? "enabled" : "disabled"}`,
"",
...formatSummary(report)
];
Expand Down
67 changes: 59 additions & 8 deletions src/lib/commands/memory.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
import path from "node:path";
import { patchConfigFile } from "../config/write-config.js";
import { formatMemorySyncAuditEntry } from "../domain/memory-sync-audit.js";
import { buildCompactHistoryPreview } from "../domain/reviewer-history.js";
import { openPath } from "../util/open.js";
import { compileStartupMemory } from "../domain/startup-memory.js";
import type { ConfigScope, MemoryCommandOutput, MemoryScope, SyncRecoveryRecord } from "../types.js";
import type {
ConfigScope,
MemoryCommandOutput,
MemoryScope,
MemorySyncAuditEntry,
SyncRecoveryRecord
} from "../types.js";
import { buildRuntimeContext } from "./common.js";

interface MemoryOptions {
Expand Down Expand Up @@ -31,6 +38,47 @@ function formatPendingSyncRecovery(record: SyncRecoveryRecord, recoveryPath: str
];
}

function syncAuditSignature(entry: MemorySyncAuditEntry): string {
return JSON.stringify({
rolloutPath: entry.rolloutPath,
sessionId: entry.sessionId ?? null,
status: entry.status,
skipReason: entry.skipReason ?? null,
isRecovery: entry.isRecovery === true,
configuredExtractorMode: entry.configuredExtractorMode,
configuredExtractorName: entry.configuredExtractorName,
actualExtractorMode: entry.actualExtractorMode,
actualExtractorName: entry.actualExtractorName,
appliedCount: entry.appliedCount,
scopesTouched: entry.scopesTouched,
resultSummary: entry.resultSummary
});
}

function formatRecentSyncAuditLines(entries: MemorySyncAuditEntry[], maxGroups: number): {
lines: string[];
groupCount: number;
} {
const preview = buildCompactHistoryPreview(entries, {
maxGroups,
getSignature: syncAuditSignature
});

const lines = preview.groups.flatMap((group) => [
...formatMemorySyncAuditEntry(group.latest),
...(group.rawCount > 1 ? [` Repeated similar sync events hidden: ${group.rawCount - 1}`] : [])
]);

if (preview.omittedRawCount > 0) {
lines.push(`- older sync events omitted: ${preview.omittedRawCount}`);
}

return {
lines,
groupCount: preview.groups.length
};
}

export async function runMemory(options: MemoryOptions = {}): Promise<string> {
const cwd = options.cwd ?? process.cwd();
const configScope = options.configScope ?? "local";
Expand Down Expand Up @@ -66,9 +114,10 @@ export async function runMemory(options: MemoryOptions = {}): Promise<string> {
topics: await runtime.syncService.memoryStore.listTopics(scope)
}))
);
const recentSyncAudit = options.recent
? await runtime.syncService.memoryStore.readRecentSyncAuditEntries(recentCount)
const recentSyncAuditPreviewEntries = options.recent
? await runtime.syncService.memoryStore.readRecentSyncAuditEntries(recentCount * 2)
: [];
const recentSyncAudit = recentSyncAuditPreviewEntries.slice(0, recentCount);
const pendingSyncRecovery = await runtime.syncService.memoryStore.readSyncRecoveryRecord();
const startupFilesByScope = {
global: startup.sourceFiles.filter(
Expand Down Expand Up @@ -194,11 +243,13 @@ export async function runMemory(options: MemoryOptions = {}): Promise<string> {
}
}

if (recentSyncAudit.length > 0) {
lines.push("", `Recent sync events (${recentSyncAudit.length}):`);
for (const item of recentSyncAudit) {
lines.push(...formatMemorySyncAuditEntry(item));
}
if (recentSyncAuditPreviewEntries.length > 0) {
const compactRecentSyncAudit = formatRecentSyncAuditLines(
recentSyncAuditPreviewEntries,
recentCount
);
lines.push("", `Recent sync events (${compactRecentSyncAudit.groupCount} grouped):`);
lines.push(...compactRecentSyncAudit.lines);
}

if (pendingSyncRecovery) {
Expand Down
Loading
Loading