Repository navigation
docs(audit): what a Cortex backup must contain (#731, slice 1) - #892
Conversation
Inventory every file and store a Cortex install writes, with the cited line that names its path, classed as user data, derived data, process state or not Cortex's, and the set a backup carries per backend. Finds that the code graphs, the consolidation stamp and the pipeline install are built from the home directory and do not follow CORTEX_CLAUDE_DIR, and that the code graphs ignore the cache override. Refs #731 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018kyZYqkZyf6rNbyAG8gFua
…ce-inventory # Conflicts: # CHANGELOG.md
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Claude finished @cdeust's task in 2m 37s —— View job Review 1 of 3 — done
Result: no Blockers, 3 Notes. All the citations I checked hold up. The Notes:
I couldn't run Verdict: approve |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 58a78d36d0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| | Backend marker (which store this install uses) | `<root>/methodology/backend.json` | A | `mcp_server/infrastructure/backend_marker.py:48` | | ||
| | Wiki pages on disk | `<root>/methodology/wiki/` | A | `mcp_server/infrastructure/config.py:42`; `mcp_server/handlers/ingest_findings_writers.py:173` | | ||
| | Raw-output artifacts | `<root>/methodology/artifacts/` | A | `mcp_server/infrastructure/artifact_store.py:19` | | ||
| | Cognitive profiles | `<root>/methodology/domains/<id>.json`, `index.json`; legacy `profiles.json`, `profiles.json.v1_backup` | D (rebuilt from transcripts by `rebuild_profiles`) | `mcp_server/infrastructure/profile_store.py:20-22`, `:49`; `mcp_server/infrastructure/config.py:38` | |
There was a problem hiding this comment.
Include accumulated cognitive profiles in the class A backup set
For installs whose older transcripts have expired, these profiles cannot be rebuilt by rebuild_profiles. record_session_end._update_profile() incrementally updates the persisted session count and cognitive-style EMA, and mcp_server/core/profile_rebuild_policy.py explicitly preserves stored profiles when the remaining transcripts contain fewer sessions because that accumulated state is unrecoverable. Classifying the profiles as D excludes them from section 3's backup set and the planned class-A-only manifest, so a restore following this inventory would permanently lose learned profile history. Classify the persisted profiles and their index as A and include them in the per-backend backup sets.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed and fixed in 6fd8147. record_session_end._update_profile (record_session_end.py:265-287) accumulates each session into the stored profile, and profile_rebuild_policy.py:1-15 (ADR-1099) keeps that profile because expired transcripts cannot rebuild it. The profiles (domains/, index.json, legacy profiles.json*) are now class A and in the §3 backup set. session-log.json had the same flaw (one entry appended per ended session, record_session_end.py:257/:322, session_lifecycle.py:254/:356), so it moved to class A in the same commit.
Generated by Claude Code
Review 1 of 3 — PR #892I ran five reviews: code quality, documentation accuracy, security, performance and test coverage. None found a Blocker. The diff changes only documentation (the audit doc and a CHANGELOG entry), so it can't break CI. I found no false statement about security or behaviour. The documentation review checked every Notes, no action before merge
Verdict: approve |
Review 1 of 3 — PR #892 (head
|
…ce-inventory # Conflicts: # CHANGELOG.md
|
Claude finished @cdeust's task in 2m 26s —— View job Review 3 of 3 — done
Result: no Blockers. The whole PR is accepted. Note: Verdict: approve |
Review 3 of 3 — PR #892 (head
|
Summary
First slice of #731 (verified portable backup and restore). The issue's first acceptance item is "define included/excluded owned resources". This PR is that inventory, with no code change:
docs/audits/owned-resources-backup-2026-11-05.md.Root cause of the gap the issue describes, cited at
main8ef4813:private_roots()/private_files()inmcp_server/shared/private_paths.py:67-74), but nothing turns that list into a backup: no handler undermcp_server/handlers/exports or restores a store as a whole, and the only backup check in the tree is thepg_dumpprecondition ofscripts/reclassify_team_scope_db.py:12-22.-wal/-shm, managed PostgreSQL cluster and its password, backend marker, wiki pages, artifacts, profiles, capture spool, telemetry, logs, locks, caches, code graphs) as user data, derived data, process state, or not Cortex's, and gives the set a backup carries per backend.ingest_codebase.py:108), the consolidation stamp (consolidate_background.py:37) and the pipeline install (pipeline_discovery.py:75-78,pipeline_install_lock.py:15) are built from the home directory and do not followCORTEX_CLAUDE_DIR; the code graphs also ignoreCORTEX_CACHE_DIR/XDG_CACHE_HOME; the wiki lives both as files and as tables, so a snapshot must take both at once.Refs #731, not
Closes.Type of change
Test plan
python scripts/check_doc_claims.py→doc claims OK;python scripts/check_craftsmanship.py→Craftsmanship gate: OK.pytest tests_py/scripts/test_check_doc_claims.pyand the document-ingest tests → 194 passed.sed -nbefore commit.Not verified: nothing was run against a user datastore; the statement that a file copy of a running managed cluster is not consistent is inferred from PostgreSQL's file-level backup rules, not reproduced.
ruff checkon the whole tree reports 8 E501 in files this PR does not touch (scripts/ci_pipeline_source_contract.py,scripts/tests/test_no_main_comparison.py,tests_py/scripts/test_ci_review_required.py), already present onmain8ef4813.Remaining slices of #731
CORTEX_CLAUDE_DIR, then integrity and known-memory/source queries.Generated by Claude Code