[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7F5C137KAJ4M2XAXPS8VX9G":3,"skill-same:01M7F5C137KAJ4M2XAXPS8VX9G":46},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":29,"ownerDescription":30,"updatedAt":31,"install":32,"resources":45},"01M7F5C137KAJ4M2XAXPS8VX9G","ccs-align",null,"Run the CCS Align seat's hourly breathing cycle — prove the local claude-mem worker is healthy, pull needle observations through search → timeline → get_observations, land them in a seat-owned middle cache via atomic grab → append → filter exclude-marks → replace, manage exclude marks, and walk house → project → seat rules to detect conflicts (SHADOW_HOUSE, DENY_ALLOW, DRIFT, CLOCK_HEADER) with an append-only rules-report.md. Use when asked to run CCS Align, breathe the alignment seat, refresh the middle cache, exclude or restore an observation, walk rules, check rules conflicts, or check the Worker Watch board.","Prasanth595\u002Fclaude-mem-mirror","Prasanth595","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F85020330?v=4","01M7F59DKDR8Z9JKCPKAGA7T0P","Prasanth Arumugam","01M7F59PY83WFCMPV6J951X4TN",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002FPrasanth595\u002Fclaude-mem-mirror\u002Fblob\u002Fmain\u002Fplugin\u002Fskills\u002Fccs-align\u002FSKILL.md",[],[],"2026-11-16 10:05:34",false,"---\nname: ccs-align\ndescription: Run the CCS Align seat's hourly breathing cycle — prove the local claude-mem worker is healthy, pull needle observations through search → timeline → get_observations, land them in a seat-owned middle cache via atomic grab → append → filter exclude-marks → replace, manage exclude marks, and walk house → project → seat rules to detect conflicts (SHADOW_HOUSE, DENY_ALLOW, DRIFT, CLOCK_HEADER) with an append-only rules-report.md. Use when asked to run CCS Align, breathe the alignment seat, refresh the middle cache, exclude or restore an observation, walk rules, check rules conflicts, or check the Worker Watch board.\n---\n\n# CCS Align — Worker Watch seat (Phases 0–2 shipped; Phase 3 = verify \u002F sign-off)\n\nCCS Align is a **standing seat**, not a bird's-eye planner. Its one job, once an hour: talk to the **local** claude-mem worker, pull recent needle observations through the existing three-layer disclosure ladder, and land them in a **seat-owned middle cache** using grab → append → replace.\n\nThis skill implements the Phase 0 breathing slice, Phase 1 exclude marks, and Phase 2 rules alignment from the plan of record, `plans\u002F2026-09-09-ccs-align.md`. Phases 0–2 are **shipped and merged** ([#3934](https:\u002F\u002Fgithub.com\u002Fthedotmack\u002Fclaude-mem\u002Fpull\u002F3934), [#3935](https:\u002F\u002Fgithub.com\u002Fthedotmack\u002Fclaude-mem\u002Fpull\u002F3935), [#3936](https:\u002F\u002Fgithub.com\u002Fthedotmack\u002Fclaude-mem\u002Fpull\u002F3936)); Phase 3 is **verify \u002F sign-off** (this loop) — no new product surface. It is **not** a context compiler, **not** Focus\u002Fmouth, and **not** Grok Memory Phase 2. When you speak to the human, address them as **Alex**.\n\n## What is implemented (Phases 0–2 shipped)\n\n- **Phase 0 — Breathing slice** ([#3934](https:\u002F\u002Fgithub.com\u002Fthedotmack\u002Fclaude-mem\u002Fpull\u002F3934)): health check → `search` → `timeline` → `get_observations` → append records to `~\u002F.claude-mem\u002Fccs-align\u002F\u003CviewerId>\u002Fmiddle.jsonl` (atomic, deduped).\n- **Phase 1 — Exclude marks** ([#3935](https:\u002F\u002Fgithub.com\u002Fthedotmack\u002Fclaude-mem\u002Fpull\u002F3935)): mark observations (and linked tool-use ids) as excluded from the compiled middle cache. \"Purge\" means the compiled `middle.jsonl` no longer contains the record — the diary \u002F SQLite stay authoritative. Unmarking + rebuild restores the observation. `DELETE \u002Fapi\u002Fobservation\u002F:id` is **forbidden**.\n- **Phase 2 — Rules alignment** ([#3936](https:\u002F\u002Fgithub.com\u002Fthedotmack\u002Fclaude-mem\u002Fpull\u002F3936)): walk house → project → seat layers, detect conflicts (`SHADOW_HOUSE`, `DENY_ALLOW`, `DRIFT`, `CLOCK_HEADER`), emit an append-only `rules-report.md`. Optionally dry-run\u002Fapply `SHADOW_HOUSE` leaf patches when `CLAUDE_MEM_CCS_ALIGN_PATCH_SHADOWS=true`. Runs every 6th hour of the hourly Worker Watch cycle (D4). This is a **checklist**, not a parser — no `.cas` compiler.\n- **Phase 3 — Verify \u002F sign-off** (this loop): re-run the regression tests and anti-pattern greps, prove the boundary (a scripted cycle dedupes, an exclude drops from the middle cache but not the diary, the rules report is produced or a MISS is recorded), and keep the skill + plan honest about what this seat is not. Phase 3 adds **no** new runtime behavior.\n- **Does not:** delete history, write `profile.md`, write LFG\u002FOrifice `[awareness]` logs (that seam belongs to [#3931](https:\u002F\u002Fgithub.com\u002Fthedotmack\u002Fclaude-mem\u002Fpull\u002F3931)), add a sixth `processAgentResponse` consumer, restart the worker, run a per-turn drip update, enforce Focus\u002Fmouth\u002Fstanding rules, or copy house text into seats.\n\n## What this is NOT (honest boundary)\n\nCCS Align is deliberately small. It does **not** ship, and this loop does **not** add, any of the following — these are future work or a different agent, called out so no one reads more into the seat than is there:\n\n- **No context compiler.** There is no `.cas` parser, no `compileAwareness()`, no JIT compile, no computed-styles UI. The CCS Notion page types (`Bucket`, `canRead`) are teaching copy quoted as comments — never a runtime parser.\n- **No brainbeat product.** The \"regenerate awareness once per finished unit of work\" door is not built. Align *pulls* on an hourly cadence; it is not a per-turn drip and it is not a brainbeat.\n- **No attention trough \u002F curse-salience.** No salience decay, no trough scoring. Explicitly out of every phase.\n- **No Focus \u002F mouth enforcement.** Standing rules (always \u002F never \u002F danger) are never enforced or decayed here. Align may *list* a conflict; egress filtering belongs to a different agent.\n- **No second writer on LFG\u002FOrifice `[awareness]` logs.** [#3931](https:\u002F\u002Fgithub.com\u002Fthedotmack\u002Fclaude-mem\u002Fpull\u002F3931) owns `agents\u002F**\u002Fmemory\u002Flog\u002FYYYY-MM.md`. Align writes only its seat-owned middle cache.\n- **No history rewrite.** Exclude marks filter the *compiled* cache; the diary \u002F SQLite stay authoritative and rebuildable. No `DELETE \u002Fapi\u002Fobservation`, no A-MEM row rewrite.\n\n### Ops MISS — worker plugin version lag\n\nAs of this sign-off, the repo (package, plugin, marketplace) is at **13.24.5** (this Phase 3 PATCH), but the **running worker plugin on the house box may still be 13.24.1**. That is an **operational MISS to record, not fix here**: this seat does not restart or upgrade the worker (a hard forbid). If the live box still shows 13.24.1, note it when rolling status up to the Prioritizer so the worker gets restarted onto the current plugin out-of-band. If the running worker already matches the package version, this MISS is closed.\n\n## Prerequisites\n\nThe claude-mem worker must be running locally. This seat talks to the **local worker** (per-UID port ~`37700`), never the cloud CMEM MCP — cloud `observation:\u003Cbase64>` ids are a different API and must not be mixed in.\n\n**Resolve the worker port** once and reuse `$WORKER_PORT` in every curl below. This snippet is copied from the `timeline-report` skill and honors `CLAUDE_MEM_WORKER_PORT` → `~\u002F.claude-mem\u002Fsettings.json` → the per-UID default `37700 + (uid % 100)`:\n\n```bash\nWORKER_PORT=\"${CLAUDE_MEM_WORKER_PORT:-$(node -e \"const fs=require('fs'),p=require('path'),os=require('os');const uid=(typeof process.getuid==='function'?process.getuid():77);const fallback=String(37700+(uid%100));try{const s=JSON.parse(fs.readFileSync(p.join(os.homedir(),'.claude-mem','settings.json'),'utf-8'));process.stdout.write(String(s.CLAUDE_MEM_WORKER_PORT||fallback));}catch{process.stdout.write(fallback);}\" 2>\u002Fdev\u002Fnull)}\"\n```\n\nDo **not** hardcode port `37777` — ports are per-UID.\n\n## Settings\n\nDefaults live in `SettingsDefaultsManager.ts`; override in `~\u002F.claude-mem\u002Fsettings.json`:\n\n| Key | Default | Meaning |\n|---|---|---|\n| `CLAUDE_MEM_CCS_ALIGN_ENABLED` | `true` | Master switch for the seat. |\n| `CLAUDE_MEM_CCS_ALIGN_VIEWER_IDS` | `ccs-align` | Comma-separated viewer ids the seat maintains a cache for. |\n| `CLAUDE_MEM_CCS_ALIGN_TRIGGER_TYPES` | `decision,bugfix,security_alert,sensitive` | Needle observation types to pull (copied from #3931's list, D6). |\n| `CLAUDE_MEM_CCS_ALIGN_PATCH_SHADOWS` | `false` | Phase 2 rules-shadow patch gate. When `true`, the rules walker removes `SHADOW_HOUSE` duplicate lines from leaf files (atomic temp+rename). Default **off** — report-only. |\n\nPilot viewer id is `ccs-align`. The seat **may read** LFG observations (agent id `521e962d-2ec3-4488-bfbc-54d5209ce118`) as a project filter, but **must not write** LFG\u002FOrifice monthly logs or any `profile.md`.\n\n## Hourly cycle (Appendix A runbook)\n\nRun this every hour on a weekday house board. One purpose. No watercooler. No \"while I was here I also…\".\n\n```\nevery hour (weekday house board):\n  1. Resolve WORKER_PORT (snippet above)\n  2. GET \u002Fapi\u002Fhealth || GET \u002Fhealth   → abort with a one-line miss if down\n  3. search(obs_type=needles, limit=20) since cursor.lastObservationId\n  4. timeline(anchor=newest)          → collect neighbor ids\n  5. get_observations(ids=…)\n  5b. (Phase 1, mark-time only) If excluding: get_tool_uses for tool ids → record on mark\n  6. grab middle.jsonl → append new → filter exclude-marks → replace atomic\n  7. if original-cache path set and not writable: append-only to middle.jsonl (already done)\n  8. update cursor.json\n  9. every 6th hour: rules walk → append rules-report.md   (Phase 2 — see below)\n 10. Speak to Alex only on red (worker down, write refused, unexpected profile.md touch)\n```\n\n### Step 1 — Resolve the port\n\nUse the `$WORKER_PORT` snippet above.\n\n### Step 2 — Prove worker health (prefer `\u002Fapi\u002Fhealth`)\n\nPrefer `GET \u002Fapi\u002Fhealth`; also accept the viewer alias `GET \u002Fhealth`. The public worker docs still show `GET \u002Fhealth` and a `port` field — both are stale. Health does **not** return a port; use `GET \u002Fapi\u002Fstats` (`worker.port`) if you need it.\n\n```bash\ncurl -sS \"http:\u002F\u002F127.0.0.1:${WORKER_PORT}\u002Fapi\u002Fhealth\" || curl -sS \"http:\u002F\u002F127.0.0.1:${WORKER_PORT}\u002Fhealth\"\n# expect a JSON body with \"status\":\"ok\". If the worker is down, abort with a\n# one-line miss — do NOT start it, do NOT retry aggressively.\n```\n\nIf health cannot be proven (e.g. no live worker in a cloud VM), record a **MISS** and stop. Do not fabricate a cache cycle.\n\n### Step 3 — Pull through the three-layer ladder (in order)\n\nThe disclosure order is **`search` → `timeline` → `get_observations`**. Never jump straight to `get_observations`, and do **not** call `get_tool_uses` in Phase 0 (that is Phase 1).\n\n1. **`search`** with the needle `obs_type` list (`CLAUDE_MEM_CCS_ALIGN_TRIGGER_TYPES`), `limit` ≤ 20, optionally scoped by `project`. Use the cursor's `lastObservationId` to avoid re-pulling the whole diary.\n\n   ```bash\n   curl -sS \"http:\u002F\u002F127.0.0.1:${WORKER_PORT}\u002Fapi\u002Fsearch?query=*&type=decision&limit=20&format=json\"\n   ```\n\n2. **`timeline`** anchored on the newest hit. The worker's **code default depth is 10** (`SearchManager.ts`) — the MCP text that says \"3\" is stale, so omit the depths (worker applies 10) or pass `10` explicitly.\n\n   ```bash\n   curl -sS \"http:\u002F\u002F127.0.0.1:${WORKER_PORT}\u002Fapi\u002Ftimeline?anchor=\u003CnewestObservationId>\"\n   ```\n\n3. **`get_observations`** for the ids you will actually cache.\n\n   ```bash\n   curl -sS -X POST \"http:\u002F\u002F127.0.0.1:${WORKER_PORT}\u002Fapi\u002Fobservations\u002Fbatch\" \\\n     -H 'content-type: application\u002Fjson' \\\n     -d '{\"ids\":[12345,12346]}'\n   ```\n\nThe MCP twins are `search` → `timeline` → `get_observations`. Worker `get_observations` ids are **numbers**; do not pass cloud `observation:\u003Cbase64>` ids into `\u002Fapi\u002Fobservations\u002Fbatch`.\n\n### Step 4 — Grab → append → filter exclude-marks → replace (atomic middle cache)\n\nLand the observations with the seat helper `src\u002Fservices\u002Fintegrations\u002FCcsAlignMiddleCache.ts`\n(`landObservationsInMiddleCache`). It copies the #3931 atomic primitive\n(`appendAwarenessLineAtomic` + `awarenessLineBody`) with exactly three changes:\nthe tag is `[ccs-align]`, the path root is `~\u002F.claude-mem\u002Fccs-align\u002F\u003CviewerId>\u002F`,\nand the file is `middle.jsonl`.\n\nPhase 1 adds an exclude-marks filter inside the atomic pipeline:\n\n```\ngrab:    read middle.jsonl if it exists, else empty\nfilter:  load exclude-marks.json; drop any record whose id is marked\nappend:  for each new observation id not already present AND not marked, append one record\nreplace: write temp + rename (copy appendAwarenessLineAtomic; never appendFileSync)\nfallback: if an OPTIONAL original-cache path is set and not writable, skip grab\u002Freplace\n          on that path and append timeline items to middle.jsonl only\n```\n\nThere is **no compiled laminate file in-repo**, so the fallback resolves to\n\"append to the seat file\" — never invent a laminate.\n\nEach line of `middle.jsonl` is one record. The shape is **locked** for Phase 0 (do not add fields):\n\n```json\n{\n  \"v\": 1,\n  \"id\": 12345,\n  \"type\": \"decision\",\n  \"title\": \"…\",\n  \"created_at\": \"2026-09-09T00:00:00.000Z\",\n  \"project\": \"claude-mem\",\n  \"agent_id\": null,\n  \"source\": \"worker\",\n  \"line\": \"- 2026-09-09 [ccs-align] decision — «…»\"\n}\n```\n\n`line` is `formatCcsAlignLine`: the awareness line format with the tag swapped,\nwritten by the same shared formatter, so the recalled text is sanitized (no tag\nframing or invisible characters) and fenced in `«…»`, truncated inside the fence\nto 500 chars. Dedupe is by observation `id` **and**\nby body (the line from `[ccs-align]` onward, date excluded), so the same fact on\na new day is still skipped and the file does not grow on a repeat cycle.\n\nA minimal invocation (bun\u002Fnode):\n\n```ts\nimport { landObservationsInMiddleCache } from '..\u002F..\u002Fsrc\u002Fservices\u002Fintegrations\u002FCcsAlignMiddleCache.js';\n\nlandObservationsInMiddleCache({\n  viewerId: 'ccs-align',\n  observations: rowsFromGetObservations, \u002F\u002F [{ id, type, title, subtitle, facts, created_at, project, agent_id }]\n});\n```\n\nIt **never throws** into the caller — a broken write path is logged and swallowed.\n\n### Step 5 — Update the cursor\n\nWrite `~\u002F.claude-mem\u002Fccs-align\u002F\u003CviewerId>\u002Fcursor.json` so the next hour does not re-pull the whole diary:\n\n```json\n{ \"lastRunAt\": \"…\", \"lastObservationId\": 12345, \"healthPath\": \"\u002Fapi\u002Fhealth\", \"workerPort\": 37700 }\n```\n\nUse `writeCursor` from the helper (atomic temp + rename).\n\n### Step 6 — Speak only on red\n\nRoll status **up** to the Prioritizer. Only speak to Alex on red: worker down, a write was refused, or an unexpected `profile.md` touch. Otherwise stay quiet.\n\n## Phase 1 — Exclude marks\n\n\"Purge\" means the compiled `middle.jsonl` no longer contains the observation or its tool I\u002FO for that viewer. The diary stays. This is Secure Isolated Awareness + context-stripper — **not** delete.\n\n### Exclude-marks file\n\nEach viewer has `~\u002F.claude-mem\u002Fccs-align\u002F\u003CviewerId>\u002Fexclude-marks.json`:\n\n```json\n{\n  \"v\": 1,\n  \"marks\": [\n    {\n      \"observationId\": 12345,\n      \"toolUseIds\": [\"toolu_01abc\", 678],\n      \"reason\": \"sibling-wall|manual|stripper|secure-isolation\",\n      \"markedAt\": \"2026-09-09T00:00:00.000Z\",\n      \"markedBy\": \"ccs-align\"\n    }\n  ]\n}\n```\n\nMarks are managed by `addExcludeMark` \u002F `removeExcludeMark` in `CcsAlignMiddleCache.ts`, or by manual JSON edit.\n\n### How marks get created (v1)\n\n1. **Manual JSON edit** — open `exclude-marks.json` and add a mark entry.\n2. **Skill flag** — `exclude \u003CobservationId> --reason …` (manual, sibling-wall, stripper, secure-isolation).\n3. No auto-promotion from chat text (poison surface — see Memory dig findings).\n\n### Purge tools (compiled only)\n\nWhen recording tool-use ids on a mark:\n\n1. After `get_observations`, if you need tool ids, call `get_tool_uses` \u002F `POST \u002Fapi\u002Ftool-uses\u002Fbatch` (layer 4).\n2. Record those ids on the mark's `toolUseIds` array.\n3. **Never persist raw `tool_input` \u002F `tool_response` into `middle.jsonl`** — layer 4 stays out of the laminate.\n4. **Do not** call `DELETE \u002Fapi\u002Fobservation\u002F:id` — that tombstones the diary and breaks rebuild-from-history.\n\n> **Warning:** `get_tool_uses` is **layer 4** of the progressive disclosure ladder. It returns raw tool I\u002FO and should only be called at mark-time to capture tool-use ids for an exclude mark. Never call it during the normal hourly cycle. Never persist its `tool_input` \u002F `tool_response` payloads into any cache file.\n\n### Unmark + rebuild\n\nTo restore a previously excluded observation:\n\n1. Remove the mark from `exclude-marks.json` (`removeExcludeMark` or manual edit).\n2. Re-pull the diary through the three-layer ladder (`search` → `timeline` → `get_observations`).\n3. Call `rebuildMiddleCache` to clear and re-land the compiled file from the authoritative diary.\n\nThe observation reappears in `middle.jsonl` on the next cycle because the diary was never touched.\n\n### Viewer isolation\n\nEach viewer's middle cache is independent:\n\n- `~\u002F.claude-mem\u002Fccs-align\u002Fviewer-a\u002Fmiddle.jsonl`\n- `~\u002F.claude-mem\u002Fccs-align\u002Fviewer-b\u002Fmiddle.jsonl`\n\nObservations landed for viewer A never appear in viewer B's compiled file. Exclude marks for viewer A do not affect viewer B. This implements the Secure Isolated Awareness property: inject a unique eval token into viewer A's cache → run viewer B → assert A's token never appears in B's compiled file.\n\n### Programmatic usage\n\n```ts\nimport {\n  addExcludeMark,\n  removeExcludeMark,\n  rebuildMiddleCache,\n  ccsAlignExcludeMarksPath,\n  readExcludeMarks,\n} from '..\u002F..\u002Fsrc\u002Fservices\u002Fintegrations\u002FCcsAlignMiddleCache.js';\n\nconst marksPath = ccsAlignExcludeMarksPath(dataRoot, 'ccs-align');\n\n\u002F\u002F Mark an observation as excluded (with optional tool-use ids)\naddExcludeMark(marksPath, 12345, ['toolu_01abc'], 'manual');\n\n\u002F\u002F Unmark and rebuild\nremoveExcludeMark(marksPath, 12345);\nrebuildMiddleCache({\n  viewerId: 'ccs-align',\n  observations: allObservationsFromDiary,\n  dataRoot,\n});\n```\n\n## Hard forbids (every phase)\n\n- ❌ `DELETE \u002Fapi\u002Fobservation\u002F:id` — tombstone ≠ exclude mark; breaks rebuild-from-history.\n- ❌ Writing LFG\u002FOrifice `[awareness]` logs, or into any `agents\u002F**\u002Fmemory\u002Flog\u002F` path.\n- ❌ Writing `profile.md`, user-memory, or project memory.\n- ❌ A top-of-prompt clock (timestamps belong on facts, not a cache header).\n- ❌ `POST \u002Fapi\u002Fcontext\u002Fsemantic` (per-turn drip the awareness design forbids).\n- ❌ A sixth `processAgentResponse` consumer — CCS Align **pulls**; #3931 owns that seam.\n- ❌ Restarting the worker, or `POST \u002Fapi\u002Fsettings`.\n- ❌ Addressing the human as \"Az\". Always **Alex**.\n- ❌ Claiming a context compiler \u002F brainbeat shipped. Those are future work.\n- ❌ \"Fixing\" deny\u002Fallow by flipping rules — report only.\n- ❌ Copying house text into seats — that is the bug this phase detects.\n- ❌ Building a `.cas` compiler so the report looks smarter.\n- ❌ Patching standing \u002F Focus \u002F always \u002F never \u002F danger files.\n- ❌ Attention trough \u002F curse-salience experiments (Phase-N backlog only).\n\n## Phase 2 — Rules alignment (house → project → seat)\n\nEvery 6th hour of the hourly Worker Watch cycle (D4), the seat walks house → project → seat layers to detect and report rules conflicts. This is a **checklist**, not a parser. No `.cas` compiler.\n\n### Cascade rules (from Notion CCS)\n\n- Write once at HOUSE; seats inherit\n- A leaf copy **shadows** the cascade (bug, not feature)\n- Deny beats allow\n- Siblings deny heavy buckets (`obs`, `note`, `person`) by default\n- Fail closed: if no rule exists, deny\n\n### Layer walk\n\n| Layer | Where to look (house box) | Bucket |\n|---|---|---|\n| House | `user-memory\u002F` shared profile; Notion CCS `:root` | `profile`, `standing`, `owns` |\n| Project | `.cmem-projects\u002F\u003Cproject>\u002F`, repo `CLAUDE.md` | project overrides |\n| Seat | `agents\u002F\u003Cuuid>\u002Fprofile.md`, `agents\u002F\u003Cuuid>\u002Fmemory\u002F` | leaf — must not duplicate house |\n\nOn a box with no agent-data tree, the report records `MISS: house-box paths` and exits cleanly.\n\n### Conflict classes (v1)\n\n| Code | Pattern | Agency |\n|---|---|---|\n| `SHADOW_HOUSE` | Leaf file contains a line that also exists at house (or starts with `House rule`) | Dry-run remove-from-leaf; apply only if `CLAUDE_MEM_CCS_ALIGN_PATCH_SHADOWS=true` |\n| `DENY_ALLOW` | Same bucket allow at one layer, deny at another | Report only |\n| `DRIFT` | House text changed; leaf still has old wording (partial prefix match) | Report only |\n| `CLOCK_HEADER` | Top-of-prompt clock \u002F \"current time is\" in a profile | Report only (house rule: no clock in the prefix) |\n\n### Rules report\n\nOutput: `~\u002F.claude-mem\u002Fccs-align\u002F\u003CviewerId>\u002Frules-report.md` — dated, append-only sections. Each run appends a new section with a timestamp, a table of conflicts, any MISS entries, and a patches-applied count. Status rolls **up** to Prioritizer (never peer spam).\n\n### Limited patch (D8 default off)\n\nWhen `CLAUDE_MEM_CCS_ALIGN_PATCH_SHADOWS=true`:\n\n1. Only `SHADOW_HOUSE` conflicts are patched — never `DENY_ALLOW`, `DRIFT`, or `CLOCK_HEADER`.\n2. The would-be diff is written into the report **before** any patch is applied.\n3. The leaf file is copied, duplicate lines are stripped, and the file is replaced atomically (temp + rename, same primitive as `CcsAlignMiddleCache`).\n4. **Never patches `standing` \u002F Focus \u002F `always.md` \u002F `never.md` \u002F `danger.md` \u002F `profile.md`.**\n5. House files are never modified.\n\n### Programmatic usage\n\n```ts\nimport {\n  walkRules,\n  discoverLayerPaths,\n  type RulesWalkerConfig,\n} from '..\u002F..\u002Fsrc\u002Fservices\u002Fintegrations\u002FCcsAlignRulesWalker.js';\n\n\u002F\u002F Discover paths on the current box\nconst paths = discoverLayerPaths({ project: 'claude-mem' });\n\nconst config: RulesWalkerConfig = {\n  dataRoot: '~\u002F.claude-mem',\n  viewerId: 'ccs-align',\n  patchShadows: false,  \u002F\u002F report-only by default\n  housePaths: paths.housePaths,\n  projectPaths: paths.projectPaths,\n  seatPaths: paths.seatPaths,\n};\n\nconst result = walkRules(config);\n\u002F\u002F result.conflicts — array of detected conflicts\n\u002F\u002F result.misses — paths that were not found\n\u002F\u002F result.reportPath — path to the appended rules-report.md\n\u002F\u002F result.patchesApplied — number of SHADOW_HOUSE lines removed (0 if patchShadows=false)\n```\n\n## Phase 3 — Verify \u002F sign-off (plan §3)\n\nPhase 3 closes the plan loop. It proves the seat is hourly-runnable, documented, and honest about what it is not — it does **not** add runtime behavior.\n\n**Prove the boundary, not the code (§3.1):**\n\n- One scripted cycle: health → `search` → `timeline` → `get_observations` → `middle.jsonl`.\n- A second cycle produces no duplicate lines (dedupe holds).\n- Exclude one id → gone from the middle cache, still returned by the worker (`GET \u002Fapi\u002Fobservation\u002FN`).\n- A rules report is produced (or an explicit `MISS` on a box with no agent-data tree).\n- User-facing strings say **Alex**, never \"Az\"; no \"context compiler shipped \u002F brainbeat is live \u002F we compiled awareness\" claims (only future \u002F not-this-plan wording).\n\n**Prove nothing regressed (§3.2):** run the tests in the Verification section below, including the #3931 pusher and transcript tests. #3931 behavior must stay: LFG\u002FOrifice still get `[awareness]` lines from the **worker pusher**, not from Align.\n\n**Anti-pattern grep (§3.3):** no `DELETE \u002Fapi\u002Fobservation`, no `notifyGrokBotAwareness`, no `processAgentResponse` reuse in the seat helpers (forbid\u002Fcomment mentions are fine — the seat must not *use* them).\n\n**Sign-off (§3.4):** this skill can be run by a Worker Watch seat with no extra product context; the shipped defaults still match the D-rows; the Prioritizer can roll this up as \"CCS Align Phase 0 green \u002F Phase 1 marks \u002F Phase 2 report.\"\n\nSee `plans\u002F2026-09-09-ccs-align.md` §3 for the full contract.\n\n## Later phases (documented, not implemented)\n\n- **Full brainbeat \u002F context compiler \u002F `.cas` runtime** — future work, paper scaffold, out of this plan.\n- **Attention trough \u002F curse-salience, Focus\u002Fmouth egress enforcement** — different agents \u002F backlog; hard forbids here.\n\nSee `plans\u002F2026-09-09-ccs-align.md` \"Explicit non-goals\" for the full list.\n\n## Verification (Phase 0 + Phase 1 + Phase 2)\n\n```bash\nbun test tests\u002Fintegrations\u002Fccs-align-middle-cache.test.ts\n# Phase 0: format\u002Ftruncate, needle match, append, dedupe, path safety, never-throw, cursor round-trip\n# Phase 1: mark drop, diary present, tool ids not in middle.jsonl, viewer isolation,\n#           unmark+rebuild, exclude-marks round-trip, buildExcludeSet, secure-isolation,\n#           corrupt marks fail-closed, marked ids skipped on ingest\n\nbun test tests\u002Fintegrations\u002Fccs-align-rules-walker.test.ts\n# Phase 2: SHADOW_HOUSE detection (exact dup + \"House rule\" prefix), default report-only\n#           (leaf unchanged), patchShadows=true (leaf loses duplicates, house unchanged),\n#           never patches standing\u002Falways\u002Fnever, MISS on absent paths, CLOCK_HEADER detection,\n#           DENY_ALLOW detection, DRIFT detection, append-only report, atomic patch,\n#           full walkRules integration, edge cases\n\n# #3931 must not regress — LFG\u002FOrifice still get [awareness] lines from the worker pusher, not Align\nbun test tests\u002Fintegrations\u002Fgrok-bot-awareness-pusher.test.ts\n```\n\nVerification greps (plan §2.3):\n\n```bash\n# Report path documented\nrg -n \"rules-report\" plugin\u002Fskills\u002Fccs-align\u002FSKILL.md\n# expect ≥1\n\n# Patch gated\nrg -n \"CCS_ALIGN_PATCH_SHADOWS\" plugin\u002Fskills\u002Fccs-align\u002FSKILL.md\n# expect ≥1\n```\n\nLive-box checks (house, not CI — a cloud VM may have no live worker; record a MISS if so):\n\n- `curl -sS \"http:\u002F\u002F127.0.0.1:$WORKER_PORT\u002Fapi\u002Fhealth\"` returns `status: ok`\n- After one cycle, `~\u002F.claude-mem\u002Fccs-align\u002Fccs-align\u002Fmiddle.jsonl` exists\n- A second cycle with the same observations does **not** grow the file (dedupe)\n- Mark observation N → next cycle drops N from `middle.jsonl`\n- SQLite \u002F `GET \u002Fapi\u002Fobservation\u002FN` still returns the row (diary is authoritative)\n- Linked tool-use ids on the mark never appear in `middle.jsonl`\n- Viewer B's cache does not contain viewer A's unique eval token\n- Unmark (remove from JSON) + cycle restores N on the next pull\n- `profile.md` under any `agents\u002F` path is byte-identical to before\n- LFG\u002FOrifice `memory\u002Flog\u002FYYYY-MM.md` unchanged by Align\n","# CCS Align — Worker Watch seat (Phases 0–2 shipped; Phase 3 = verify \u002F sign-off)\n\nCCS Align is a **standing seat**, not a bird's-eye planner. Its one job, once an hour: talk to the **local** claude-mem worker, pull recent needle observations through the existing three-layer disclosure ladder, and land them in a **seat-owned middle cache** using grab → append → replace.\n\nThis skill implements the Phase 0 breathing slice, Phase 1 exclude marks, and Phase 2 rules alignment from the plan of record, `plans\u002F2026-09-09-ccs-align.md`. Phases 0–2 are **shipped and merged** ([#3934](https:\u002F\u002Fgithub.com\u002Fthedotmack\u002Fclaude-mem\u002Fpull\u002F3934), [#3935](https:\u002F\u002Fgithub.com\u002Fthedotmack\u002Fclaude-mem\u002Fpull\u002F3935), [#3936](https:\u002F\u002Fgithub.com\u002Fthedotmack\u002Fclaude-mem\u002Fpull\u002F3936)); Phase 3 is **verify \u002F sign-off** (this loop) — no new product surface. It is **not** a context compiler, **not** Focus\u002Fmouth, and **not** Grok Memory Phase 2. When you speak to the human, address them as **Alex**.\n\n## What is implemented (Phases 0–2 shipped)\n\n- **Phase 0 — Breathing slice** ([#3934](https:\u002F\u002Fgithub.com\u002Fthedotmack\u002Fclaude-mem\u002Fpull\u002F3934)): health check → `search` → `timeline` → `get_observations` → append records to `~\u002F.claude-mem\u002Fccs-align\u002F\u003CviewerId>\u002Fmiddle.jsonl` (atomic, deduped).\n- **Phase 1 — Exclude marks** ([#3935](https:\u002F\u002Fgithub.com\u002Fthedotmack\u002Fclaude-mem\u002Fpull\u002F3935)): mark observations (and linked tool-use ids) as excluded from the compiled middle cache. \"Purge\" means the compiled `middle.jsonl` no longer contains the record — the diary \u002F SQLite stay authoritative. Unmarking + rebuild restores the observation. `DELETE \u002Fapi\u002Fobservation\u002F:id` is **forbidden**.\n- **Phase 2 — Rules alignment** ([#3936](https:\u002F\u002Fgithub.com\u002Fthedotmack\u002Fclaude-mem\u002Fpull\u002F3936)): walk house → project → seat layers, detect conflicts (`SHADOW_HOUSE`, `DENY_ALLOW`, `DRIFT`, `CLOCK_HEADER`), emit an append-only `rules-report.md`. Optionally dry-run\u002Fapply `SHADOW_HOUSE` leaf patches when `CLAUDE_MEM_CCS_ALIGN_PATCH_SHADOWS=true`. Runs every 6th hour of the hourly Worker Watch cycle (D4). This is a **checklist**, not a parser — no `.cas` compiler.\n- **Phase 3 — Verify \u002F sign-off** (this loop): re-run the regression tests and anti-pattern greps, prove the boundary (a scripted cycle dedupes, an exclude drops from the middle cache but not the diary, the rules report is produced or a MISS is recorded), and keep the skill + plan honest about what this seat is not. Phase 3 adds **no** new runtime behavior.\n- **Does not:** delete history, write `profile.md`, write LFG\u002FOrifice `[awareness]` logs (that seam belongs to [#3931](https:\u002F\u002Fgithub.com\u002Fthedotmack\u002Fclaude-mem\u002Fpull\u002F3931)), add a sixth `processAgentResponse` consumer, restart the worker, run a per-turn drip update, enforce Focus\u002Fmouth\u002Fstanding rules, or copy house text into seats.\n\n## What this is NOT (honest boundary)\n\nCCS Align is deliberately small. It does **not** ship, and this loop does **not** add, any of the following — these are future work or a different agent, called out so no one reads more into the seat than is there:\n\n- **No context compiler.** There is no `.cas` parser, no `compileAwareness()`, no JIT compile, no computed-styles UI. The CCS Notion page types (`Bucket`, `canRead`) are teaching copy quoted as comments — never a runtime parser.\n- **No brainbeat product.** The \"regenerate awareness once per finished unit of work\" door is not built. Align *pulls* on an hourly cadence; it is not a per-turn drip and it is not a brainbeat.\n- **No attention trough \u002F curse-salience.** No salience decay, no trough scoring. Explicitly out of every phase.\n- **No Focus \u002F mouth enforcement.** Standing rules (always \u002F never \u002F danger) are never enforced or decayed here. Align may *list* a conflict; egress filtering belongs to a different agent.\n- **No second writer on LFG\u002FOrifice `[awareness]` logs.** [#3931](https:\u002F\u002Fgithub.com\u002Fthedotmack\u002Fclaude-mem\u002Fpull\u002F3931) owns `agents\u002F**\u002Fmemory\u002Flog\u002FYYYY-MM.md`. Align writes only its seat-owned middle cache.\n- **No history rewrite.** Exclude marks filter the *compiled* cache; the diary \u002F SQLite stay authoritative and rebuildable. No `DELETE \u002Fapi\u002Fobservation`, no A-MEM row rewrite.\n\n### Ops MISS — worker plugin version lag\n\nAs of this sign-off, the repo (package, plugin, marketplace) is at **13.24.5** (this Phase 3 PATCH), but the **running worker plugin on the house box may still be 13.24.1**. That is an **operational MISS to record, not fix here**: this seat does not restart or upgrade the worker (a hard forbid). If the live box still shows 13.24.1, note it when rolling status up to the Prioritizer so the worker gets restarted onto the current plugin out-of-band. If the running worker already matches the package version, this MISS is closed.\n\n## Prerequisites\n\nThe claude-mem worker must be running locally. This seat talks to the **local worker** (per-UID port ~`37700`), never the cloud CMEM MCP — cloud `observation:\u003Cbase64>` ids are a different API and must not be mixed in.\n\n**Resolve the worker port** once and reuse `$WORKER_PORT` in every curl below. This snippet is copied from the `timeline-report` skill and honors `CLAUDE_MEM_WORKER_PORT` → `~\u002F.claude-mem\u002Fsettings.json` → the per-UID default `37700 + (uid % 100)`:\n\n```bash\nWORKER_PORT=\"${CLAUDE_MEM_WORKER_PORT:-$(node -e \"const fs=require('fs'),p=require('path'),os=require('os');const uid=(typeof process.getuid==='function'?process.getuid():77);const fallback=String(37700+(uid%100));try{const s=JSON.parse(fs.readFileSync(p.join(os.homedir(),'.claude-mem','settings.json'),'utf-8'));process.stdout.write(String(s.CLAUDE_MEM_WORKER_PORT||fallback));}catch{process.stdout.write(fallback);}\" 2>\u002Fdev\u002Fnull)}\"\n```\n\nDo **not** hardcode port `37777` — ports are per-UID.\n\n## Settings\n\nDefaults live in `SettingsDefaultsManager.ts`; override in `~\u002F.claude-mem\u002Fsettings.json`:\n\n| Key | Default | Meaning |\n|---|---|---|\n| `CLAUDE_MEM_CCS_ALIGN_ENABLED` | `true` | Master switch for the seat. |\n| `CLAUDE_MEM_CCS_ALIGN_VIEWER_IDS` | `ccs-align` | Comma-separated viewer ids the seat maintains a cache for. |\n| `CLAUDE_MEM_CCS_ALIGN_TRIGGER_TYPES` | `decision,bugfix,security_alert,sensitive` | Needle observation types to pull (copied from #3931's list, D6). |\n| `CLAUDE_MEM_CCS_ALIGN_PATCH_SHADOWS` | `false` | Phase 2 rules-shadow patch gate. When `true`, the rules walker removes `SHADOW_HOUSE` duplicate lines from leaf files (atomic temp+rename). Default **off** — report-only. |\n\nPilot viewer id is `ccs-align`. The seat **may read** LFG observations (agent id `521e962d-2ec3-4488-bfbc-54d5209ce118`) as a project filter, but **must not write** LFG\u002FOrifice monthly logs or any `profile.md`.\n\n## Hourly cycle (Appendix A runbook)\n\nRun this every hour on a weekday house board. One purpose. No watercooler. No \"while I was here I also…\".\n\n```\nevery hour (weekday house board):\n  1. Resolve WORKER_PORT (snippet above)\n  2. GET \u002Fapi\u002Fhealth || GET \u002Fhealth   → abort with a one-line miss if down\n  3. search(obs_type=needles, limit=20) since cursor.lastObservationId\n  4. timeline(anchor=newest)          → collect neighbor ids\n  5. get_observations(ids=…)\n  5b. (Phase 1, mark-time only) If excluding: get_tool_uses for tool ids → record on mark\n  6. grab middle.jsonl → append new → filter exclude-marks → replace atomic\n  7. if original-cache path set and not writable: append-only to middle.jsonl (already done)\n  8. update cursor.json\n  9. every 6th hour: rules walk → append rules-report.md   (Phase 2 — see below)\n 10. Speak to Alex only on red (worker down, write refused, unexpected profile.md touch)\n```\n\n### Step 1 — Resolve the port\n\nUse the `$WORKER_PORT` snippet above.\n\n### Step 2 — Prove worker health (prefer `\u002Fapi\u002Fhealth`)\n\nPrefer `GET \u002Fapi\u002Fhealth`; also accept the viewer alias `GET \u002Fhealth`. The public worker docs still show `GET \u002Fhealth` and a `port` field — both are stale. Health does **not** return a port; use `GET \u002Fapi\u002Fstats` (`worker.port`) if you need it.\n\n```bash\ncurl -sS \"http:\u002F\u002F127.0.0.1:${WORKER_PORT}\u002Fapi\u002Fhealth\" || curl -sS \"http:\u002F\u002F127.0.0.1:${WORKER_PORT}\u002Fhealth\"\n# expect a JSON body with \"status\":\"ok\". If the worker is down, abort with a\n# one-line miss — do NOT start it, do NOT retry aggressively.\n```\n\nIf health cannot be proven (e.g. no live worker in a cloud VM), record a **MISS** and stop. Do not fabricate a cache cycle.\n\n### Step 3 — Pull through the three-layer ladder (in order)\n\nThe disclosure order is **`search` → `timeline` → `get_observations`**. Never jump straight to `get_observations`, and do **not** call `get_tool_uses` in Phase 0 (that is Phase 1).\n\n1. **`search`** with the needle `obs_type` list (`CLAUDE_MEM_CCS_ALIGN_TRIGGER_TYPES`), `limit` ≤ 20, optionally scoped by `project`. Use the cursor's `lastObservationId` to avoid re-pulling the whole diary.\n\n   ```bash\n   curl -sS \"http:\u002F\u002F127.0.0.1:${WORKER_PORT}\u002Fapi\u002Fsearch?query=*&type=decision&limit=20&format=json\"\n   ```\n\n2. **`timeline`** anchored on the newest hit. The worker's **code default depth is 10** (`SearchManager.ts`) — the MCP text that says \"3\" is stale, so omit the depths (worker applies 10) or pass `10` explicitly.\n\n   ```bash\n   curl -sS \"http:\u002F\u002F127.0.0.1:${WORKER_PORT}\u002Fapi\u002Ftimeline?anchor=\u003CnewestObservationId>\"\n   ```\n\n3. **`get_observations`** for the ids you will actually cache.\n\n   ```bash\n   curl -sS -X POST \"http:\u002F\u002F127.0.0.1:${WORKER_PORT}\u002Fapi\u002Fobservations\u002Fbatch\" \\\n     -H 'content-type: application\u002Fjson' \\\n     -d '{\"ids\":[12345,12346]}'\n   ```\n\nThe MCP twins are `search` → `timeline` → `get_observations`. Worker `get_observations` ids are **numbers**; do not pass cloud `observation:\u003Cbase64>` ids into `\u002Fapi\u002Fobservations\u002Fbatch`.\n\n### Step 4 — Grab → append → filter exclude-marks → replace (atomic middle cache)\n\nLand the observations with the seat helper `src\u002Fservices\u002Fintegrations\u002FCcsAlignMiddleCache.ts`\n(`landObservationsInMiddleCache`). It copies the #3931 atomic primitive\n(`appendAwarenessLineAtomic` + `awarenessLineBody`) with exactly three changes:\nthe tag is `[ccs-align]`, the path root is `~\u002F.claude-mem\u002Fccs-align\u002F\u003CviewerId>\u002F`,\nand the file is `middle.jsonl`.\n\nPhase 1 adds an exclude-marks filter inside the atomic pipeline:\n\n```\ngrab:    read middle.jsonl if it exists, else empty\nfilter:  load exclude-marks.json; drop any record whose id is marked\nappend:  for each new observation id not already present AND not marked, append one record\nreplace: write temp + rename (copy appendAwarenessLineAtomic; never appendFileSync)\nfallback: if an OPTIONAL original-cache path is set and not writable, skip grab\u002Freplace\n          on that path and append timeline items to middle.jsonl only\n```\n\nThere is **no compiled laminate file in-repo**, so the fallback resolves to\n\"append to the seat file\" — never invent a laminate.\n\nEach line of `middle.jsonl` is one record. The shape is **locked** for Phase 0 (do not add fields):\n\n```json\n{\n  \"v\": 1,\n  \"id\": 12345,\n  \"type\": \"decision\",\n  \"title\": \"…\",\n  \"created_at\": \"2026-09-09T00:00:00.000Z\",\n  \"project\": \"claude-mem\",\n  \"agent_id\": null,\n  \"source\": \"worker\",\n  \"line\": \"- 2026-09-09 [ccs-align] decision — «…»\"\n}\n```\n\n`line` is `formatCcsAlignLine`: the awareness line format with the tag swapped,\nwritten by the same shared formatter, so the recalled text is sanitized (no tag\nframing or invisible characters) and fenced in `«…»`, truncated inside the fence\nto 500 chars. Dedupe is by observation `id` **and**\nby body (the line from `[ccs-align]` onward, date excluded), so the same fact on\na new day is still skipped and the file does not grow on a repeat cycle.\n\nA minimal invocation (bun\u002Fnode):\n\n```ts\nimport { landObservationsInMiddleCache } from '..\u002F..\u002Fsrc\u002Fservices\u002Fintegrations\u002FCcsAlignMiddleCache.js';\n\nlandObservationsInMiddleCache({\n  viewerId: 'ccs-align',\n  observations: rowsFromGetObservations, \u002F\u002F [{ id, type, title, subtitle, facts, created_at, project, agent_id }]\n});\n```\n\nIt **never throws** into the caller — a broken write path is logged and swallowed.\n\n### Step 5 — Update the cursor\n\nWrite `~\u002F.claude-mem\u002Fccs-align\u002F\u003CviewerId>\u002Fcursor.json` so the next hour does not re-pull the whole diary:\n\n```json\n{ \"lastRunAt\": \"…\", \"lastObservationId\": 12345, \"healthPath\": \"\u002Fapi\u002Fhealth\", \"workerPort\": 37700 }\n```\n\nUse `writeCursor` from the helper (atomic temp + rename).\n\n### Step 6 — Speak only on red\n\nRoll status **up** to the Prioritizer. Only speak to Alex on red: worker down, a write was refused, or an unexpected `profile.md` touch. Otherwise stay quiet.\n\n## Phase 1 — Exclude marks\n\n\"Purge\" means the compiled `middle.jsonl` no longer contains the observation or its tool I\u002FO for that viewer. The diary stays. This is Secure Isolated Awareness + context-stripper — **not** delete.\n\n### Exclude-marks file\n\nEach viewer has `~\u002F.claude-mem\u002Fccs-align\u002F\u003CviewerId>\u002Fexclude-marks.json`:\n\n```json\n{\n  \"v\": 1,\n  \"marks\": [\n    {\n      \"observationId\": 12345,\n      \"toolUseIds\": [\"toolu_01abc\", 678],\n      \"reason\": \"sibling-wall|manual|stripper|secure-isolation\",\n      \"markedAt\": \"2026-09-09T00:00:00.000Z\",\n      \"markedBy\": \"ccs-align\"\n    }\n  ]\n}\n```\n\nMarks are managed by `addExcludeMark` \u002F `removeExcludeMark` in `CcsAlignMiddleCache.ts`, or by manual JSON edit.\n\n### How marks get created (v1)\n\n1. **Manual JSON edit** — open `exclude-marks.json` and add a mark entry.\n2. **Skill flag** — `exclude \u003CobservationId> --reason …` (manual, sibling-wall, stripper, secure-isolation).\n3. No auto-promotion from chat text (poison surface — see Memory dig findings).\n\n### Purge tools (compiled only)\n\nWhen recording tool-use ids on a mark:\n\n1. After `get_observations`, if you need tool ids, call `get_tool_uses` \u002F `POST \u002Fapi\u002Ftool-uses\u002Fbatch` (layer 4).\n2. Record those ids on the mark's `toolUseIds` array.\n3. **Never persist raw `tool_input` \u002F `tool_response` into `middle.jsonl`** — layer 4 stays out of the laminate.\n4. **Do not** call `DELETE \u002Fapi\u002Fobservation\u002F:id` — that tombstones the diary and breaks rebuild-from-history.\n\n> **Warning:** `get_tool_uses` is **layer 4** of the progressive disclosure ladder. It returns raw tool I\u002FO and should only be called at mark-time to capture tool-use ids for an exclude mark. Never call it during the normal hourly cycle. Never persist its `tool_input` \u002F `tool_response` payloads into any cache file.\n\n### Unmark + rebuild\n\nTo restore a previously excluded observation:\n\n1. Remove the mark from `exclude-marks.json` (`removeExcludeMark` or manual edit).\n2. Re-pull the diary through the three-layer ladder (`search` → `timeline` → `get_observations`).\n3. Call `rebuildMiddleCache` to clear and re-land the compiled file from the authoritative diary.\n\nThe observation reappears in `middle.jsonl` on the next cycle because the diary was never touched.\n\n### Viewer isolation\n\nEach viewer's middle cache is independent:\n\n- `~\u002F.claude-mem\u002Fccs-align\u002Fviewer-a\u002Fmiddle.jsonl`\n- `~\u002F.claude-mem\u002Fccs-align\u002Fviewer-b\u002Fmiddle.jsonl`\n\nObservations landed for viewer A never appear in viewer B's compiled file. Exclude marks for viewer A do not affect viewer B. This implements the Secure Isolated Awareness property: inject a unique eval token into viewer A's cache → run viewer B → assert A's token never appears in B's compiled file.\n\n### Programmatic usage\n\n```ts\nimport {\n  addExcludeMark,\n  removeExcludeMark,\n  rebuildMiddleCache,\n  ccsAlignExcludeMarksPath,\n  readExcludeMarks,\n} from '..\u002F..\u002Fsrc\u002Fservices\u002Fintegrations\u002FCcsAlignMiddleCache.js';\n\nconst marksPath = ccsAlignExcludeMarksPath(dataRoot, 'ccs-align');\n\n\u002F\u002F Mark an observation as excluded (with optional tool-use ids)\naddExcludeMark(marksPath, 12345, ['toolu_01abc'], 'manual');\n\n\u002F\u002F Unmark and rebuild\nremoveExcludeMark(marksPath, 12345);\nrebuildMiddleCache({\n  viewerId: 'ccs-align',\n  observations: allObservationsFromDiary,\n  dataRoot,\n});\n```\n\n## Hard forbids (every phase)\n\n- ❌ `DELETE \u002Fapi\u002Fobservation\u002F:id` — tombstone ≠ exclude mark; breaks rebuild-from-history.\n- ❌ Writing LFG\u002FOrifice `[awareness]` logs, or into any `agents\u002F**\u002Fmemory\u002Flog\u002F` path.\n- ❌ Writing `profile.md`, user-memory, or project memory.\n- ❌ A top-of-prompt clock (timestamps belong on facts, not a cache header).\n- ❌ `POST \u002Fapi\u002Fcontext\u002Fsemantic` (per-turn drip the awareness design forbids).\n- ❌ A sixth `processAgentResponse` consumer — CCS Align **pulls**; #3931 owns that seam.\n- ❌ Restarting the worker, or `POST \u002Fapi\u002Fsettings`.\n- ❌ Addressing the human as \"Az\". Always **Alex**.\n- ❌ Claiming a context compiler \u002F brainbeat shipped. Those are future work.\n- ❌ \"Fixing\" deny\u002Fallow by flipping rules — report only.\n- ❌ Copying house text into seats — that is the bug this phase detects.\n- ❌ Building a `.cas` compiler so the report looks smarter.\n- ❌ Patching standing \u002F Focus \u002F always \u002F never \u002F danger files.\n- ❌ Attention trough \u002F curse-salience experiments (Phase-N backlog only).\n\n## Phase 2 — Rules alignment (house → project → seat)\n\nEvery 6th hour of the hourly Worker Watch cycle (D4), the seat walks house → project → seat layers to detect and report rules conflicts. This is a **checklist**, not a parser. No `.cas` compiler.\n\n### Cascade rules (from Notion CCS)\n\n- Write once at HOUSE; seats inherit\n- A leaf copy **shadows** the cascade (bug, not feature)\n- Deny beats allow\n- Siblings deny heavy buckets (`obs`, `note`, `person`) by default\n- Fail closed: if no rule exists, deny\n\n### Layer walk\n\n| Layer | Where to look (house box) | Bucket |\n|---|---|---|\n| House | `user-memory\u002F` shared profile; Notion CCS `:root` | `profile`, `standing`, `owns` |\n| Project | `.cmem-projects\u002F\u003Cproject>\u002F`, repo `CLAUDE.md` | project overrides |\n| Seat | `agents\u002F\u003Cuuid>\u002Fprofile.md`, `agents\u002F\u003Cuuid>\u002Fmemory\u002F` | leaf — must not duplicate house |\n\nOn a box with no agent-data tree, the report records `MISS: house-box paths` and exits cleanly.\n\n### Conflict classes (v1)\n\n| Code | Pattern | Agency |\n|---|---|---|\n| `SHADOW_HOUSE` | Leaf file contains a line that also exists at house (or starts with `House rule`) | Dry-run remove-from-leaf; apply only if `CLAUDE_MEM_CCS_ALIGN_PATCH_SHADOWS=true` |\n| `DENY_ALLOW` | Same bucket allow at one layer, deny at another | Report only |\n| `DRIFT` | House text changed; leaf still has old wording (partial prefix match) | Report only |\n| `CLOCK_HEADER` | Top-of-prompt clock \u002F \"current time is\" in a profile | Report only (house rule: no clock in the prefix) |\n\n### Rules report\n\nOutput: `~\u002F.claude-mem\u002Fccs-align\u002F\u003CviewerId>\u002Frules-report.md` — dated, append-only sections. Each run appends a new section with a timestamp, a table of conflicts, any MISS entries, and a patches-applied count. Status rolls **up** to Prioritizer (never peer spam).\n\n### Limited patch (D8 default off)\n\nWhen `CLAUDE_MEM_CCS_ALIGN_PATCH_SHADOWS=true`:\n\n1. Only `SHADOW_HOUSE` conflicts are patched — never `DENY_ALLOW`, `DRIFT`, or `CLOCK_HEADER`.\n2. The would-be diff is written into the report **before** any patch is applied.\n3. The leaf file is copied, duplicate lines are stripped, and the file is replaced atomically (temp + rename, same primitive as `CcsAlignMiddleCache`).\n4. **Never patches `standing` \u002F Focus \u002F `always.md` \u002F `never.md` \u002F `danger.md` \u002F `profile.md`.**\n5. House files are never modified.\n\n### Programmatic usage\n\n```ts\nimport {\n  walkRules,\n  discoverLayerPaths,\n  type RulesWalkerConfig,\n} from '..\u002F..\u002Fsrc\u002Fservices\u002Fintegrations\u002FCcsAlignRulesWalker.js';\n\n\u002F\u002F Discover paths on the current box\nconst paths = discoverLayerPaths({ project: 'claude-mem' });\n\nconst config: RulesWalkerConfig = {\n  dataRoot: '~\u002F.claude-mem',\n  viewerId: 'ccs-align',\n  patchShadows: false,  \u002F\u002F report-only by default\n  housePaths: paths.housePaths,\n  projectPaths: paths.projectPaths,\n  seatPaths: paths.seatPaths,\n};\n\nconst result = walkRules(config);\n\u002F\u002F result.conflicts — array of detected conflicts\n\u002F\u002F result.misses — paths that were not found\n\u002F\u002F result.reportPath — path to the appended rules-report.md\n\u002F\u002F result.patchesApplied — number of SHADOW_HOUSE lines removed (0 if patchShadows=false)\n```\n\n## Phase 3 — Verify \u002F sign-off (plan §3)\n\nPhase 3 closes the plan loop. It proves the seat is hourly-runnable, documented, and honest about what it is not — it does **not** add runtime behavior.\n\n**Prove the boundary, not the code (§3.1):**\n\n- One scripted cycle: health → `search` → `timeline` → `get_observations` → `middle.jsonl`.\n- A second cycle produces no duplicate lines (dedupe holds).\n- Exclude one id → gone from the middle cache, still returned by the worker (`GET \u002Fapi\u002Fobservation\u002FN`).\n- A rules report is produced (or an explicit `MISS` on a box with no agent-data tree).\n- User-facing strings say **Alex**, never \"Az\"; no \"context compiler shipped \u002F brainbeat is live \u002F we compiled awareness\" claims (only future \u002F not-this-plan wording).\n\n**Prove nothing regressed (§3.2):** run the tests in the Verification section below, including the #3931 pusher and transcript tests. #3931 behavior must stay: LFG\u002FOrifice still get `[awareness]` lines from the **worker pusher**, not from Align.\n\n**Anti-pattern grep (§3.3):** no `DELETE \u002Fapi\u002Fobservation`, no `notifyGrokBotAwareness`, no `processAgentResponse` reuse in the seat helpers (forbid\u002Fcomment mentions are fine — the seat must not *use* them).\n\n**Sign-off (§3.4):** this skill can be run by a Worker Watch seat with no extra product context; the shipped defaults still match the D-rows; the Prioritizer can roll this up as \"CCS Align Phase 0 green \u002F Phase 1 marks \u002F Phase 2 report.\"\n\nSee `plans\u002F2026-09-09-ccs-align.md` §3 for the full contract.\n\n## Later phases (documented, not implemented)\n\n- **Full brainbeat \u002F context compiler \u002F `.cas` runtime** — future work, paper scaffold, out of this plan.\n- **Attention trough \u002F curse-salience, Focus\u002Fmouth egress enforcement** — different agents \u002F backlog; hard forbids here.\n\nSee `plans\u002F2026-09-09-ccs-align.md` \"Explicit non-goals\" for the full list.\n\n## Verification (Phase 0 + Phase 1 + Phase 2)\n\n```bash\nbun test tests\u002Fintegrations\u002Fccs-align-middle-cache.test.ts\n# Phase 0: format\u002Ftruncate, needle match, append, dedupe, path safety, never-throw, cursor round-trip\n# Phase 1: mark drop, diary present, tool ids not in middle.jsonl, viewer isolation,\n#           unmark+rebuild, exclude-marks round-trip, buildExcludeSet, secure-isolation,\n#           corrupt marks fail-closed, marked ids skipped on ingest\n\nbun test tests\u002Fintegrations\u002Fccs-align-rules-walker.test.ts\n# Phase 2: SHADOW_HOUSE detection (exact dup + \"House rule\" prefix), default report-only\n#           (leaf unchanged), patchShadows=true (leaf loses duplicates, house unchanged),\n#           never patches standing\u002Falways\u002Fnever, MISS on absent paths, CLOCK_HEADER detection,\n#           DENY_ALLOW detection, DRIFT detection, append-only report, atomic patch,\n#           full walkRules integration, edge cases\n\n# #3931 must not regress — LFG\u002FOrifice still get [awareness] lines from the worker pusher, not Align\nbun test tests\u002Fintegrations\u002Fgrok-bot-awareness-pusher.test.ts\n```\n\nVerification greps (plan §2.3):\n\n```bash\n# Report path documented\nrg -n \"rules-report\" plugin\u002Fskills\u002Fccs-align\u002FSKILL.md\n# expect ≥1\n\n# Patch gated\nrg -n \"CCS_ALIGN_PATCH_SHADOWS\" plugin\u002Fskills\u002Fccs-align\u002FSKILL.md\n# expect ≥1\n```\n\nLive-box checks (house, not CI — a cloud VM may have no live worker; record a MISS if so):\n\n- `curl -sS \"http:\u002F\u002F127.0.0.1:$WORKER_PORT\u002Fapi\u002Fhealth\"` returns `status: ok`\n- After one cycle, `~\u002F.claude-mem\u002Fccs-align\u002Fccs-align\u002Fmiddle.jsonl` exists\n- A second cycle with the same observations does **not** grow the file (dedupe)\n- Mark observation N → next cycle drops N from `middle.jsonl`\n- SQLite \u002F `GET \u002Fapi\u002Fobservation\u002FN` still returns the row (diary is authoritative)\n- Linked tool-use ids on the mark never appear in `middle.jsonl`\n- Viewer B's cache does not contain viewer A's unique eval token\n- Unmark (remove from JSON) + cycle restores N on the next pull\n- `profile.md` under any `agents\u002F` path is byte-identical to before\n- LFG\u002FOrifice `memory\u002Flog\u002FYYYY-MM.md` unchanged by Align\n",{"name":5,"description":7},"main","3fae1eb45ba1a7fbd4818527f48b439991a273da","plugin\u002Fskills\u002Fccs-align","https:\u002F\u002Fgithub.com\u002FPrasanth595\u002Fclaude-mem-mirror","https:\u002F\u002Fgithub.com\u002FPrasanth595","https:\u002F\u002Flinktr.ee\u002Fprasanth_","Senior DevOps Engineer · Kubernetes | Terraform | AWS · Azure · GCP — open to remote opportunities","2026-10-19 20:21:01",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add Prasanth595\u002Fclaude-mem-mirror --skill ccs-align",{"tool":38,"command":39},"bunx","bunx skills add Prasanth595\u002Fclaude-mem-mirror --skill ccs-align",{"tool":41,"command":42},"pnpm","pnpm dlx skills add Prasanth595\u002Fclaude-mem-mirror --skill ccs-align","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FPrasanth595\u002Fclaude-mem-mirror\u002Fblob\u002Fmain\u002Fplugin\u002Fskills\u002Fccs-align\u002FSKILL.md",true,[],[47,54,61,68,75,82],{"skillNo":48,"name":49,"nameZh":6,"description":50,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":51,"categories":52,"keywords":53,"publishedAt":19},"01M7F5FKF932NX0T4D2KFWECC0","wowerpoint","Turn one document into a kawaii NotebookLM slide deck. Use for \"wowerpoint this\", \"make a deck about \u003Cfile>\", \"turn this report into slides\", or any request to render a single document as shareable narrative slides.","https:\u002F\u002Fgithub.com\u002FPrasanth595\u002Fclaude-mem-mirror\u002Fblob\u002Fmain\u002Fplugin\u002Fskills\u002Fwowerpoint\u002FSKILL.md",[],[],{"skillNo":55,"name":56,"nameZh":6,"description":57,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":58,"categories":59,"keywords":60,"publishedAt":19},"01M7F5FH7ASJYF41X6F8SGYH2Y","what-the","What the? Use when the user wants a plain-English breakdown of something technical — the who, what, where, why, and when.","https:\u002F\u002Fgithub.com\u002FPrasanth595\u002Fclaude-mem-mirror\u002Fblob\u002Fmain\u002Fplugin\u002Fskills\u002Fwhat-the\u002FSKILL.md",[],[],{"skillNo":62,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":19},"01M7F5FA3S3BFG7Q8YXBG5AA3Z","weekly-digests","Generate a serial week-by-week narrative digest of a project's full claude-mem timeline. Splits the timeline into per-ISO-week files, then runs one consecutive subagent per week — each receiving the prior week's carry-forward block — to produce one chapter per ISO week of data. Use when asked for \"weekly digests\", \"week-by-week story\", \"serial timeline\", or \"narrative chapters\" of a project's history.","https:\u002F\u002Fgithub.com\u002FPrasanth595\u002Fclaude-mem-mirror\u002Fblob\u002Fmain\u002Fplugin\u002Fskills\u002Fweekly-digests\u002FSKILL.md",[],[],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":19},"01M7F5F5SKSTF4161VCS1PJXWQ","version-bump","Automated semantic versioning and release workflow for Claude Code plugins. Handles version increments across package.json, marketplace.json, plugin.json manifests, build verification, git tagging, GitHub releases, and changelog generation. Ends with the agent running npm publish itself using the maintainer's npm token.","https:\u002F\u002Fgithub.com\u002FPrasanth595\u002Fclaude-mem-mirror\u002Fblob\u002Fmain\u002Fplugin\u002Fskills\u002Fversion-bump\u002FSKILL.md",[],[],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":19},"01M7F5F1W1TNCJWDJFSNV133Z7","timeline-report","Generate a \"Journey Into [Project]\" narrative report analyzing a project's entire development history from claude-mem's timeline. Use when asked for a timeline report, project history analysis, development journey, or full project report.","https:\u002F\u002Fgithub.com\u002FPrasanth595\u002Fclaude-mem-mirror\u002Fblob\u002Fmain\u002Fplugin\u002Fskills\u002Ftimeline-report\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":19},"01M7F5EYXHFVZPB3PYD4296NJY","standup","Facilitate a read-only standup across git worktrees, branches, or PRs to compare changes and produce one consolidation plan.","https:\u002F\u002Fgithub.com\u002FPrasanth595\u002Fclaude-mem-mirror\u002Fblob\u002Fmain\u002Fplugin\u002Fskills\u002Fstandup\u002FSKILL.md",[],[]]