/hoangsa:memory-disciplinefrom hoangsa
Forces consultation of hoangsa-memory persistent memory (USER.md, MEMORY.md, LESSONS.md, code graph) before any non-trivial coding action. Prevents drift from documented patterns and preferences.
Ships in hoangsa. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You are coding inside a repository that has a hoangsa-memory memory server attached via MCP. That server gives you four things you MUST use before taking any load-bearing action:
memory_recall (hybrid BM25 + symbol +
vector search over the tree)..hoangsa/memory/USER.md, first-person style + workflow
choices that apply across projects..hoangsa/memory/MEMORY.md, durable invariants about this
codebase..hoangsa/memory/LESSONS.md, action-triggered advice.USER.md + MEMORY.md + LESSONS.md are injected verbatim at SessionStart, so
you already have them in context. The memory_recall hit extends that with
relevant code chunks.
Skipping this loop causes drift. Past sessions spent hours fixing hallucinated APIs, re-learning patterns already documented in LESSONS.md, or refactoring against conventions they never checked. Don't repeat them.
Run this before writing code or asserting a non-obvious fact:
Call memory_recall with a query derived from the user's intent. If the
intent is "add a retry wrapper around the HTTP client", recall
"http client retry". Prefer nouns from the user's request over verbs.
Read the returned chunks. Every chunk has a path:line-span you can cite.
USER.md and LESSONS.md were already injected at SessionStart. Before acting, scan them for:
Proceed only after honouring preferences + lessons. If you edit code, quote the recalled chunk ids you relied on.
After the action completes (tests pass/fail, file saved, command run), decide what to persist. Three surfaces, three tools:
memory_remember_preference) — first-person, stable
across projects ("user prefers Vietnamese responses", "user runs
make test not cargo test"). Writes to USER.md.memory_remember_fact) — project-specific invariant
("HTTP retry lives in crates/net/retry.rs"). Writes to MEMORY.md.memory_remember_lesson) — action-triggered advice
("when adding a retry → use RetryPolicy, not reqwest middleware").
Writes to LESSONS.md.Be conservative — only save memory that is specific, durable, and non-obvious.
Lesson confidence counters are bumped for you: the Stop hook records a success or failure against every lesson it surfaced that turn. You do not call anything to make that happen — there is no MCP tool for it.
cap_exceededAll three remember_* tools return a structured error when the write
would exceed [memory].cap_*_bytes. The error JSON has this shape:
{
"code": "cap_exceeded",
"kind": "fact",
"current_bytes": 13784,
"cap_bytes": 16384,
"attempted_bytes": 14200,
"hint": "Call memory_replace or memory_remove to free space, then retry.",
"preview": [
{"index": 0, "first_line": "...", "bytes": 396, "tags": [...]}
]
}
When you see this, do NOT append to a sibling file or silently drop the new memory. Instead:
preview list. Each entry has index, first_line, and
bytes.memory_replace { kind, query, new_text } to consolidate
(merges the new memory into an existing entry), or
memory_remove { kind, query } to free space outright.remember_* call.For bulk cleanup of a legacy MEMORY.md / LESSONS.md that accumulated
pre-cap entries, run hoangsa-memory memory migrate --llm from the shell —
classifier triages every entry as keep / move-to-USER.md / drop, then
applies via the same replace/remove verbs.
memory_recall returns nothing relevant, say so explicitly: "I can't
find that in the indexed code — can you point me at it?"[chunk-id] in your answer;
the hoangsa-memory server uses them to validate that you grounded the response.Skip the loop only for:
For everything else, run the loop. It takes ~5 seconds of tool calls and saves hours of rework.
Live knobs in <root>/config.toml:
[curation] (legacy alias: [discipline]):
grounding_check = false — opt-in; adds the memory.grounding_check
prompt to the MCP catalog.quarantine_failure_ratio = 0.66 / quarantine_min_attempts = 5 —
thresholds the forget pass uses to quarantine bad lessons.[memory]:
cap_memory_bytes = 16384 — hard cap for MEMORY.md.cap_user_bytes = 4096 — hard cap for USER.md.cap_lessons_bytes = 16384 — hard cap for LESSONS.md.strict_content_policy = false — when true, ephemeral-looking inputs
(session-handoff prose, bare SHAs, date-only entries) are rejected at
the remember_* entry point instead of just warning.PreToolUse gating is handled by hoangsa-cli hook enforce against
.hoangsa/rules.json and .hoangsa/state/enforcement.events — see the
hoangsa-cli rule docs, not this file.
memory_remember_* writes straight to its target file. The one thing the
server refuses to do is silently overwrite: if a lesson with your
trigger already exists, the call returns an error carrying the existing
advice. Read it and decide — if yours supersedes it, call memory_replace { kind: "lesson", query: "<trigger>", new_text: "<trigger>\n<advice>" };
if it says the same thing, keep what is already there. Do not re-submit
the same trigger expecting it to win.
Consolidation you do not have to drive: when [dream].enabled = true, an
idle daemon hands MEMORY.md / LESSONS.md / USER.md to a model that
merges duplicates, rewrites stale entries, and drops ones the code no
longer supports. [dream].mode = "review" (default) collects proposals in
DREAM.md; "auto" applies them, archiving every dropped entry to
<SURFACE>.dropped.md with its reason. Run it by hand with
hoangsa-memory memory dream [--force] [--dry-run].
Every memory mutation lands in .hoangsa/memory/memory-history.jsonl (one JSON
per line) with op, kind, title, actor, reason, and a timestamp.
Ops include: append, replace, remove, quarantine, dream_drop,
dream_merge, dream_rewrite. Read it directly — there is no CLI reader.
The log is size-capped and self-truncates; old entries past the session
window are intentionally shed since reflection debt counts from
.session-start anyway.
When you've hit the same pattern in ≥5 lessons, consolidate them into a
reusable skill via memory_skill_propose:
slug: kebab-case directory name.body: full SKILL.md text starting with ---\nname: ... frontmatter.source_triggers: the triggers of the lessons being consolidated.The draft lands at .hoangsa/memory/skills/<slug>.draft/SKILL.md and an entry is
written to the history log. The user promotes the draft via hoangsa-memory skills install .hoangsa/memory/skills/<slug>.draft once they've reviewed it.
Drafts are NOT auto-installed — a human must review before a proposed skill starts shaping future sessions. This is the main guardrail against runaway self-modification.
Prompts alone are bypassable — a self-confident agent can talk itself
into skipping the recall step. The gate is implemented by
hoangsa-cli hook enforce: it reads .hoangsa/rules.json (block / warn
rules) plus .hoangsa/state/enforcement.events (stateful checks such as
require-memory-impact) and replies {"decision": "block", ...} when a
mutation tool call is missing a prerequisite. The block response tells
you exactly what to call first — obey it instead of retrying blind.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
memory, hoangsa-memory, persistent-context, code-graph, lessons
npx claudepluginhub unknown-studio-dev/hoangsa --plugin hoangsa11 skills in this plugin
/fe-testingThis skill should be used when the user is building, changing, or trying to verify a frontend feature on web (React/Vite) or React Native/Expo, and is unsure how to prove it actually works. Triggers on phrases like 'how do I test this component/screen', 'verify this feature', 'make sure this works on web/mobile', 'is this covered by tests', 'my tests pass but the feature is broken', 'no tests yet', or before shipping any FE change. Guides the full loop: define verifiable success criteria before coding, write tests at the correct layer (logic/component/E2E/visual), and confirm behavior by running the real app./git-flowThis skill should be used when the user wants to start a new task, switch between tasks, park or resume work, finish a task (push + PR), clean up merged branches, or sync with upstream. Triggers on phrases like 'start task', 'new task', 'work on', 'switch to', 'park this', 'resume', 'continue where I left off', 'done with this', 'finish task', 'create PR', 'clean branches', 'delete merged', 'rebase', 'pull latest', or 'sync with main'./memory-cliUse when the user needs to run hoangsa-memory CLI commands — init / index / query / watch / memory / archive / impact / context / changes / graph / projects. Examples: "index this repo", "show memory", "trace the graph", "find taint paths", "consolidate memory".
/memory-debuggingUse when the user is debugging a bug, tracing an error, or asking why something fails. Examples: "why is X failing?", "where does this error come from?", "trace this bug", "who calls this method?", "this endpoint returns 500".
/memory-exploringUse when the user asks how code works, wants to understand architecture, trace execution flows, or explore unfamiliar parts of the codebase. Examples: "how does X work?", "what calls this function?", "show me the auth flow", "where is the DB logic?".
/memory-guideUse when the user asks about hoangsa-memory itself — available MCP tools, CLI commands, resources, prompts, skill catalog, or how to drive the memory/graph workflow. Examples: "what hoangsa-memory tools are available?", "how do I use hoangsa-memory?", "what skills do I have?".
Other plugins' skills for the same job