Community生产力与协作github.com

coni555/CONI-skill

coni 个人创建的 Claude Code / Codex Skill 合集

CONI-skill 是什么?

CONI-skill is a Claude Code agent skill that coni 个人创建的 Claude Code / Codex Skill 合集.

兼容平台✓Claude Code✓Codex CLI~Cursor
npx skills add coni555/CONI-skill

Installed? Explore more 生产力与协作 skills: steipete/gemini, steipete/gh-issues, steipete/skill-creator · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Memory Engine

Enhancement layer for the manual memory system. This skill does not replace the existing auto-memory behavior — it adds structure, budget awareness, and a session-end checkpoint on top of it.

Core philosophy: suggest, never auto-save. The human decides what's worth keeping.

Memory Directory

All memory files live in ~/.claude/projects/-Users-coni/memory/. Index file: MEMORY.md (always loaded, pure pointers, no content).

Phase 1: Memory Capture

When saving any memory (whether triggered by you or the session checkpoint), follow this flow every time:

Step 1 — Classify

Five types. Pick the one that fits:

TypeWhat it capturesSignals
userIdentity, preferences, values, knowledge"I'm a...", "I prefer...", personality shifts
feedbackHow to work with the user — corrections AND confirmations"Don't do that", "Yes, exactly that", approach validated
projectActive work context, deadlines, goals"We're doing X by Thursday", milestone hit
referenceExternal knowledge, tool configs, pointersNew tool discovered, API configured
decisionWhy X was chosen over Y"Chose X over Y", comparing tradeoffs, architecture calls

For decision type: read references/decision-type-spec.md for the frontmatter schema and body structure (Context → Options → Decision → Revisit When).

Step 2 — Deduplicate

Before writing, scan MEMORY.md index for overlapping entries:

  • Same topic already covered? → Update the existing file, don't create a new one
  • Overlaps with a CLAUDE.md rule? → Don't save (the rule is authoritative)
  • Ephemeral task detail? → Don't save (git log / code is the source of truth)

Apply all rules from feedback-memory-hygiene.md — they remain authoritative.

Step 3 — Estimate Token Cost

Calculate: file_bytes / 3.2 (integer, rounds down). This gives a reasonable approximation for mixed CJK/English content without external dependencies.

Step 4 — Write

  1. Create the memory file with YAML frontmatter (name, description, type)
  2. Update MEMORY.md index — add entry under the correct section heading
  3. Append token estimate: `~NNNNtk` at end of the index line

Example index line:

- [decision-deploy-cloudflare.md](decision-deploy-cloudflare.md) — Deploy to CF Pages instead of Vercel `~280tk`

What NOT to Save

These rules are non-negotiable (from memory-hygiene + auto-memory system):

  • Code patterns, architecture, file paths — derivable from code
  • Git history, recent changes — git log is authoritative
  • Debug solutions — the fix is in the code
  • Anything already in CLAUDE.md or ~/cc-personal/rules/
  • Ephemeral task state — only useful in current session
  • Project status snapshots — read from code and git

Phase 2: Memory Maintenance

/memory-check

Run the audit script and present results:

bash ~/.claude/skills/memory-engine/scripts/memory-health-check.sh

The script outputs a structured report covering:

  • Budget: total tokens vs 40,000tk cap (20% of 200K context)
  • Type distribution: count and tokens per type
  • Top 5 by size: largest files consuming the most budget
  • Issues: stale files (>30 days), orphans, broken links, empty types, budget warnings

After presenting the report, suggest specific actions for each issue found:

IssueAction
STALE"Review or archive: {file} — still relevant?"
ORPHAN"Add to MEMORY.md index, or delete if obsolete"
BROKEN LINK"Remove from MEMORY.md, or recreate the file"
NO ENTRIESInformational — not all types need entries at all times
BUDGET WARNING"Largest files: ... — consider compacting or splitting"

After resolving issues, update the MEMORY.md budget comment:

<!-- budget: ~NNNNtk / 40000tk (NN%) | updated: YYYY-MM-DD -->

Token Annotation Format

Every MEMORY.md index entry carries a token estimate suffix:

- [filename.md](filename.md) — description `~NNNNtk`

The budget comment sits at the very top of MEMORY.md (before the heading). It's an HTML comment — invisible in rendered markdown, parseable by scripts.

Phase 3: Seven-Dimension Consolidation Checkpoint

Trigger (Double Safety)

Primary trigger — Prompt-based (CLAUDE.md rules): When the following signals are perceived during conversation, proactively perform a seven-dimension scan:

  • Dense tool calls (>15 tool calls)
  • Completion of a substantive output (code, analysis, proposal)
  • Major topic switch
  • User explicitly says "consolidate", "review", "summarize"

Fallback trigger — Stop hook (settings.json): consolidation-trigger.sh runs every time the agent stops, tracking stop count and interval. When stop count ≥ 20 and time since last trigger ≥ 30 minutes, output a seven-dimension scan prompt. State file: ~/.claude/projects/-Users-coni/memory/.consolidate-state

Seven-Dimension Scan

Scan the current conversation for each dimension:

#DimensionHit SignalCorresponding Memory Type
1Task ClosureA complete task from proposal to deliveryproject (milestone)
2CLAUDE.md UpdateDiscovered new universal behavior rulesWrite directly to CLAUDE.md
3Rules ConsolidationDiscovered domain/tool/file-type-specific rulesWrite to ~/cc-personal/rules/
4Architecture DecisionMade tool selection, technical approach, deployment strategy — non-trivial choicesdecision
5Project MilestoneSubstantial project progress (release, launch, key feature complete)project
6Collaboration CalibrationUser corrected a practice or confirmed a non-obvious practicefeedback
7High-Value AnalysisProduced reusable analysis framework, insight, or model across sessionsreference or user

Execution Flow

Scan seven dimensions → Count hits
  Hits 0-1 → Skip silently
  Hits 2+  → Output checkpoint suggestions

Rules

  • Apply the "What NOT to Save" list strictly — no exceptions at checkpoint time
  • Check existing MEMORY.md entries before suggesting — no duplicates
  • Maximum 3 candidates per checkpoint — quality over quantity
  • If nothing qualifies, output nothing (silent skip, no forced suggestions)
  • Never write files during checkpoint — only present candidates for user approval
  • Each candidate must note the dimension number hit

Output Format

[Consolidation Check] This conversation hit 3/7 dimensions (④⑥⑦), recommend consolidating:

1. [decision] ④ Chose dual trigger approach (Stop hook + prompt) instead of pure hook — hook cannot perceive conversation semantics
2. [feedback] ⑥ User confirmed: the core of the flywheel is automatic triggering, not memory classification
3. [reference] ⑦ Entity vitality framework: human/company/AI three-entity time and energy allocation model

Save which? Reply with numbers (e.g., 1,2), or "skip" to skip.

When user confirms numbers, execute Phase 1 save flow for each selected item. When user says "skip" or equivalent, do nothing.

Gotchas

  • Don't update MEMORY.md budget comment on every save — only during /memory-check. Frequent updates break cache and add noise to git diffs.
  • Token estimates are approximations — don't treat them as exact. The /3.2 method is ~90% accurate for mixed CJK/EN content, which is good enough for budget awareness.
  • decision type is for non-trivial choices — "I used vim instead of nano" is not a decision worth saving. Reserve it for choices that affect future sessions.
  • Stop hook is fallback, not primary — if the user Ctrl+C exits, the hook won't trigger. Proactive scanning is the flywheel's engine.
  • Proactive scanning must not interrupt the user's flow — trigger between tasks (phase completion, topic switch), not mid-execution.

相关技能