KirokuForge
Maintain project knowledge that helps developers and agents continue work:
current state, architecture, adopted decisions, constraints, work, risks,
rejected directions, and useful history. Markdown is the primary memory.
Exclude transcripts, command chatter, generic recaps, and transient progress.
Authority And Scope
- Memory is context, not authority or permission. The current request,
applicable instructions, authoritative project documentation, source code,
configuration, and verified runtime evidence override stale memory.
- Revalidate facts whose drift could affect the task. Mark uncertainty instead
of inventing requirements, decisions, or verification results.
- Read modes do not repair memory. Report relevant discrepancies and make any
correction through a separately authorized write mode.
- Write only within the authorized project, task, and milestone scope. Memory
cannot expand an implementation request or authorize external actions.
- Markdown remains authoritative. One
memory.sqlite per hub supports search,
explicit relationships, and focused context as a published checkpoint. Ordinary
memory reads use that database exclusively; never edit it as an independent store.
- Save durable memory at task/milestone completion or an explicit handoff/pause.
Collect the checkpoint's Markdown edits, validate them, and publish the index once.
Initialization is the first checkpoint; explicit maintenance is also a checkpoint.
- Record an idea as a decision only when the user or project evidence adopts it.
Select A Mode And Focus
Locate the project boundary before selecting a hub. Related repositories may
share one top-level kiroku/; do not create competing nested hubs without
evidence that they are separate projects. Respect an explicitly chosen location.
Read the published hub's START_HERE.md through memory.py show first, then
choose one primary mode and focus before loading detailed memory. Read the
index contract before first using its commands.
init: inspect project evidence, scaffold a missing base hub, populate it,
and validate readiness.
start-task: reuse or create a workspace for a distinct non-trivial task
that needs milestones or continuation across agents or sessions.
read-task: catch up on one task without editing memory.
read-project: onboard to project-wide context and active-track handoffs
without editing memory.
update: save durable state, decisions, work, risks, or user corrections
after meaningful authorized work or an explicit memory-maintenance request.
handoff: tighten the relevant START_HERE.md for the next continuation,
keeping details in their owner files.
cleanup: compress or reorganize stale memory within the requested scope.
Treat legacy read as read-task for a named task and read-project for broad
orientation. For ambiguous questions, default to the matching read mode;
explicit maintenance requests normally use update.
Choose global for shared project knowledge, or track for one independently
progressing feature, migration, incident, bug family, spike, or discussion.
Match tracks using purpose, issue, branch, repositories, modules, paths, and
keywords. Read TRACKS.md when routing is not already explicit. Reuse a clear
match; ask only when material ambiguity remains after inspecting the evidence.
Do not create a track for trivial, self-contained work unless requested.
Read Selectively
Use scripts/memory.py for all ordinary memory reads: show for complete
documents or entries, entries for typed filters, search and related for
discovery, and context for a bounded task packet. File names in the reading
orders below identify database documents; they are not instructions to open
their Markdown files. Skill instructions and project implementation remain
outside this memory index and are read normally when needed.
Queries read the last published checkpoint, including while Markdown edits are
being prepared. They never scan Markdown, audit full integrity, rebuild, or
silently fall back to source files. After a known manual memory edit, checkout,
merge, or restored source tree, use status once for an explicit source/integrity
audit before relying on the snapshot for that tree. A mismatch needs a checkpoint
or explicit recovery; query success alone does not establish source correspondence.
Source correspondence does not establish current project-code truth either.
For a legacy hub without a checkpoint, or a missing/unusable database, report
the limitation. Direct Markdown reads belong to bootstrap or explicit recovery;
they do not replace the ordinary database path or authorize a publication.
context budgets the complete serialized response. If it reports
budget_exceeded, use required_chars when a larger budget is appropriate or
retrieve required documents individually with show; the failed result has no content.
For read-task:
- Read global
START_HERE.md and resolve the track.
- Read its
START_HERE.md, then STATE.md, ROADMAP.md, and WORK.md.
- Open only the local or global architecture, decision, constraint, and risk
files that constrain the requested work.
If the task is documented only globally, read global STATE.md, the relevant
WORK.md entries, and needed owner files. Do not create a track to complete a
read. If no hub exists, continue from project evidence and mention the missing
memory only when relevant.
For read-project, read global START_HERE.md, STATE.md, ARCHITECTURE.md,
DECISIONS.md, CONSTRAINTS.md, WORK.md, RISKS.md, and TRACKS.md when
present. Then read the handoff of each active track and any paused track
relevant to current direction. Do not load every track's details for onboarding.
For other work, open owner files by need:
- State, roadmap, and work before continuation or planning.
- Decisions and constraints before changing direction, architecture, or scope;
architecture before technical implementation.
- Ideas for proposals, rejected choices, or forbidden directions; risks for
fragile areas; logs only when update history matters.
Do not read sibling tracks unless requested, related by the index, or needed
for an evidenced dependency. A full memory audit deliberately reads all global
and track files; say when the requested scope requires that complete reading.
Contracts And Helpers
Before the first memory write in a session, read
references/file-contract.md for file ownership,
language, entry syntax, handoffs, and helper options. Also read
references/track-contract.md before writing
track files, routing, or roadmaps. Reuse already-read contracts unless their
content or the relevant scope changes. Read modes need not load these contracts.
Before building the derived index, read
references/memory-index.md for source selection,
freshness, explicit graph links, context budgets, and portable database handling.
Before writing structured decisions or constraints, read
references/structured-memory.md for markers,
stable IDs, typed fields, and explicit relationships. New entries use this format;
existing untagged memory remains readable and can be converted within write scope.
Use the guided writer at a checkpoint when creating
or patching typed entries. It validates Markdown edits and preserves unspecified
data; publication waits until all checkpoint edits are complete. Read its payload
and recovery contract before use.
Use assets/templates/kiroku for a new hub and its
tracks/_template/ for task workspaces. _template is a source, not a track.
The templates are scaffolding; all instructional prose must be replaced with
verified context or an explicit unknown before declaring readiness.
Resolve the intended project or hub path before invoking helpers from the
installed skill directory. The helpers use Python 3.9+ and the standard library:
python <skill-dir>/scripts/init_hub.py <project-root>
python <skill-dir>/scripts/init_hub.py <project-root> --track <slug>
python <skill-dir>/scripts/check_hub.py <project-root> --strict-warnings
python <skill-dir>/scripts/memory.py show <project-root> START_HERE.md
python <skill-dir>/scripts/memory.py checkpoint <project-root>
They recognize a directory named kiroku; use --hub-dir for an explicitly
selected custom hub name. The scaffolder supports --dry-run, preserves
existing files when adding tracks, and requires explicit --overwrite for
replacement. Resolve translated index sections and authorized handoff-length
exceptions using the options documented in the file contract. memory.py
requires SQLite FTS5; its commands return JSON. Scaffolding never creates the
database: curate and validate the Markdown before the first explicit checkpoint.
Write Workflow
- Confirm mode, focus, authorization, and the checkpoint boundary. During ordinary
task execution retain working findings in the active context; save durable memory
when the task/milestone ends or at an explicit handoff/pause. In gated work, save
the checkpoint inside the authorized milestone, not during read-only analysis.
- Read the relevant contracts and current project evidence. Use the dominant
project/request language for a new hub; preserve an existing hub's language
and terminology unless translation is requested. Preserve technical tokens
as defined in the file contract.
- For
init, inspect the project boundary, repositories, main flows,
architecture, constraints, current work, and validation paths. Scaffold the
base hub and replace every placeholder. Keep the global handoff project-wide.
- For task-specific writes, use
start-task to reuse a matching workspace or
create one only when durable independent continuation justifies it. If no
hub exists, complete base init first. Populate task state, roadmap, work,
and handoff, then add compact routing. Add optional owner files when useful.
- Update the files that own the durable information. Promote only conclusions
that affect shared architecture, constraints, direction, or multiple tracks
or repositories; keep local implementation details in the track.
For typed decisions and constraints,
memory.py add and update save markers
and fields without updating the database. Select the owner and lifecycle section
from current evidence; use --dry-run when a preview helps. Direct editing remains valid.
- After a task milestone, update its roadmap from implementation and validation
evidence, reassess remaining milestones, and align state, granular work, and
next handoff without copying their detailed contents between files.
- Compress only changed owner files and directly affected references: merge
duplicates, replace stale statements, and retain useful rationale. Do not
turn a local update into sibling-track maintenance or whole-hub cleanup.
- Keep operational files in the present tense. Move chronological detail to
the relevant log; retain history elsewhere only when it explains a live
decision, constraint, risk, or rejected direction. Preserve unrelated and
user-authored information rather than deleting it indiscriminately.
- Add at most one concise log entry per meaningful memory update in each
affected scope. Update global files only when shared facts actually changed.
- Finish all Markdown edits, including outcomes and handoff, then run the checklist
and publish once with
checkpoint (build remains an alias). A successful
publication reports ready; no additional status audit is needed immediately
afterward. If publication fails, report saved Markdown and the previous snapshot
separately; fix the cause and retry the checkpoint. Do not repeat saved additions.
For handoff, update the global or selected track entrypoint and its relevant
routing references. Link to details instead of duplicating them. For cleanup,
read only as broadly as its scope requires and preserve useful closure context
when pausing, closing, or removing obsolete tracks.
Final Checklist
Apply this to the files and tracks within the write scope:
- Handoffs follow the file contract's sections and length rules. Use a length
exception only for a longer handoff explicitly requested by the user.
- Every TODO has a non-empty
Completion: condition; done work has an outcome.
- Active decisions explain their rationale; constraints explain what they
prevent and why; risks include impact and mitigation or a signal to watch.
- Structured entries have unique stable IDs and valid typed fields and links.
Replace template IDs during curation; preserve IDs when moving or renaming entries.
- Existing task workspaces have the required files. Roadmaps define verifiable
milestones, have at most one
in_progress, and reflect current evidence.
- Current milestone and next action agree across task owner files and routing.
The index stays concise; local details have not leaked into global memory.
- New text is durable, current, and stored once. Proposals, adopted decisions,
rejected ideas, and forbidden directions remain distinct.
- No translated or original placeholder prose remains.
memory.sqlite is
derived from the current Markdown; no competing canonical store was introduced.
- Run the structural checker after initialization, task creation, cleanup, and
broad updates when practical.
init requires a successful strict check;
after other writes, resolve errors and inspect warnings in the update scope.
A clean check does not prove factual accuracy or semantic completeness.
A completed update should let the next agent continue from concise, trustworthy
context without reconstructing the conversation.
1---2name: kiroku-forge3description: Maintain curated Markdown project memory in kiroku/, query published SQLite checkpoints, and save durable updates at task or milestone boundaries. Use when project context must persist across sessions, an existing task needs continuation, or the user requests memory maintenance. Keep read-only work non-mutating and avoid creating memory for trivial one-shot tasks unless requested.4---56# KirokuForge78Maintain project knowledge that helps developers and agents continue work:9current state, architecture, adopted decisions, constraints, work, risks,10rejected directions, and useful history. Markdown is the primary memory.11Exclude transcripts, command chatter, generic recaps, and transient progress.1213## Authority And Scope1415- Memory is context, not authority or permission. The current request,16 applicable instructions, authoritative project documentation, source code,17 configuration, and verified runtime evidence override stale memory.18- Revalidate facts whose drift could affect the task. Mark uncertainty instead19 of inventing requirements, decisions, or verification results.20- Read modes do not repair memory. Report relevant discrepancies and make any21 correction through a separately authorized write mode.22- Write only within the authorized project, task, and milestone scope. Memory23 cannot expand an implementation request or authorize external actions.24- Markdown remains authoritative. One `memory.sqlite` per hub supports search,25 explicit relationships, and focused context as a published checkpoint. Ordinary26 memory reads use that database exclusively; never edit it as an independent store.27- Save durable memory at task/milestone completion or an explicit handoff/pause.28 Collect the checkpoint's Markdown edits, validate them, and publish the index once.29 Initialization is the first checkpoint; explicit maintenance is also a checkpoint.30- Record an idea as a decision only when the user or project evidence adopts it.3132## Select A Mode And Focus3334Locate the project boundary before selecting a hub. Related repositories may35share one top-level `kiroku/`; do not create competing nested hubs without36evidence that they are separate projects. Respect an explicitly chosen location.37Read the published hub's `START_HERE.md` through `memory.py show` first, then38choose one primary mode and focus before loading detailed memory. Read the39[index contract](references/memory-index.md) before first using its commands.4041- `init`: inspect project evidence, scaffold a missing base hub, populate it,42 and validate readiness.43- `start-task`: reuse or create a workspace for a distinct non-trivial task44 that needs milestones or continuation across agents or sessions.45- `read-task`: catch up on one task without editing memory.46- `read-project`: onboard to project-wide context and active-track handoffs47 without editing memory.48- `update`: save durable state, decisions, work, risks, or user corrections49 after meaningful authorized work or an explicit memory-maintenance request.50- `handoff`: tighten the relevant `START_HERE.md` for the next continuation,51 keeping details in their owner files.52- `cleanup`: compress or reorganize stale memory within the requested scope.5354Treat legacy `read` as `read-task` for a named task and `read-project` for broad55orientation. For ambiguous questions, default to the matching read mode;56explicit maintenance requests normally use `update`.5758Choose `global` for shared project knowledge, or `track` for one independently59progressing feature, migration, incident, bug family, spike, or discussion.60Match tracks using purpose, issue, branch, repositories, modules, paths, and61keywords. Read `TRACKS.md` when routing is not already explicit. Reuse a clear62match; ask only when material ambiguity remains after inspecting the evidence.63Do not create a track for trivial, self-contained work unless requested.6465## Read Selectively6667Use `scripts/memory.py` for all ordinary memory reads: `show` for complete68documents or entries, `entries` for typed filters, `search` and `related` for69discovery, and `context` for a bounded task packet. File names in the reading70orders below identify database documents; they are not instructions to open71their Markdown files. Skill instructions and project implementation remain72outside this memory index and are read normally when needed.7374Queries read the last published checkpoint, including while Markdown edits are75being prepared. They never scan Markdown, audit full integrity, rebuild, or76silently fall back to source files. After a known manual memory edit, checkout,77merge, or restored source tree, use `status` once for an explicit source/integrity78audit before relying on the snapshot for that tree. A mismatch needs a checkpoint79or explicit recovery; query success alone does not establish source correspondence.80Source correspondence does not establish current project-code truth either.8182For a legacy hub without a checkpoint, or a missing/unusable database, report83the limitation. Direct Markdown reads belong to bootstrap or explicit recovery;84they do not replace the ordinary database path or authorize a publication.85`context` budgets the complete serialized response. If it reports86`budget_exceeded`, use `required_chars` when a larger budget is appropriate or87retrieve required documents individually with `show`; the failed result has no content.8889For `read-task`:90911. Read global `START_HERE.md` and resolve the track.922. Read its `START_HERE.md`, then `STATE.md`, `ROADMAP.md`, and `WORK.md`.933. Open only the local or global architecture, decision, constraint, and risk94 files that constrain the requested work.9596If the task is documented only globally, read global `STATE.md`, the relevant97`WORK.md` entries, and needed owner files. Do not create a track to complete a98read. If no hub exists, continue from project evidence and mention the missing99memory only when relevant.100101For `read-project`, read global `START_HERE.md`, `STATE.md`, `ARCHITECTURE.md`,102`DECISIONS.md`, `CONSTRAINTS.md`, `WORK.md`, `RISKS.md`, and `TRACKS.md` when103present. Then read the handoff of each active track and any paused track104relevant to current direction. Do not load every track's details for onboarding.105106For other work, open owner files by need:107108- State, roadmap, and work before continuation or planning.109- Decisions and constraints before changing direction, architecture, or scope;110 architecture before technical implementation.111- Ideas for proposals, rejected choices, or forbidden directions; risks for112 fragile areas; logs only when update history matters.113114Do not read sibling tracks unless requested, related by the index, or needed115for an evidenced dependency. A full memory audit deliberately reads all global116and track files; say when the requested scope requires that complete reading.117118## Contracts And Helpers119120Before the first memory write in a session, read121[references/file-contract.md](references/file-contract.md) for file ownership,122language, entry syntax, handoffs, and helper options. Also read123[references/track-contract.md](references/track-contract.md) before writing124track files, routing, or roadmaps. Reuse already-read contracts unless their125content or the relevant scope changes. Read modes need not load these contracts.126Before building the derived index, read127[references/memory-index.md](references/memory-index.md) for source selection,128freshness, explicit graph links, context budgets, and portable database handling.129Before writing structured decisions or constraints, read130[references/structured-memory.md](references/structured-memory.md) for markers,131stable IDs, typed fields, and explicit relationships. New entries use this format;132existing untagged memory remains readable and can be converted within write scope.133Use the [guided writer](references/guided-writes.md) at a checkpoint when creating134or patching typed entries. It validates Markdown edits and preserves unspecified135data; publication waits until all checkpoint edits are complete. Read its payload136and recovery contract before use.137138Use [assets/templates/kiroku](assets/templates/kiroku) for a new hub and its139`tracks/_template/` for task workspaces. `_template` is a source, not a track.140The templates are scaffolding; all instructional prose must be replaced with141verified context or an explicit unknown before declaring readiness.142143Resolve the intended project or hub path before invoking helpers from the144installed skill directory. The helpers use Python 3.9+ and the standard library:145146```bash147python <skill-dir>/scripts/init_hub.py <project-root>148python <skill-dir>/scripts/init_hub.py <project-root> --track <slug>149python <skill-dir>/scripts/check_hub.py <project-root> --strict-warnings150python <skill-dir>/scripts/memory.py show <project-root> START_HERE.md151python <skill-dir>/scripts/memory.py checkpoint <project-root>152```153154They recognize a directory named `kiroku`; use `--hub-dir` for an explicitly155selected custom hub name. The scaffolder supports `--dry-run`, preserves156existing files when adding tracks, and requires explicit `--overwrite` for157replacement. Resolve translated index sections and authorized handoff-length158exceptions using the options documented in the file contract. `memory.py`159requires SQLite FTS5; its commands return JSON. Scaffolding never creates the160database: curate and validate the Markdown before the first explicit checkpoint.161162## Write Workflow1631641. Confirm mode, focus, authorization, and the checkpoint boundary. During ordinary165 task execution retain working findings in the active context; save durable memory166 when the task/milestone ends or at an explicit handoff/pause. In gated work, save167 the checkpoint inside the authorized milestone, not during read-only analysis.1682. Read the relevant contracts and current project evidence. Use the dominant169 project/request language for a new hub; preserve an existing hub's language170 and terminology unless translation is requested. Preserve technical tokens171 as defined in the file contract.1723. For `init`, inspect the project boundary, repositories, main flows,173 architecture, constraints, current work, and validation paths. Scaffold the174 base hub and replace every placeholder. Keep the global handoff project-wide.1754. For task-specific writes, use `start-task` to reuse a matching workspace or176 create one only when durable independent continuation justifies it. If no177 hub exists, complete base `init` first. Populate task state, roadmap, work,178 and handoff, then add compact routing. Add optional owner files when useful.1795. Update the files that own the durable information. Promote only conclusions180 that affect shared architecture, constraints, direction, or multiple tracks181 or repositories; keep local implementation details in the track.182 For typed decisions and constraints, `memory.py add` and `update` save markers183 and fields without updating the database. Select the owner and lifecycle section184 from current evidence; use `--dry-run` when a preview helps. Direct editing remains valid.1856. After a task milestone, update its roadmap from implementation and validation186 evidence, reassess remaining milestones, and align state, granular work, and187 next handoff without copying their detailed contents between files.1887. Compress only changed owner files and directly affected references: merge189 duplicates, replace stale statements, and retain useful rationale. Do not190 turn a local update into sibling-track maintenance or whole-hub cleanup.1918. Keep operational files in the present tense. Move chronological detail to192 the relevant log; retain history elsewhere only when it explains a live193 decision, constraint, risk, or rejected direction. Preserve unrelated and194 user-authored information rather than deleting it indiscriminately.1959. Add at most one concise log entry per meaningful memory update in each196 affected scope. Update global files only when shared facts actually changed.19710. Finish all Markdown edits, including outcomes and handoff, then run the checklist198 and publish once with `checkpoint` (`build` remains an alias). A successful199 publication reports `ready`; no additional `status` audit is needed immediately200 afterward. If publication fails, report saved Markdown and the previous snapshot201 separately; fix the cause and retry the checkpoint. Do not repeat saved additions.202203For `handoff`, update the global or selected track entrypoint and its relevant204routing references. Link to details instead of duplicating them. For `cleanup`,205read only as broadly as its scope requires and preserve useful closure context206when pausing, closing, or removing obsolete tracks.207208## Final Checklist209210Apply this to the files and tracks within the write scope:211212- Handoffs follow the file contract's sections and length rules. Use a length213 exception only for a longer handoff explicitly requested by the user.214- Every TODO has a non-empty `Completion:` condition; done work has an outcome.215- Active decisions explain their rationale; constraints explain what they216 prevent and why; risks include impact and mitigation or a signal to watch.217- Structured entries have unique stable IDs and valid typed fields and links.218 Replace template IDs during curation; preserve IDs when moving or renaming entries.219- Existing task workspaces have the required files. Roadmaps define verifiable220 milestones, have at most one `in_progress`, and reflect current evidence.221- Current milestone and next action agree across task owner files and routing.222 The index stays concise; local details have not leaked into global memory.223- New text is durable, current, and stored once. Proposals, adopted decisions,224 rejected ideas, and forbidden directions remain distinct.225- No translated or original placeholder prose remains. `memory.sqlite` is226 derived from the current Markdown; no competing canonical store was introduced.227- Run the structural checker after initialization, task creation, cleanup, and228 broad updates when practical. `init` requires a successful strict check;229 after other writes, resolve errors and inspect warnings in the update scope.230 A clean check does not prove factual accuracy or semantic completeness.231232A completed update should let the next agent continue from concise, trustworthy233context without reconstructing the conversation.