Customize a workspace
A workspace holds its own values in its own files: the document types, the statuses, the required sections, the tags, and the rules for agents. To change a value, edit the file that holds it. The skills need no change, because they read these values from the engine each time they run. For the meaning of each file and field, see Workspace.
Check each change
Before you change a file, commit your work, so that git can undo a change that the engine refuses.
After each change to the reasonry.config.json file, do the following:
-
Confirm that the engine accepts the file:
npx -y @push-based/reasonry@2 compileThe command prints the configuration as JSON. The following output comes from a file with an error, a status entry with
lvein place oflive:reasonry: /path/to/team-knowledge/reasonry.config.json is invalid:types.decision.statuses.0.live: Invalid input: expected boolean, received undefinedtypes.decision.statuses.0.lve: Unrecognized key: "lve" -
Run the check, because a change to the configuration can make existing documents invalid:
npx -y @push-based/reasonry@2 check -
Restart the
reasonry-keeperserver in your AI coding tool. A server that is running keeps the configuration that it read at startup.
A change to an initiative.json file or to the templates/ folder needs no restart, because the
server reads those files at each use. After a change to an initiative.json file, run the check.
Change the statuses of a type
Each type in the types object of the reasonry.config.json file has a statuses list.
-
Add, rename, or reorder the entries in the list. For example, this entry adds a status for a decision that the team paused:
{ "name": "on-hold", "live": false }Set
livetotrueif readers act on a document in the status. Setlivetofalseif the status retires the document: search then ranks the document lower, and the validation warns about each link to it from a live document. -
Keep the first entry as the status that a document starts in. For a decision or an open question, a document in the first status is provisional: nobody has to follow it.
-
Keep the 2 names that the engine depends on:
supersededfor thedecisionandevidencetypes, andresolvedfor thereporttype. Without one of them,compilerefuses the file:reasonry: /path/to/team-knowledge/reasonry.config.json is invalid:types.decision.statuses: Expected a "superseded" status: the engine reads it for successors, banners, and stale links -
If you renamed or removed a status, change the
statusfield of every document that used it. The following check output, shortened, comes from a rename ofacceptedtoapproved:source errors:- DEC-TT-0001: Invalid status "accepted" (expected: draft, approved, rejected, superseded)FAILED — 1 error(s), 0 warning(s)
Change the sections that a type requires
A type's template object lists the second-level headings in the body of a document. The
following template is the one for decisions in the engine's preset:
"template": {
"required": ["Context", "Decision", "Consequences", "Alternatives Considered"],
"optional": ["Open Questions", "Links", "Challenge"],
"aliases": {},
"flagUnknown": true,
"maxLines": 250,
"summaryMaxSentences": 6,
"noQuestionsIn": ["Decision"]
}
Edit the template for the change that you want:
- To require or to allow a section, add its heading to
requiredor tooptional. - To accept another spelling of a heading, add the spelling to
aliases, with the name inrequiredoroptionalas its value:"Background": "Context". - To allow every heading, set
flagUnknowntofalse. The preset sets it totruefor decisions and open questions, and tofalsefor evidence. - To change the limit on a document's length or on its summary, edit
maxLinesorsummaryMaxSentences.
For every field of a template, see The workspace's configuration.
A document that doesn't match its template gets a warning, never an error. The check counts the warnings and doesn't list them. To list them after you add a required heading, validate the source documents. Then add the section to each listed document, or accept the warnings:
npx -y @push-based/reasonry@2 validate --target=source
The following output, shortened, comes from a workspace that added Rollback to the required
headings of decisions:
## Source Issues
- **source/initiatives/team-tooling/decisions/DEC-TT-0001-first-review-within-1-working-day.md**: ⚠️ Template: missing required section "## Rollback"
Add a document type
The engine requires 4 types, whose names are fixed: decision, question, evidence, and
report. A workspace can add types of its own, such as a runbook.
-
Add an entry to the
typesobject. The key is the value of thedoc_typefield in each document of the type:"runbook": {"label": "Runbook","id": { "start": "RUNBOOK", "form": "named" },"folder": "runbooks","statuses": [{ "name": "active", "live": true },{ "name": "superseded", "live": false }]} -
Choose the form of the type's IDs in
id.form:numbered:START-PREFIX-0001, with the initiative's prefix and the next free number.named:START-NAME, such asRUNBOOK-DEPLOY, unique inside one initiative.fixed:STARTalone, one document for each initiative.
-
Set
folderto the type's folder inside an initiative. Every type exceptreportneeds one. -
Optional: Add a
templateobject with the sections that the type requires. A template needs all 5 of therequired,optional,aliases,flagUnknown, andnoQuestionsInfields. A list can be empty.
To create a document of the type, ask the agent, or use the upsert command: see
The upsert request. For a type with named
IDs, the request needs the name field: "name": "deploy" gives the ID RUNBOOK-DEPLOY in the
runbooks/deploy.md file.
The skills hold writing guidance for decisions, open questions, evidence, and an initiative's plan
and context files. For a type of your own, put the guidance in the workspace's AGENTS.md file.
Change an initiative's tags and recommended fields
Each initiative's initiative.json file holds its tag list and the fields that it recommends. The
engine checks both for decisions, open questions, and evidence only. Edit the file for the change
that you want:
- To add a tag, add it to the
tagslist in the formfacet/value, such astopic/billing. If a document has a tag that isn't in the list, the check reports anInvalid tagerror. If the list is empty, the check accepts every tag. - To separate checked knowledge from unchecked input, add tags that start with
provenance/. After the list has one, the validation warns about each document without aprovenance/tag, and thesearchtool can filter on the tag. - To make the validation warn about a missing frontmatter field, add the field's name to the
recommendslist. The preset recommendssummary.
Don't change the prefix after the initiative has its first numbered document: every ID contains
it.
Change the template for initiatives
The templates/initiative/ folder is the skeleton that the engine copies when it creates an
initiative. Edit its files to change what each later initiative starts with, such as the charter's
headings or the recommends list. The engine fills these placeholders: {{name}}, {{prefix}},
{{slug}}, {{domain}}, and {{date}}. A change to the template doesn't change the initiatives
that exist.
Change the rules for agents
The workspace's AGENTS.md file holds the rules that every agent follows:
- To change how the agent writes documents, edit the section "When you write". The skills apply that section to every sentence that they write.
- To add a rule for the whole workspace, add it under "Local rules".
- To add a rule for one initiative, write it in that initiative's own
AGENTS.mdfile. For that initiative, it overrides the workspace's rule.
Add an initiative's own checks with a hook
A hook is a JavaScript module that adds one initiative's own rules to the engine's checks. Use a hook for a rule that the configuration can't express, such as a field that every decision of the initiative must have. A hook module can hold 3 functions for each document type:
validatechecks a document's frontmatter and reports errors and warnings.parsereads structured data out of a document's body. The engine stores the result on the document's node in the graph.formatrenders structured data as a document's body. Theupsertcommand and theupsert_documenttool call it when a request has adatafield, and refuse the write unlessparsereturns the same data.
Caution: A hook is code that runs on the machine of everyone who maintains the knowledge base. Review a change to a hook the way that you review code.
Add a validation hook
This example makes the check fail for a decision that names no reviewing team.
-
In the initiative's folder, create the
hooks/index.mjsfile:export default {decision: {validate: (frontmatter) =>frontmatter.reviewers?.length? []: [{severity: "error",message: "A decision names at least one reviewing team",field: "reviewers",},],},}; -
Name the module in the initiative's
initiative.jsonfile. The path is relative to the initiative's folder:"hooks": "hooks/index.mjs" -
Run the check. The following output, shortened, comes from a workspace with one draft decision that names no reviewers:
source errors:- DEC-TT-0002: hook validate (decision): reviewers: A decision names at least one reviewing team -
Fix each document that the check lists.
-
If the
graph.jsonfile is in git, rebuild the graph. The graph records the hook module, and the check reports the graph astracked, staleuntil you rebuild it:npx -y @push-based/reasonry@2 graph buildThe command confirms that it loaded the module:
✅ Graph rebuilt: 6 nodes, 7 edges. Graph schema v2.Hook modules loaded for: team-tooling. An edited module is re-imported on the next rebuild; a helper file it imports needs a server restart. -
Commit the module, the manifest, and the
graph.jsonfile together.
Rules for a hook module
The engine loads a module only if it meets these rules. The check reports a module that breaks one as an error on the initiative:
- The module is a file inside the initiative's folder.
- Git can commit the file: it isn't ignored or excluded.
- The default export is an object with one entry for each document type, under the type's name in the configuration. An entry for a type that the configuration doesn't have gets a warning.
A validate hook is one of two things:
- A function that takes the frontmatter and a context object, and returns a list of issues. Each
issue has a
severityoferrororwarning, amessage, and an optionalfield. - A schema object with a
safeParsemethod, such as a Zod schema. Each issue that the schema reports becomes an error.
The hooks are synchronous. They receive a frozen copy of the frontmatter, so a hook can't change
what the engine reads. The context object has the document's docType, id, path, and
initiative, the workspaceRoot, and the document's attachments.
Where a hook runs
A hook runs on the maintainers' side only, wherever the engine validates documents or builds the
graph: in the check, validate, graph build, upsert, and viz commands of reasonry, and
in the validate, rebuild_graph, and upsert_document tools of the Keeper server. The Reader
server never loads a hook, so a consumer's agent doesn't run the module.
An error from a validate hook fails the check and stops the graph build until you fix the
document. The Keeper server loads an edited module again without a restart. If the module imports
helper files of its own, restart the server after you edit a helper.
Attach data to a document
A document names the files and links that a hook checks in its attachments field:
attachments:
- ../attachments/measurements.json
- { url: https://example.com/records/442, key: record-442, name: Record 442 }
A path is relative to the document, and the file must stay inside the initiative's folder. A URL
entry needs a key. The engine parses a local JSON file of up to 1 MB and gives the hook its
content. Every other file and every URL is a link only: the engine never opens a URL. A JSON file
of more than 1 MB is an error, unless its entry sets load: lazy, such as
- { path: ../attachments/export.json, load: lazy }. The engine then treats the file as a link.
The hook reads the attachments from the attachments field of the context object, under the
filename or the entry's key. For the preceding example, the field holds the following records.
The data field is the content of the measurements.json file:
"attachments": {
"measurements.json": {
"kind": "file",
"path": "source/initiatives/team-tooling/attachments/measurements.json",
"media_type": "application/json",
"bytes": 47,
"load": "eager",
"data": {
"pull_requests": 40,
"median_wait_hours": 26
}
},
"record-442": {
"kind": "url",
"url": "https://example.com/records/442",
"name": "Record 442",
"media_type": "application/octet-stream",
"load": "lazy"
}
}
Keep customizations through an engine upgrade
Your values stay in your files, and an engine release doesn't change them. If a major version
changes the shape of the configuration, reasonry migrate converts your file and asks about
anything that it can't convert: see
The reasonry command.
A change to the preset in a later release doesn't reach a workspace that exists. To get the
preset's later values, compare your files with a copy of the preset: run
npx -y @push-based/reasonry@2 init in an empty folder.