LearnNewsExamplesServices
Frontmatter
id10075
title[skill] Add memory-mining skill — formalize the memory-first reflex as a state-transition gate
stateClosed
labels
enhancementai
assigneestobiu
createdAtApr 19, 2026, 9:02 AM
updatedAtMay 15, 2026, 2:42 PM
githubUrlhttps://github.com/neomjs/neo/issues/10075
authortobiu
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtApr 19, 2026, 10:06 AM

[skill] Add memory-mining skill — formalize the memory-first reflex as a state-transition gate

tobiu
tobiu commented on Apr 19, 2026, 9:02 AM

Problem

The memory-first reflex currently lives in AGENTS_STARTUP.md §3.3 as a rule (strengthened in PR #10069). In today's session (51640d07-2931-4d38-a071-a0e13e3d6452), I applied it tactically — the query_raw_memories call that cracked the #10070 diagnosis in seconds. And I failed to apply it at the meta level — spending an hour re-deriving a Karpathy-loop-to-Neo comparison that Antigravity had already mapped on 2026-04-11 (memory 9f058317). Tobi had to explicitly prompt "mine the memory core for hidden gems" to surface it.

The pattern visible across the session: reflexes-as-rules get applied inconsistently; reflexes-as-skills get applied reliably. ticket-intake / pull-request / pr-review all fired every time they were needed because invocation IS the mode switch. AGENTS_STARTUP §3.3 got partially applied because it requires the agent to remember the rule at the right moment.

Why a skill, not a stronger rule

Tobi confirmed empirically (session close on 2026-04-18) that without the three existing skills, Gemini 3.1 Pro and Opus 4.6 produced very different results — "even if base instructions exist". The skill mechanism carries four specific properties that base instructions don't:

  1. Progressive disclosure fits literal-instruction-following models (4.7's explicit trait per Anthropic docs)
  2. The invocation IS the state transition — explicit mode switch visible in the transcript
  3. Ritualized friction at critical moments — creates a skipped-or-not artifact
  4. Cross-harness durability — Claude Code / Antigravity / Gemini CLI all invoke identically

Promoting memory-first from rule to skill applies this proven mechanism to the specific failure mode I hit today.

Proposed Skill Structure

Following the Progressive Disclosure pattern (see create-skill/SKILL.md and existing skill layouts):

.agent/skills/memory-mining/SKILL.md

---
name: memory-mining
description: Authoritative protocol for querying the Memory Core before proposing architectural claims or diagnosing regressions. Prevents re-derivation of prior reasoning by surfacing cross-session, cross-harness context via semantic search.
triggers: Use this skill when (1) the user reports a regression symptom ("used to work", "suddenly broken", surprise validation failures, schema mismatches), OR (2) you are about to propose an architectural claim where prior sessions may have already mapped the topic. Do NOT use for routine codebase exploration — `query_documents` and `ask_knowledge_base` cover that.
---
<h1 class="neo-h1" data-record-id="6">Memory Mining Protocol</h1>

If you are tasked with diagnosing a regression or proposing a non-trivial architectural claim, you MUST immediately use the `view_file` tool to read and strictly adhere to `/Users/Shared/github/neomjs/neo/.agent/skills/memory-mining/references/memory-mining-protocol.md` before running `git log`, `grep`, or broad tool exploration.

.agent/skills/memory-mining/references/memory-mining-protocol.md

Deep playbook covering:

  1. When to invoke (the two gates):
    • Gate 1: Regression symptoms — verbatim triggers enumerated in AGENTS_STARTUP.md §3.3
    • Gate 2: Architectural claims — "am I about to describe the project, propose a roadmap, or compare against external work?"
  2. Query strategy:
    • Use query_summaries for breadth (session-level topics) before query_raw_memories (turn-level detail)
    • 2–4 queries with different semantic framings — NOT one query with many keywords
    • Specific examples drawn from today's session showing successful vs. missed queries
  3. Interpretation:
    • Distinguish "already proposed / already discussed" from "novel"
    • When prior work exists, cite it in the current proposal with Origin Session ID
    • Flag unresolved threads (proposal without subsequent action = continuity gap worth surfacing)
  4. Anti-patterns:
    • Using this skill for routine "how does X work" questions (belongs to ask_knowledge_base)
    • Skipping the skill because "I think I already know" — that's the exact failure mode the skill exists to prevent
  5. Exit criteria:
    • Either: cite at least one relevant prior session in the current work
    • Or: state explicitly that no prior session was found for this specific framing (which is itself a useful signal)

Integration points

  • Cross-link from AGENTS_STARTUP.md §3.3 to the new skill — keep the rule, add the skill as the enforcement mechanism
  • Cross-link from self-repair/SKILL.md — the two are complementary (self-repair for sick infrastructure, memory-mining for intact infrastructure where prior reasoning exists)
  • Cross-link from ticket-intake/SKILL.md §1.3 — the Historical Amnesia Check in intake is a specific application of memory-mining

Acceptance Criteria

  • .agent/skills/memory-mining/SKILL.md exists with YAML frontmatter matching the Progressive Disclosure pattern
  • .agent/skills/memory-mining/references/memory-mining-protocol.md exists with the full playbook
  • AGENTS_STARTUP.md §3.3 cross-links to the new skill
  • ticket-intake/references/ticket-intake-workflow.md §1.3 references memory-mining for the Historical Amnesia Check
  • The root .claude/skills/ wrapper directory has the corresponding stub referencing /Users/Shared/github/neomjs/neo/.agent/skills/memory-mining/ (matching existing convention)
  • No changes to the existing three skills' internals — memory-mining is additive, not a refactor

Test of Success

The skill "works" if:

  • A future session encountering a regression-symptom user prompt invokes memory-mining before git log (observable in transcripts)
  • A future session proposing an architectural comparison cites prior sessions that mapped the territory, rather than re-deriving (observable in PR bodies + review comments)
  • The specific failure mode from today's session (Karpathy re-derivation when Antigravity's mapping existed) does not repeat in subsequent sessions by other agents on other harnesses

Origin Session ID

51640d07-2931-4d38-a071-a0e13e3d6452 / 7fd64ee5-5167-4b04-b988-9f69d1d9701d (continuation — the reflection that produced this skill proposal)

Related

  • AGENTS_STARTUP.md §3.3 — the rule this skill enforces
  • PR #10069 — strengthened the rule with explicit trigger enumeration
  • Session memory 9f058317 (2026-04-11) — Antigravity's Karpathy mapping that I failed to surface until prompted; concrete case study for the skill's authoring guide
  • #10074 — the blog post draft that named this failure pattern
tobiu added the enhancement label on Apr 19, 2026, 9:02 AM
tobiu added the ai label on Apr 19, 2026, 9:02 AM
tobiu assigned to @tobiu on Apr 19, 2026, 9:02 AM
tobiu referenced in commit 3df123c - "feat(ai): add memory-mining skill to enforce memory-first reflex (#10075)" on Apr 19, 2026, 9:50 AM
tobiu cross-referenced by PR #10076 on Apr 19, 2026, 9:51 AM
tobiu referenced in commit e79b89a - "docs(ai): clarify ask_knowledge_base strictly dominates query_documents in memory-mining anti-patterns (#10075)" on Apr 19, 2026, 9:57 AM
tobiu referenced in commit 7eadba8 - "docs(ai): correct ask_knowledge_base vs query_documents tool descriptions to reflect empirical dominance (#10075)" on Apr 19, 2026, 10:01 AM
tobiu referenced in commit 5cf7ddc - "feat(ai): add memory-mining skill to enforce memory-first reflex (#10075) (#10076) on Apr 19, 2026, 10:06 AM
tobiu closed this issue on Apr 19, 2026, 10:06 AM
tobiu cross-referenced by #10077 on Apr 19, 2026, 10:12 AM
tobiu cross-referenced by PR #10078 on Apr 19, 2026, 10:28 AM
tobiu cross-referenced by #10079 on Apr 19, 2026, 10:43 AM
tobiu cross-referenced by PR #10084 on Apr 19, 2026, 12:25 PM
tobiu cross-referenced by #10030 on Apr 19, 2026, 12:33 PM