/foundation:fa-foundation-context-authoringfrom foundation
Creates, rewrites, or restructures a scope's instruction file (CLAUDE.md/AGENTS.md) and MEMORY.md topic store, enforcing separation of timeless rules from dated state and ensuring each scope only states its delta over its parent.
Ships in foundation. 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.
Use this skill when the structure of a scope's context pair is wrong or absent — you are creating a file, rewriting one, or moving content across the instruction/MEMORY.md line.
Use this skill when:
MEMORY.mdmemory/ topics, or the audit reports a stale index, malformed frontmatter or an invalid typeDo not use this skill when:
fa-foundation-optimize-directory-tree's job, not a scope-by-scope authoring passfa-foundation-create-skilldocs/ layermemory/ topic files with valid frontmatter, and a MEMORY.md generated from themmemory/ topic, never in the instruction file.memory/ topic, every local SKILL.md, plus the pair at each parent scope. Editing at a located insertion point is how a file ends up asserting one thing in its conventions section and the opposite three paragraphs down, and how a "new" rule gets added beside the weaker version of itself that was already there.${CLAUDE_PLUGIN_ROOT}/scripts/context-audit.py and clear every mechanical finding before handing off.MEMORY.md is a pure index, and it is derived — never authored. Content lives in a memory/ directory beside it, one topic file per concern, so a reader lists the index, skims frontmatter, and deep-reads only what the task needs. Every line of the index is computed from those topic files: the heading from the scope's path, each title from the topic's # H1, each hook from its description:, the order from its type:. You write topic files and then run the generator; you do not write MEMORY.md.
python3 ${CLAUDE_PLUGIN_ROOT}/scripts/context-audit.py --fix-index --scope <your directory>
Carry --scope every time, not only in a fan-out: unscoped, one run regenerates every index in the tree, including ones a sibling agent is still editing. Write that same scoped command into the instruction file's ## Upkeep section — the section is where the next agent reads it from, so an unscoped one there outlives every brief that got it right, and the audit reports it as UPKEEP-UNSCOPED. It refuses to regenerate a store whose topics have malformed frontmatter — a last_verified in the future included — and refuses when memory/ holds no topic at all rather than truncating the index to a bare heading. It applies the same refusals when creating a missing index, and runs every per-topic check before it writes one. Only *.md topics live in memory/ — anything else there is MEMORY-STORE-DEBRIS.
# MEMORY — packages/ingest
- [Red — there is no safe blanket push here](memory/alerts.md) — the description of alerts.md, verbatim
- [Current state](memory/state.md) — the description of state.md, verbatim
The heading is the scope's path relative to the repository root; the root's own index uses the repository directory's name. Order is by type — alert, state, decision, gotcha, question, watch, kill-record, evidence, log, reference — canonical file before its split siblings, then alphabetical. Any byte of difference between the file on disk and that derivation is MEMORY-INDEX-STALE, and the fix is always to regenerate, never to edit the index.
Every topic file opens with exactly this block — four keys, in this order, no extras, then a blank line and the heading — so head -8 returns the complete relevance signal plus that heading:
---
name: <scope slug>-<file stem>
description: "one line, at most 240 characters — the index hook"
type: state
last_verified: YYYY-MM-DD
---
# <Topic heading — becomes the index title>
name is <scope slug>-<file stem>: the scope's directory name kebab-cased, a grouping directory prefixed by its parent, the repository root root — so packages/ingest/memory/gotchas.md is ingest-gotchas. description is the index hook, and it carries the signal, not a label — "deployment notes" is a wasted line; "deploy decided, unpushed range still local, kill clock void once live" leaves a reader informed even if they stop at the index. It is capped at 240 characters: past that it is narrating the body, or the topic is two topics. The first body line is a # Heading, because the index title comes from it, and an alert's heading begins Red — . type is one of exactly ten values, always singular — the file may be decisions.md, the type is decision, and a plural silently defeats any tooling that filters on type: alert (read at every level passed through, and sorted to the top) · state · decision (recorded with its why, or the next agent reverses it on cost alone) · gotcha · question (naming its owner) · watch · kill-record · evidence · log (a pointer index, never a changelog) · reference. Keep a topic under 60 lines and 6,000 characters; past either it is two topics. Restamp last_verified only for what you actually inspected, never for what you merely edited, and never date it in the future. Topic files carry no ## Upkeep section. Relative links inside a topic resolve from memory/, one level below the scope — prefix ../.
Never describe a directory's file inventory from inside a file you are adding to that directory. One pass wrote "this directory contains exactly one file" into four MEMORY.md files it was in the act of adding to those directories — false before the write completed. Describe dormancy and last real activity instead of file counts and mtimes, and warn explicitly when a context file's own mtime must not be read as scope activity.
| Failure mode | Recovery | Owner | Escalation |
|---|---|---|---|
| status found in an instruction file | move the sentence into a memory/ topic, delete the original | author | re-read the whole file for siblings of it |
| scope restates a parent | delete the restatement and link upward | author | fix the parent instead, if the parent is what is wrong |
MEMORY.md is prose, not an index | split it into memory/ topics, put each hook in that topic's description:, then regenerate the index | author | audit sibling scopes for the same shape |
invalid type or malformed frontmatter | rewrite the four-key block; singularize the type | author | re-run the context audit |
| a fact cannot be verified now | omit it, or record it as a question with an owner | author | escalate to the human owner |
MEMORY.md beside it — both files, or neithermemory/state.md while the structural stack statement stays put.MEMORY.md was generated rather than written, every description: carries signal rather than a label inside 240 characters, and every topic file has the four-key frontmatter, an # H1, a singular type and an honest last_verifiedWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
context-authoring, cascade, instruction-file, memory-store, scope-delta
10 skills in this plugin
/fa-foundation-context-auditProvides the whole-repository context-layer drift sweep — every instruction file, every MEMORY.md and topic store, and every skills directory reconciled against inspected reality rather than against what the files claim. Use it when the periodic sweep is due, after a long dormancy, before any decision that depends on the context layer or the registry being literally true, when more than one scope looks untrustworthy at once, or when a previous sweep's findings need verifying rather than re-deriving. It checks what those files and registries claim against what is on disk; it never re-derives what they should say from a project's source — a tree with no context layer, or one to rebuild from source, is `fa-foundation-optimize-directory-tree`'s./fa-foundation-create-agentProvides the house rules for an agent definition that actually gets invoked and stays in its lane — one role per file, a description carrying what the agent is for and when to reach for it, an explicit anti-mission, an output contract, and a tool scope no wider than the role needs. Use it when adding an agent, when an agent never fires or fires on the wrong work, when two agents claim the same scope, when a definition's tools no longer match what it does, or when rationalizing a set of agents that has sprawled. It never authors a skill — that is `fa-foundation-create-skill` — and it never audits a whole definition directory, which is the skills auditor's./fa-foundation-create-planProvides a researched, executable plan for work that is large, ambiguous or hard to reverse — requirements clarified with the human first, three identical subagents fanned out to propose plans in parallel, all three critiqued dispassionately, and the best single plan synthesized and written to a file another agent can execute from. Use it before any multi-step build, refactor or migration, when two plausible approaches need deciding between, when the first choice made will be expensive to undo, or when the work will be handed to someone else to carry out. It plans; it never implements, and sequencing an approved architecture into gated delivery tasks is `fa-engineering-planning`'s./fa-foundation-create-skillProvides the house rules for a SKILL.md that actually fires — naming, the frontmatter contract, a description written as a trigger rather than a summary of the body, the standard section shape, references kept one level deep, and the prior decision of whether a new skill is warranted at all. Use it when adding a skill, when a skill never triggers or triggers on the wrong work, when a trap-bearing procedure has been repeated often enough to deserve one, or when consolidating skills that have drifted into each other. It never authors an agent definition — that is `fa-foundation-create-agent`./fa-foundation-memory-maintenanceProvides the deep-refresh procedure for one scope's memory store — the `memory/` topic files, plus the `MEMORY.md` index regenerated from them — re-established against inspected reality, not against what the previous version claimed. Use it when a session shipped, decided, discovered, abandoned or unblocked something; when a topic's `last_verified` is past the repository's freshness window; when an instruction file has accumulated a date, a status, a version pin or a "currently"; or before trusting any recorded status — a git status above all — for a consequential decision. It refreshes a store that already exists; standing stores up across a whole tree is `fa-foundation-optimize-directory-tree`'s./fa-foundation-optimize-directory-treeProvides the whole-tree bootstrap that puts the Gaia context layer onto an existing directory tree — an instruction file and MEMORY.md topic store at every scope that earns one, a root registry, and the retrospective design documentation its projects never had — and re-validates a bootstrapped tree against its projects' source. Use it when a tree of code, research or operational documentation has no context layer, or when one exists that was never derived from what the projects actually are. It never edits one scope's pair inside a cascade that already exists — that is `fa-foundation-context-authoring`; never audits an existing layer against itself — `fa-foundation-context-audit`; never writes one repository's design docs alone — `fa-engineering-architecture`; and never scaffolds application code.npx claudepluginhub frostaura/technologies.fa.gaia --plugin foundationOther plugins' skills for the same job