Skip to content

Self-evolving second brain with 35 AI skills, 10 agents, and people CRM. Closed-loop harness: a V-model verification lifecycle where the worker never grades its own homework. Plus paired anti-slop design skills for marketing and product UI. Works with Claude Code, Cursor, Kiro, Gemini CLI, Codex.

Add runtime-trust release: memory hygiene, post-condition checks, content factory (v3.7.0)

Huy Tieu9001d4c096fa
diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json
index 8359685..41db627 100644
--- a/.claude-plugin/plugin.json
+++ b/.claude-plugin/plugin.json
@@ -1,7 +1,7 @@
{
"name": "cog-second-brain",
- "version": "3.6.0",
- "description": "Self-evolving second brain with 19 AI agent skills, 6 worker agents, and people CRM. Iterative skills are loop-engineered (deterministic verifiers, layered termination, in-loop context management). Inspired by Garry Tan's gstack specialist sessions and gbrain knowledge patterns. Works with Claude Code, Cursor, Kiro, Gemini CLI, Codex, and any markdown-reading agent.",
+ "version": "3.7.0",
+ "description": "Self-evolving second brain with 21 AI agent skills, 6 worker agents, and people CRM. Runtime-trust release: memory hygiene sweeps (stale-but-confident), skill post-condition checks (confident-but-unchecked), verbatim citations with adversarial verifier pass, and an autonomous content factory. Iterative skills are loop-engineered (deterministic verifiers, layered termination, in-loop context management). Inspired by Garry Tan's gstack specialist sessions and gbrain knowledge patterns. Works with Claude Code, Cursor, Kiro, Gemini CLI, Codex, and any markdown-reading agent.",
"author": {
"name": "Huy Tieu",
"url": "https://github.com/huytieu"
@@ -37,7 +37,12 @@
"note-taking",
"specialist-sessions",
"loop-engineering",
- "agent-loop"
+ "agent-loop",
+ "memory-hygiene",
+ "runtime-trust",
+ "content-factory",
+ "verification",
+ "skill-distillation"
],
"category": "productivity",
"tags": [
@@ -116,6 +121,16 @@
"path": ".claude/skills/update-cog/SKILL.md",
"description": "Check for and apply upstream COG framework updates without touching personal content"
},
+ {
+ "name": "memory-hygiene",
+ "path": ".claude/skills/memory-hygiene/SKILL.md",
+ "description": "Periodic trust sweep of persistent memory - re-verify environment-dependent claims, stamp last_verified + confidence, propose archiving drifted entries"
+ },
+ {
+ "name": "content-factory",
+ "path": ".claude/skills/content-factory/SKILL.md",
+ "description": "Autonomous content pipeline - scout announcements, triage by trend momentum and personal angle, produce and publish with ledger dedup, volume caps, and post-condition verification"
+ },
{
"name": "auto-research",
"path": ".claude/skills/auto-research/SKILL.md",
@@ -165,12 +180,15 @@
"Git version control for tracking thinking evolution",
"Agent-surface validator for manifest/docs consistency",
"Worker agent architecture with model routing (Sonnet workers, Opus lead)",
- "People CRM with tiered enrichment and evidence-based profiles"
+ "People CRM with tiered enrichment and evidence-based profiles",
+ "Runtime trust: memory-hygiene sweeps with last_verified + confidence stamps",
+ "Skill post-condition checks - observe the mutated artifact before reporting success",
+ "Skill distillation pattern: explore once with a strong model, execute cheap with a small one"
],
"requirements": {
"obsidian": "Recommended for markdown file management",
"git": "Optional but recommended for version control and safe updates",
- "claudeCode": "Recommended for the full 19-skill native experience",
+ "claudeCode": "Recommended for the full 21-skill native experience",
"kiro": "Optional - ships 7 native core powers",
"geminiCli": "Optional - ships 7 native core commands",
"agentsMd": "Universal fallback surface for Codex and other markdown-reading agents"
@@ -182,7 +200,7 @@
"validation": "Run ./scripts/validate-agent-surface.sh before publishing or after framework updates"
},
"directoryStructure": {
- ".claude/skills": "19 Claude Code skills (full surface)",
+ ".claude/skills": "21 Claude Code skills (full surface)",
".claude/agents": "6 worker agent definitions for specialist sessions",
".claude/roles": "7 role packs for personalized skill and integration recommendations",
".kiro/powers": "7 Kiro powers (core workflows)",
@@ -198,16 +216,16 @@
},
"skillArchitecture": {
"type": "agent-skills",
- "skills": 19,
+ "skills": 21,
"workerAgents": 6,
"rolePacks": 7,
"invocation": "model-invoked",
"progressiveDisclosure": true,
"nativeSurfaces": {
- "claudeCode": 19,
+ "claudeCode": 21,
"kiro": 7,
"geminiCli": 7,
- "agentsMd": 19
+ "agentsMd": 21
},
"description": "Self-contained skills with worker agent delegation, full Claude Code surface, core native Kiro/Gemini surfaces, and AGENTS.md as the universal fallback"
}
diff --git a/.claude/skills/content-factory/SKILL.md b/.claude/skills/content-factory/SKILL.md
new file mode 100644
index 0000000..3aec376
--- /dev/null
+++ b/.claude/skills/content-factory/SKILL.md
@@ -0,0 +1,91 @@
+---
+name: content-factory
+description: Autonomous content pipeline - scout announcements in your field, triage by trend momentum and personal angle, produce posts/blogs/videos in your voice with ledger-based dedup, hard volume caps, and screenshot-verified publishing
+roles: [all]
+integrations: [web-search, web-fetch]
+---
+
+# COG Content Factory Skill
+
+## Purpose
+
+Act as the user's autonomous content creator: scout what just happened in their field, pick what is genuinely trending, and turn it into content in their voice — with zero duplicates, hard volume caps, and verification before anything counts as published. Designed to run unattended on a schedule (nightly) and to be safely re-runnable: **an empty run is a valid run; a low-quality post is not.**
+
+## When to Invoke
+
+- `/content-factory` / "run the content factory"
+- Scheduled runs (e.g. 2-4 times a night via cron/launchd)
+- "Turn today's news into content"
+
+## Prerequisites
+
+Reads the user's voice and beats from `00-inbox/MY-PROFILE.md` and topics from `00-inbox/MY-INTERESTS.md`. Publishing targets come from `00-inbox/MY-INTEGRATIONS.md` — skip disabled channels silently.
+
+## State Files (read FIRST, update LAST — this is the dedup backbone)
+
+- `04-projects/content-factory/ledger.md` — everything ever covered/published (topic slug, source URL, formats, links, date). NEVER cover a topic or source URL already in the ledger unless there is genuinely NEW news (a follow-up release counts; rephrasing the same launch does not).
+- `04-projects/content-factory/tonight-<YYYY-MM-DD>.md` — tonight's run log (create on first run of the night). Records what earlier runs scouted, parked, produced, and published, plus the remaining volume budget.
+- `04-projects/content-factory/sources.md` — the watchlist. Add sources you find valuable; prune dead ones.
+
+## Volume Budget (across ALL runs of one night, hard caps)
+
+| Channel | Max/night | Notes |
+|---------|-----------|-------|
+| Short social posts/threads | 2 | the volume channel; a thread counts as 1 |
+| Blog post | 1 | only when substance justifies it |
+| Short video | 1 | only if the idea is visual/demo-able |
+| Long-form professional post | 1 | only for a strong professional angle |
+| Long video / deep essay | 0 | never autonomous; propose in the run log |
+
+Track the budget in the tonight file. Later runs inherit what is left. Adjust caps to taste — the invariant is that caps exist and are enforced across runs, not per run.
+
+## Phase 1 — SCOUT (every run)
+
+1. Web-search for last-24h announcements across the user's watchlist topics, plus anything already trending.
+2. Fetch the watchlist blogs/changelogs in `sources.md`.
+3. If a browser integration is available, skim the user's social feeds for engagement signals — raw engagement numbers are the best trend signal.
+4. Timebox scouting to ~20 minutes of work.
+
+## Phase 2 — TRIAGE (score, don't vibe)
+
+Score each candidate 1-5 on:
+- **(a) trend momentum** — are major accounts and aggregators talking about it NOW?
+- **(b) beat fit** — does it fit one of the user's beats (from MY-PROFILE.md)?
+- **(c) unique angle** — can we add something ONLY this user can add (an experiment, a practitioner take, a contrarian read) — not a summary anyone could write?
+
+Sum ≥11 → produce. 8-10 → park in the tonight file for a later run to re-score. <8 → ignore.
+
+Dedup check before producing: topic slug + source URL against the ledger AND against the user's recent published posts (last ~20) if reachable.
+
+## Phase 3 — PRODUCE (format ladder — decide by substance, not ambition)
+
+- **Default: one short post or thread** — hook line, media attached, link last, minimal hashtags.
+- **Blog post** only when there are ≥3 original things to say or a real proof-of-concept with artifacts. If the user has a PoC beat: actually build the tiny PoC (timebox ~45 min) and publish the REAL result, including failures. Never fabricate PoC outcomes; "it broke here" is good content.
+- **Short video** when the idea is visual or demo-able in ≤60s.
+- Cross-link everything (video ↔ blog ↔ thread reference each other).
+
+## Phase 4 — PUBLISH (safety gates)
+
+1. **Environment gate**: if the publishing surface is unavailable, or the user appears to be actively using the browser/machine — DO NOT publish. Write finished bundles to `04-projects/content-factory/out/<date>/` and let a later run (or the user) publish.
+2. **Post-condition check (mandatory)**: after every publish, observe the artifact — screenshot the live post, curl the live URL — before recording it as published. Never report success from the publish call alone.
+3. Never engage in arguments, never quote-dunk, never reply to strangers. The factory only creates original posts on the user's own surfaces.
+4. Any screenshot must pass a credentials check (no account emails, tokens, or internal URLs visible).
+5. Never delete an already-engaged post; edit in place if a fix is needed.
+
+## Phase 5 — LEDGER + LOG (always, even for empty runs)
+
+- Append published items to `ledger.md`: `| date | slug | beat | formats | source URL | published links |`.
+- Update `tonight-<date>.md`: scouted list, scores, parked items, budget left, what the next run should look at first.
+- If a big announcement deserves long-form treatment the user should shape, write it as a proposal in the tonight file with a suggested outline — do not attempt it autonomously.
+
+## Voice Checklist (delete the draft if any fail)
+
+- [ ] Sounds like a builder sharing, not a news bot ("I tried", "I broke", "here's what surprised me")
+- [ ] Contains at least one thing only this user could say (their setup, their numbers, their PoC, their lens)
+- [ ] No AI-slop vocabulary ("game-changer", "revolutionary", "unleash"), no emoji walls, hashtags within caps
+- [ ] Media attached; link present; nothing confidential
+- [ ] Not a duplicate (ledger + recent posts checked)
+
+## The Loop (see /loop-engineering)
+
+Each night is a scan-until-budget-dry loop across runs: the tonight file is the shared loop state, the ledger is the dedup verifier, the volume budget is the hard cap, and the voice checklist is the quality gate. Termination: budget exhausted, nothing scores ≥11, or the environment gate blocks publishing.
diff --git a/.claude/skills/memory-hygiene/SKILL.md b/.claude/skills/memory-hygiene/SKILL.md
new file mode 100644
index 0000000..03dfcbf
--- /dev/null
+++ b/.claude/skills/memory-hygiene/SKILL.md
@@ -0,0 +1,87 @@
+---
+name: memory-hygiene
+description: Periodic trust sweep of persistent memory and durable knowledge notes - re-verifies environment-dependent claims against the live environment, stamps last_verified + confidence, and proposes archiving drifted entries
+roles: [all]
+integrations: []
+---
+
+# COG Memory Hygiene Skill
+
+## Purpose
+
+Prevent the **stale-but-confident** failure mode: a memory or knowledge note that was correct when written ("the webhook lives at X", "the board ID is Y") silently drifts after the environment changes, yet still ranks high at recall and gets acted on.
+
+The system move (adapted from "From Model Scaling to System Scaling: Scaling the Harness in Agentic AI", Gu, UC Berkeley, arXiv:2605.26112): **make trust a runtime decision, not a property of the stored item**. Re-verify against the live environment, and keep per-entry `last_verified` and `confidence` as first-class fields so future recalls can weigh trust.
+
+## When to Invoke
+
+- `/memory-hygiene`
+- "Audit my memories" / "check for stale memories"
+- After a memory misfires (a recalled fact turned out wrong)
+- Default cadence: monthly
+
+## Scope
+
+Sweep two stores:
+
+1. **Agent memory** — wherever your agent keeps persistent memory files (e.g. Claude Code's auto-memory directory). Sweep every entry except the index itself.
+2. **Durable knowledge notes** — `05-knowledge/**` files whose claims reference the environment (paths, URLs, IDs, tool names).
+
+A partial sweep ("just the reference entries") is fine when asked.
+
+## Claim Classification
+
+For each entry, split its claims into two buckets:
+
+| Bucket | Examples | Action |
+|---|---|---|
+| **Environment-dependent** | file/dir paths, repo names, branch names, channel IDs, board IDs, URLs, API endpoints, cron/routine IDs, CLI names, version numbers, "X lives at Y" | Verify against the live environment |
+| **Preference / judgment** | tone rules, formatting rules, "never do X", people facts, strategy context | No environment check possible; verify only for internal contradiction with newer entries |
+
+## Verification Moves (cheap first)
+
+- Paths and files: `ls` / `test -e`. Skills, commands, and agents named in an entry must still exist at the stated path.
+- URLs: resolve with a HEAD/GET (`curl -sI`); flag 404 or redirect-to-login.
+- Repos/branches: `gh repo view`, `git ls-remote` when cheap.
+- IDs (channels, boards, routine triggers): verify only if an MCP/CLI check is one call; otherwise mark `unverifiable-cheaply` and leave confidence untouched.
+- Cross-entry contradiction: newer entry wins; flag the older one.
+
+Never spend more than ~1 minute per entry. This is hygiene, not an investigation. **Unverifiable ≠ drifted.**
+
+## Stamping
+
+After checking an entry, update its frontmatter `metadata:` block in place (do not touch body text unless fixing a verified-wrong fact):
+
+```yaml
+metadata:
+ type: reference
+ last_verified: 2026-07-10
+ confidence: high # high = verified now | medium = unverifiable cheaply | low = partially drifted
+```
+
+- Verified clean → `confidence: high`, stamp date.
+- Unverifiable cheaply → keep prior confidence (or `medium`), stamp date.
+- Partially drifted → fix the drifted fact directly in the body (reviewable via the report); set `confidence: low` only if unsure the fix is complete.
+- Fully obsolete → **propose archive, don't delete.** List it in the report's "Propose archive" section; only archive after the user confirms.
+
+## The Loop (see /loop-engineering)
+
+Scan-until-done over the entry list with a per-entry budget guard (~1 min). The deterministic verifier is the environment itself (`test -e`, `curl`, `gh`) — never the agent's own recollection of whether something "should" still exist. Human escalation: all deletions/archives.
+
+## Report (single file)
+
+Write one report per sweep to `01-daily/YYYY-MM-DD-memory-hygiene.md`, structured around four evolution questions:
+
+1. **What persists?** — counts by type (user/feedback/project/reference).
+2. **What updated?** — entries whose body was corrected, with old → new.
+3. **What is measured?** — scorecard: `verified / unverifiable / drifted / propose-archive` counts, plus deltas vs the previous sweep report (the drift *trend* is the longitudinal signal one-shot checks miss).
+4. **What is auditable?** — every change in this sweep is a line in this report; for stores Git does not track, the report IS the audit trail.
+
+End the report with a **Propose archive** section (explicit list, one line of evidence each) and a **Waiting on you** line if anything needs a decision.
+
+## Rules
+
+- Propose-only for deletions/archives; direct-apply for stamps and verified factual corrections.
+- Never rewrite an entry's voice or restructure it during a sweep.
+- If the memory index points at renamed/missing files, fix the index.
+- Keep the sweep itself out of memory: the report file is the record.
diff --git a/.cursor-plugin/plugin.json b/.cursor-plugin/plugin.json
index d57da68..860cee0 100644
--- a/.cursor-plugin/plugin.json
+++ b/.cursor-plugin/plugin.json
@@ -1,8 +1,8 @@
{
"name": "cog-second-brain",
"displayName": "COG: Agentic Second Brain",
- "version": "3.6.0",
- "description": "Self-evolving second brain powered by AI agents, Obsidian markdown, and Git. 19 skills, 6 worker agents, people CRM with tiered enrichment. Iterative skills are loop-engineered with deterministic verifiers and layered termination. Inspired by Garry Tan's gstack and gbrain patterns. Works with Claude Code, Cursor, Kiro, Gemini CLI, Codex, and any markdown-reading agent.",
+ "version": "3.7.0",
+ "description": "Self-evolving second brain powered by AI agents, Obsidian markdown, and Git. 21 skills, 6 worker agents, people CRM with tiered enrichment. Runtime-trust release: memory hygiene sweeps, skill post-condition checks, verbatim citations with verifier pass, autonomous content factory. Iterative skills are loop-engineered with deterministic verifiers and layered termination. Inspired by Garry Tan's gstack and gbrain patterns. Works with Claude Code, Cursor, Kiro, Gemini CLI, Codex, and any markdown-reading agent.",
"author": {
"name": "Huy Tieu",
"email": "[email protected]",
@@ -50,6 +50,8 @@
"loop-engineering",
"scout",
"update-cog",
+ "memory-hygiene",
+ "content-factory",
"team-brief",
"meeting-transcript",
"comprehensive-analysis",
diff --git a/.github/MARKETPLACE.md b/.github/MARKETPLACE.md
index f310c99..1b88ca5 100644
--- a/.github/MARKETPLACE.md
+++ b/.github/MARKETPLACE.md
@@ -18,7 +18,7 @@ COG ships marketplace metadata in multiple formats:
| File | Platform | Purpose |
|---|---|---|
-| `.claude-plugin/plugin.json` | Claude Code marketplace | Canonical skill manifest (19 skills, 6 agents) |
+| `.claude-plugin/plugin.json` | Claude Code marketplace | Canonical skill manifest (21 skills, 6 agents) |
| `.cursor-plugin/plugin.json` | cursor.directory | Cursor-compatible manifest |
| `.cursorrules` | Cursor | Editor rules for Cursor users |
| `marketplace-entry.json` | General marketplaces | Lightweight catalog entry |
@@ -32,9 +32,9 @@ COG is a **multi-agent package**, not a single-surface plugin:
| Surface | Coverage |
|---|---:|
-| Claude Code (`.claude/skills/`) | 19 native skills + 6 worker agents |
+| Claude Code (`.claude/skills/`) | 21 native skills + 6 worker agents |
| Cursor (`.cursor-plugin/`) | Plugin manifest + rules |
-| Universal docs (`AGENTS.md`) | 19+ documented commands |
+| Universal docs (`AGENTS.md`) | 21+ documented commands |
| Kiro (`.kiro/powers/`) | 7 core powers |
| Gemini CLI (`.gemini/commands/`) | 7 core commands |
diff --git a/AGENTS.md b/AGENTS.md
index 31aa0fa..8cb47d4 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -361,6 +361,52 @@ This document defines the available commands/skills for AI agents interacting wi
---
+### /memory-hygiene
+
+**Description:** Periodic trust sweep of persistent memory and durable knowledge notes - re-verifies environment-dependent claims against the live environment, stamps `last_verified` + `confidence`, and proposes archiving drifted entries.
+
+**Triggers:**
+- `/memory-hygiene`
+- "audit my memories"
+- "check for stale memories"
+- After a memory misfires (a recalled fact turned out wrong)
+
+**Purpose:** Prevent the **stale-but-confident** failure mode: an entry that was correct when written silently drifts after the environment changes, yet still ranks high at recall and gets acted on. Makes trust a runtime decision, not a property of the stored item.
+
+**What it does:**
+1. Sweeps agent memory files and environment-referencing notes in `05-knowledge/`
+2. Classifies claims: environment-dependent (verify with `ls`/`curl`/`gh`) vs preference/judgment (check only for contradiction with newer entries)
+3. Stamps `last_verified` + `confidence` (high/medium/low) into each entry's frontmatter
+4. Fixes verified-wrong facts in place; proposes (never auto-applies) archiving obsolete entries
+5. Writes one sweep report to `01-daily/` with a drift scorecard and deltas vs the previous sweep
+
+**Budget:** ~1 minute per entry. Unverifiable ≠ drifted.
+
+---
+
+### /content-factory
+
+**Description:** Autonomous content pipeline - scout announcements in your field, triage by trend momentum and personal angle, produce posts/blogs/videos in your voice with ledger-based dedup, hard volume caps, and screenshot-verified publishing.
+
+**Triggers:**
+- `/content-factory`
+- "run the content factory"
+- "turn today's news into content"
+- Scheduled runs (e.g. nightly via cron)
+
+**Purpose:** Act as the user's autonomous content creator with zero duplicates, hard per-night volume caps, and verification before anything counts as published. An empty run is a valid run; a low-quality post is not.
+
+**What it does:**
+1. SCOUT — web-search + watchlist fetch for last-24h announcements (timeboxed ~20 min)
+2. TRIAGE — score candidates on trend momentum, beat fit, and unique angle; produce at ≥11/15, park 8-10, ignore <8; dedup against the ledger
+3. PRODUCE — format ladder decided by substance: short post by default, blog only with ≥3 original things or a real PoC, short video only if demo-able
+4. PUBLISH — environment gate, then post-condition check: screenshot/curl the live artifact before recording it as published
+5. LEDGER + LOG — append to `04-projects/content-factory/ledger.md` and the tonight file, even for empty runs
+
+**Output:** Published links in the ledger; parked ideas and proposals in the run log.
+
+---
+
### /auto-research
**Description:** Deep strategic research engine — decomposes questions into parallel research threads, spawns multiple agents, and synthesizes into actionable strategic analysis.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b197024..4206a96 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,35 @@
All notable changes to COG (Cognition + Obsidian + Git) will be documented in this file.
+## [3.7.0] - 2026-07-10
+
+### Runtime Trust
+
+v3.6.0 taught iterative skills to trust mechanical checks over self-report. v3.7.0 extends the same philosophy to everything COG stores and everything COG publishes: **trust is a runtime decision, not a property of a stored item or a returned status code.** Two failure modes drive this release (adapted from "From Model Scaling to System Scaling: Scaling the Harness in Agentic AI", Gu, UC Berkeley, arXiv:2605.26112):
+
+- **stale-but-confident** — a memory that was correct when written silently drifts after the environment changes, yet still ranks high at recall and gets acted on.
+- **confident-but-unchecked** — a mutation step returns plausible output that no downstream layer validates.
+
+### Added
+
+#### New Skills
+- **`memory-hygiene`** (`.claude/skills/memory-hygiene/SKILL.md`) — periodic trust sweep of persistent memory and durable knowledge notes. Classifies claims (environment-dependent vs preference/judgment), re-verifies the former against the live environment with cheap checks (`ls`, `curl`, `gh`), stamps `last_verified` + `confidence` into frontmatter, fixes verified-wrong facts in place, and proposes (never auto-applies) archiving obsolete entries. One sweep report per run with a drift scorecard and deltas vs the previous sweep.
+- **`content-factory`** (`.claude/skills/content-factory/SKILL.md`) — autonomous content pipeline designed for unattended scheduled runs: scout → triage (scored 1-5 on trend momentum, beat fit, unique angle) → produce (format ladder decided by substance) → publish (environment gate + mandatory post-condition check) → ledger. Ledger-based dedup, hard per-night volume caps shared across runs, and a voice checklist where any failure deletes the draft. An empty run is a valid run.
+
+#### New Protocols in CLAUDE.md
+- **Skill Post-Condition Rule** — every skill run that mutates external state must end by observing the mutated *artifact* (curl the URL, re-fetch the ticket, screenshot the post), never just the tool's return value. Read-only skills exempt. New mutating skills must ship a "Verify" step.
+- **Citation Verbatim & Verifier Pass** — for skills producing auditable claims about external sources: (1) every citation carries the actual line text in backticks — if you can't quote it verbatim, drop the claim; (2) opt-in adversarial verifier pass that re-fetches each cited URL and tags claims `Verified | Weakened | Falsified` before publishing.
+- **Fresh-Context Isolation** — when fanning out parallel workers, pass each only the digested context it needs; pasting a prior worker's raw output induces *narrativisation* (the worker classifies the orchestrator's framing instead of independently reading the source).
+- **Single-File Deliverable Rule** — one deliverable file per run: fan-out staging is fine mid-run, but the final step consolidates (synthesis on top, appendix of sources) and deletes staging files.
+
+#### New Documentation
+- **`docs/SKILL-DISTILLATION.md`** — the "explore once, execute cheap" meta-pattern: one expensive exploration by a strong model distilled into a layered skill artifact (router / recipes / healing tree / map shards) that a small model executes at a fraction of the cost. Includes the PASS / FAIL-REAL / FAIL-STALE / BLOCKED verdict taxonomy that routes "the world changed" to skill maintenance and "the world is wrong" to real reporting. Field-validated: $4.63 exploration once → $0.11 per execution on a Haiku-class model.
+
+### Changed
+- Skill count 19 → **21** across README, SETUP, AGENTS.md, CLAUDE.md, MARKETPLACE.md, docs/AGENT-SUPPORT.md, and all plugin manifests.
+- CONTRIBUTING.md skill guidelines: mutating skills must ship a Verify step; don't write "show your reasoning" instructions into skills (reasoning models handle it internally — state goals and constraints instead).
+- Version bumped to **3.7.0** across `COG-VERSION`, `.claude-plugin/plugin.json`, `.cursor-plugin/plugin.json`, and `marketplace-entry.json`; added runtime-trust keywords for marketplace discoverability.
+
## [3.6.0] - 2026-06-22
### Loop Engineering for Iterative Skills
diff --git a/CLAUDE.md b/CLAUDE.md
index 9f23ae9..cda4356 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -44,6 +44,19 @@ Read("/tmp/slack-data.md")
**Applies to:** All `worker-*` agents, all `brief-*` agents, any subagent that collects, extracts, or processes data.
+### Single-File Deliverable Rule — ALWAYS APPLY
+
+The user reviews **one file per run**. Multi-file outputs (staging files, per-worker dumps, split reports) make review impossible.
+
+- **Default: work in a single file.** If the task fits in one file, never split it.
+- **Fan-out is allowed mid-run** (parallel workers must write separate staging files to avoid conflicts), **but the final step always consolidates**: one deliverable file with the main content (TL;DR, synthesis, plan) on top, then an `## Appendix — sources` section containing each sub-file's content (or a condensed version + link if a sub-file is bulky raw data).
+- **After consolidating, delete the staging files.** The run folder ends with exactly one file (or zero, if the deliverable lives elsewhere).
+- Never present the user with "see files A, B, C, D" — present one file.
+
+### Fresh-Context Isolation — ALWAYS APPLY when fanning out workers
+
+When the orchestrator dispatches multiple workers in parallel, pass each worker ONLY the digested context it needs — never paste a prior worker's raw output into the next worker's prompt. Pasted context induces *narrativisation*: the worker treats the preamble as "the orchestrator already framed the findings, I just classify them" instead of independently reading the source. Observed failure mode: a 5× speedup coupled with hallucinated findings and mis-cited references.
+
---
## Brain-First Knowledge Protocol (MUST APPLY)
@@ -62,6 +75,29 @@ For factual statements written into durable notes (`05-knowledge/**`, people pro
Use one citation per distinct factual claim block where practical.
+### Citation Verbatim & Verifier Pass — When Accuracy Matters
+
+For skills that produce auditable claims about external sources (Slack threads, tickets, PRs, meeting transcripts — e.g. `team-brief`, `comprehensive-analysis`, `auto-research`), apply two additional disciplines:
+
+1. **Verbatim quote alongside the citation.** Every cited reference should carry the actual line text in backticks, not just a link. Pattern: `[<short>] (<link>) — \`<verbatim quote>\``. If you can't quote the source verbatim, drop the claim — that's the failure mode this discipline prevents.
+
+2. **Opt-in adversarial verifier pass before publishing.** For high-stakes briefs/reviews, after the draft is assembled, spawn one `worker-data-collector` (Sonnet) whose only job is to re-fetch each cited URL and tag every claim `Verified | Weakened | Falsified` against the verbatim quote. Falsified claims are dropped; Weakened are demoted (e.g. "blocker" → "heads up"). Output contract: `CLAIM <id> | <tag> | <one-sentence justification with link>`.
+
+This is opt-in per skill — not a hard rule for every output. Apply it where wrongness costs the most.
+
+---
+
+## Skill Post-Condition Rule — ALWAYS APPLY
+
+Every skill run that **mutates external state** (publishes a page, deploys, posts to Slack/socials, transitions a ticket, pushes commits, fires a webhook) must end with an explicit **post-condition check**: fetch back or observe the mutated artifact and confirm it matches intent before reporting success.
+
+The failure mode this prevents is **confident-but-unchecked**: a step returns plausible output that no downstream layer validates. Rules:
+
+- The check must observe the *artifact*, not the tool's return value (curl the URL, re-fetch the ticket, screenshot the post).
+- Read-only skills are exempt.
+- If the check fails, report the failure plainly — never report success from the mutation call alone.
+- New skills that mutate external state must include a "Verify" step in their SKILL.md.
+
---
## Integration Preferences
@@ -100,7 +136,7 @@ Role packs live in `.claude/roles/`. New roles can be added by dropping a file f
- `COMPETITIVE-WATCHLIST.md` — Companies/people being tracked
### Framework files (updated via `cog-update.sh` or `/update-cog`)
-- `.claude/skills/` — Claude Code skills (17 skills)
+- `.claude/skills/` — Claude Code skills (21 skills)
- `.claude/agents/` — Worker agent definitions (6 agents)
- `.claude/roles/` — Role packs for personalized recommendations
- `.kiro/powers/` — Kiro powers
diff --git a/COG-VERSION b/COG-VERSION
index 40c341b..7c69a55 100644
--- a/COG-VERSION
+++ b/COG-VERSION
@@ -1 +1 @@
-3.6.0
+3.7.0
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 735cacd..a3281f9 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -58,6 +58,9 @@ We welcome ideas for new features or improvements:
- `.kiro/powers/cog-[name]/POWER.md` - Kiro format (if Kiro supports the skill)
- `.gemini/commands/[name].toml` + `.gemini/skills/[name].md` - Gemini CLI format (if Gemini supports the skill)
- If the skill is role-specific, add it to relevant role packs in `.claude/roles/`
+ - **If the skill mutates external state** (publishes, posts, deploys, transitions tickets), it MUST include a "Verify" step that observes the mutated artifact (curl the URL, screenshot the post) before reporting success — see the Skill Post-Condition Rule in `CLAUDE.md`
+ - **Prompting note for reasoning models**: don't write "show your reasoning" / "think step by step" instructions into SKILL.md files — modern reasoning models handle this internally, and forcing it degrades output. State the goal and the constraints instead.
+ - If the skill iterates, declare its loop per `/loop-engineering`; if it captures reusable environment knowledge, consider the [skill distillation pattern](docs/SKILL-DISTILLATION.md)
2. **Templates**: Follow existing YAML frontmatter conventions
3. **Documentation**: Update README.md if adding major features
4. **Examples**: Provide examples of your feature in action
diff --git a/README.md b/README.md
index 8331dbe..11cca5f 100644
--- a/README.md
+++ b/README.md
@@ -11,7 +11,7 @@
```mermaid
graph LR
A[You] -- natural language --> B[AI Agent]
- B -- runs --> C[17 Skills]
+ B -- runs --> C[21 Skills]
C -- delegates to --> W[6 Worker Agents]
C -- reads & writes --> D[.md Files]
W -- reads & writes --> D
@@ -54,11 +54,11 @@ COG ships a **full Claude Code surface** plus **core native surfaces** for Kiro
| Surface | Current support | Notes |
|---|---|---|
-| Claude Code | 19 native skills + 6 worker agents | Full first-class surface |
+| Claude Code | 21 native skills + 6 worker agents | Full first-class surface |
| Cursor | Plugin manifest + rules | `.cursor-plugin/plugin.json` + `.cursorrules` |
| Kiro | 7 native powers | Core workflows today |
| Gemini CLI | 7 native commands | Core workflows today |
-| `AGENTS.md` | 19 documented commands | Universal fallback for Codex and other agents |
+| `AGENTS.md` | 21 documented commands | Universal fallback for Codex and other agents |
Before publishing or updating framework files, run `./scripts/validate-agent-surface.sh` to catch drift between manifests, docs, and shipped files. See [docs/AGENT-SUPPORT.md](docs/AGENT-SUPPORT.md) for the detailed support matrix and contributor rules.
@@ -75,6 +75,7 @@ Before publishing or updating framework files, run `./scripts/validate-agent-sur
| **weekly-checkin** | Cross-domain pattern analysis | "Weekly review" |
| **knowledge-consolidation** | Build frameworks from scattered notes | "Consolidate my knowledge" |
| **update-cog** | Update framework files without touching your content | "Update COG" |
+| **memory-hygiene** | Trust sweep of persistent memory — re-verify claims against the live environment, stamp `last_verified` + confidence | "Audit my memories" |
### Team Intelligence Skills (for Product & Engineering Leads)
@@ -103,6 +104,12 @@ Before publishing or updating framework files, run `./scripts/validate-agent-sur
|---|---|---|
| **auto-research** | Deep strategic research engine — decomposes questions into parallel research threads with multiple agents | "Research the future of AI testing tools" |
+### Content Creation
+
+| Skill | What it does | Try saying... |
+|---|---|---|
+| **content-factory** | Autonomous content pipeline — scout announcements, triage by trend momentum + your unique angle, publish with ledger dedup, hard volume caps, and screenshot-verified posting | "Run the content factory" |
+
### Worker Agents (Specialist Sessions)
COG uses a worker agent architecture inspired by [garrytan/gstack](https://github.com/garrytan/gstack) specialist sessions and [garrytan/gbrain](https://github.com/garrytan/gbrain) knowledge patterns. Workers handle data-heavy tasks cheaply (Sonnet) while the lead session does reasoning (Opus).
@@ -170,12 +177,13 @@ graph TD
| **Self-Evolving** — Learns your patterns, auto-organizes content, builds frameworks | **Self-Healing** — Rename files or restructure; cross-references update automatically | **Verification-First** — Sources required, 7-day freshness, confidence levels on all analysis |
| **Privacy-First** — Local `.md` files, strict domain separation, no external servers | **Multi-Device** — iCloud sync to iPhone/iPad/Mac; Git for version history | **Obsidian Tasks** — `📅 YYYY-MM-DD` emoji format works with Tasks plugin dashboards |
| **Garry Tan Inspired** — gstack specialist sessions + gbrain knowledge patterns | **Multi-Platform** — Listed on [skills.sh](https://skills.sh), [agentskill.sh](https://agentskill.sh), [cursor.directory](https://cursor.directory) | **Worker Agents** — Sonnet handles I/O, Opus handles thinking |
+| **Runtime Trust** — memory hygiene sweeps re-verify stored facts against the live environment | **Post-Condition Checks** — mutating skills observe the artifact before reporting success | **Skill Distillation** — [explore once, execute cheap](docs/SKILL-DISTILLATION.md) with small models |
## Your Vault
```
COG-second-brain/
-├── .claude/skills/ # Claude Code skills (19)
+├── .claude/skills/ # Claude Code skills (21)
├── .claude/agents/ # Worker agent definitions (6)
├── .claude/roles/ # Role packs (7) — personalized recommendations
├── .kiro/powers/ # Kiro powers
@@ -246,6 +254,8 @@ Git is optional but recommended for version history. COG works fine with just iC
- [x] ~~Role packs & integration discovery~~ (shipped in v3.3)
- [x] ~~PM workflow skills & auto-research~~ (shipped in v3.4)
- [x] ~~Worker agents, people CRM & specialist sessions~~ (shipped in v3.5)
+- [x] ~~Loop engineering for iterative skills~~ (shipped in v3.6)
+- [x] ~~Runtime trust: memory hygiene, post-condition checks, verifier pass, content factory~~ (shipped in v3.7)
- [ ] Web interface for knowledge graph visualization
- [ ] Mobile-first commands (optimized for Obsidian mobile)
- [ ] Team collaboration features (with privacy preservation)
diff --git a/SETUP.md b/SETUP.md
index 73d8550..cb4d40a 100644
--- a/SETUP.md
+++ b/SETUP.md
@@ -44,10 +44,10 @@ That's it! You now have a working second brain.
**What just happened?**
- The cloned `COG-second-brain` folder IS your second brain
- COG now exposes a clear multi-agent support matrix:
- - `.claude/skills/` - 19 Claude Code skills (full surface)
+ - `.claude/skills/` - 21 Claude Code skills (full surface)
- `.kiro/powers/` - 7 Kiro powers (core workflows)
- `.gemini/commands/` + `.gemini/skills/` - 7 Gemini CLI commands (core workflows)
- - `AGENTS.md` - 19 documented commands for Codex and other agents
+ - `AGENTS.md` - 21 documented commands for Codex and other agents
- Onboarding will create your personalized directory structure
- You can validate the packaged agent surfaces anytime with `./scripts/validate-agent-surface.sh`
@@ -131,7 +131,7 @@ COG-second-brain/ # This is your second brain folder
├── .claude/
│ ├── agents/ # 6 worker agent definitions
│ ├── roles/ # 7 role packs for personalized recommendations
-│ └── skills/ # 19 Claude Code skills
+│ └── skills/ # 21 Claude Code skills
│ ├── onboarding/
│ ├── braindump/
│ ├── daily-brief/
diff --git a/cog-update.sh b/cog-update.sh
index 601d0d9..4b91c34 100755
--- a/cog-update.sh
+++ b/cog-update.sh
@@ -32,6 +32,7 @@ FRAMEWORK_FILES=(
"COG-VERSION"
"cog-update.sh"
"docs/AGENT-SUPPORT.md"
+ "docs/SKILL-DISTILLATION.md"
".github/MARKETPLACE.md"
"scripts/validate-agent-surface.sh"
@@ -55,6 +56,8 @@ FRAMEWORK_FILES=(
".claude/skills/export-open-issues/SKILL.md"
".claude/skills/publish-to-confluence/SKILL.md"
".claude/skills/update-knowledge-base/SKILL.md"
+ ".claude/skills/memory-hygiene/SKILL.md"
+ ".claude/skills/content-factory/SKILL.md"
# Role packs
".claude/roles/_template.md"
diff --git a/docs/AGENT-SUPPORT.md b/docs/AGENT-SUPPORT.md
index 2f9db44..ba17325 100644
--- a/docs/AGENT-SUPPORT.md
+++ b/docs/AGENT-SUPPORT.md
@@ -8,7 +8,7 @@ This document is the packaging contract: it tells contributors and maintainers w
| Surface | Shipped format | Coverage | Status |
|---|---|---:|---|
-| Claude Code | `.claude/skills/*/SKILL.md` | 19 skills | Full native surface |
+| Claude Code | `.claude/skills/*/SKILL.md` | 21 skills | Full native surface |
| Universal agent docs | `AGENTS.md` | 17 commands | Full documented fallback |
| Kiro | `.kiro/powers/*/POWER.md` | 7 powers | Core workflows only |
| Gemini CLI | `.gemini/commands/*.toml` + `.gemini/skills/*.md` | 7 commands | Core workflows only |
diff --git a/docs/SKILL-DISTILLATION.md b/docs/SKILL-DISTILLATION.md
new file mode 100644
index 0000000..ba4f575
--- /dev/null
+++ b/docs/SKILL-DISTILLATION.md
@@ -0,0 +1,60 @@
+# Skill Distillation: Explore Once, Execute Cheap
+
+A COG meta-pattern for turning one expensive exploration by a strong model into a durable skill artifact that a small, cheap model can execute reliably. Field-validated on a web-app testing workload: one $4.63 / 150-turn exploration once → $0.11 per execution on a Haiku-class model afterwards, with correct verdicts on all sampled runs.
+
+The pattern generalizes to any repetitive task against a stable-but-drifting environment: testing an app, filing reports into a system, operating a dashboard, running a recurring data pull.
+
+## Core principle
+
+**An executor reads O(1 task) of knowledge, not O(environment).** Layer knowledge by when it's needed:
+
+```
+always loaded → SKILL.md router (<1K tokens: discipline, helpers, verdict contract)
+per task → one recipe (~200 tokens: steps + anchors + oracle, self-contained)
+on failure only → healing.md (decision tree)
+on healing only → ONE map shard (feature-level knowledge)
+maintainer only → CHANGELOG.md, friction inbox
+```
+
+## The four phases
+
+### 1. Exploration (once, expensive, strong model)
+
+One long background run that builds a full functional model of the environment: pages/screens, flows, computed behaviors **with worked examples**, validation rules, quirks. Record **durable anchors only** (labels, roles, stable IDs) — never ephemeral references. Read-only against real environments. Apply the Worker Output Rule: findings go to a staging file, the run returns one status line.
+
+**Treat exploration output as fallible.** Expect at least one confidently-wrong claim; the evolution loop below is the truth filter, not the explorer's self-report.
+
+### 2. Distillation (lead-session reasoning)
+
+1. **Verify interaction mechanics BEFORE writing them into the skill** — run 1-2 cheap probe agents that test the exact helpers the recipes will use.
+2. Write the router (`SKILL.md`, <1K tokens): discipline, verified helpers, result contract, verdict taxonomy, index.
+3. Write `healing.md`: a capped decision tree for when a recipe's anchor fails (found-but-renamed → finish and report friction; gone → read the ONE relevant map shard; behavior contradicts oracle → re-verify, then fail-for-real; retry once before declaring a real failure, to filter flakes). Executors NEVER edit skill files.
+4. Write map shards by feature + a one-line-per-shard index.
+5. Write self-contained recipes (~150-250 tokens each). Recipes are **compiled artifacts** — regenerate them from the map when the map changes; the map is the source of truth.
+
+### 3. Evolution loop (batched execution, mid-tier model)
+
+Run recipes in parallel batches. After each batch: harvest verdicts + friction, patch the skill (single-writer: only the maintainer edits), bump the skill version, append a CHANGELOG entry. Loop until a batch produces **zero friction and zero staleness failures** (loop-until-dry — see /loop-engineering).
+
+Structured friction is the ONLY feedback channel — every executor reports `{task, verdict, evidence, friction}` and nothing else.
+
+### 4. Validation (proves the claim)
+
+Run a sample of recipes — including deliberate failure-detectors whose oracles encode *intended* behavior — on a small model. Success = correct verdicts at a fraction of the cost. If the small model can't execute the skill, the distillation is not done.
+
+## The verdict taxonomy (the contract between execution and triage)
+
+- **PASS** — matches the oracle (may carry friction, e.g. "healed a stale anchor").
+- **FAIL-REAL** — anchors work, environment reachable, behavior contradicts the oracle → a genuine finding; quote observed values.
+- **FAIL-STALE** — the environment changed, the skill is outdated → maintainer patches the skill; no finding filed.
+- **BLOCKED** — environment problem (down, auth, tooling error) → rerun, don't diagnose.
+
+Separating FAIL-REAL from FAIL-STALE is the whole game: it routes "the world changed" to skill maintenance and "the world is wrong" to real reporting, instead of mixing both into noise.
+
+**Adversarially verify FAIL-REAL verdicts whose oracle rests on exploration-derived knowledge** before reporting them — spawn one probe to independently re-check the claim. Oracles derived from requirements (math, stated rules) don't need this.
+
+## Relationship to other COG pieces
+
+- **/loop-engineering** — the evolution loop is a loop-until-dry with a deterministic verifier (batch friction count) and single-writer state.
+- **Worker Output Rule** — explorers and executors write files, return status lines.
+- **memory-hygiene** — a distilled skill is memory; FAIL-STALE is its drift signal, the CHANGELOG is its audit trail.
diff --git a/marketplace-entry.json b/marketplace-entry.json
index 3801c89..7653a39 100644
--- a/marketplace-entry.json
+++ b/marketplace-entry.json
@@ -6,8 +6,8 @@
"email": "[email protected]",
"url": "https://github.com/huytieu"
},
- "description": "Self-evolving second brain with 19 AI skills, 6 worker agents, and people CRM. Iterative skills are loop-engineered with deterministic verifiers and layered termination. Inspired by Garry Tan's gstack and gbrain. Works with Claude Code, Cursor, Kiro, Gemini CLI, Codex.",
- "version": "3.6.0",
+ "description": "Self-evolving second brain with 21 AI skills, 6 worker agents, and people CRM. Runtime-trust release: memory hygiene sweeps, skill post-condition checks, verbatim citations with adversarial verifier pass, autonomous content factory. Iterative skills are loop-engineered with deterministic verifiers and layered termination. Inspired by Garry Tan's gstack and gbrain. Works with Claude Code, Cursor, Kiro, Gemini CLI, Codex.",
+ "version": "3.7.0",
"keywords": [
"second-brain",
"garry-tan",
@@ -21,7 +21,10 @@
"people-crm",
"knowledge-management",
"specialist-sessions",
- "loop-engineering"
+ "loop-engineering",
+ "memory-hygiene",
+ "runtime-trust",
+ "content-factory"
],
"category": "productivity",
"homepage": "https://github.com/huytieu/COG-second-brain"