/knowledge-mcp:kb-write-documentfrom knowledge-mcp
Use before you write, revise, move or rename any non-code file, or review a proposed change to one, wherever it lives: a knowledge base, a codebase's docs and records, or a local or remote drive, locally or through a connector. Covers "review this change", "check this before I save", "is this right", "what changed" and "undo that".
Ships in knowledge-mcp. 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.
To propose changes to a document, follow Proposals.
Read knowledge-base files with your own tools.
Establish the root and the requested folder. Discover .knowledge-bus/ folders along every relevant ancestor path.
Read .knowledge-bus/plugins/knowledge-mcp/conventions.yaml under each supplied configuration folder.
Record explicit absence for missing files. An existing empty file is invalid.
Get the document type. Call kb_get_document_type with:
location: the file's path or URL, as text.name: the filename, including its extension.folders: the folder names on the path from the root folder to the file.knowledge_bus_folders: every folder containing .knowledge-bus/, including folders holding peer documents. Set folder to its root-relative path. In files, list each *.kbp.yaml file directly inside .knowledge-bus/ by name. Include id and version from the universe: or guidance: block. First try the actual file SHA-256 as digest: "sha256:…"; if unknown, send exact full text. When .knowledge-bus/workspace.yaml exists, send its text as workspace_yaml on every call.role: the reader's role, such as maintainer or product lead, when you can tell.listing: every current document and attachment path relative to the root.record: the current document-types file text. Follow kb-track-document-types for reading and migration.conventions_files: each relevant configuration folder and its complete conventions text; send empty text for an absent file.
Use folder: "" for the root. Reuse digest from received while the file remains unchanged.Send the document-types file text once per session. On later calls, reuse the digest from received while the text is unchanged. Send a *.kbp.yaml digest as digest and the document-types digest as record_digest.
Use the saved entry. Read recorded.entry when the answer includes recorded. Use any saved document_type, no_document_type and audience values. Tell the person the entry comes from the document-types file.
Choose a candidate. Otherwise choose from candidates:
actor with the reader's role yourself, since role_matches compares words only.every_document_type with the file's outline and the conversation.Handle files without a document type. If no_document_type is true or no document type describes the file, tell the person "no document type". Ask before writing. After approval, skip the card steps, write the document and follow the Edits section.
Read naming values. Read the convention for the chosen document type.
Read each named property and any requested content value from the document.
Send those values in filing_values with path, universe_spec and document_type, then repeat the lookup.
Ask the person for unknown values. Never invent dates, properties or numbering.
Review filing. Show the assessment for the chosen document type and confirm the path before writing. Follow Names, folders and moves for an accepted move.
Read the card. Call kbp_card with format: "json" and kind set to the document type and the same location and folders, with ancestor knowledge_bus_folders. Set universe to the universe_spec of the chosen candidate or saved entry. Read the JSON in stdout. Cite its kind and sections[].element IDs; never derive IDs from headings. Quote the card instead of restating its rules in your own words.
The card has no source filenames or digests. Use the response note's received name/digest pairs or bundled filenames and source declaration.
Forward reader results as typed values into tool arguments; retain the complete card and provenance when passing context.
Guess the conditions. Read conditions and presentation[].conditions, including predicates in disabled_when, no_artifact, section when/gate and guidance when. State the expected value with "(guess)" and a reason. Keep the condition open until the person confirms or corrects the value. Write a conditional section only after the person confirms the values for that section. Show which sections depend on each open condition.
Check whether a document is needed. Read the card's no_artifact predicate. Compare your guesses with its conditions. An empty predicate means "in every situation". If the predicate applies, say "no document needed (guess)" and name any assumed values. Ask whether to write the document anyway.
Choose the reader. Call kb_list_audiences with document_type and the same location and folders, with ancestor knowledge_bus_folders. Set universe_spec to the chosen universe spec id. When you can't tell the reader, ask the person and offer only the answer's choices. When choices is empty, write for the answer's actor and offer no choices of your own.
Write. Write the card's sections in order, follow the card's instructions, and use the confirmed values.
Propose before editing. Follow Proposals.
For card and reader calls, include only configuration folders from the root down to the subject folder. Keep the complete peer-folder inventory for document-type lookup, tracking and move preparation.
Don't stop to ask about the document type or reader first.
kb_prepare_proposal with one row per change, its sources and evidence mark, and each file you read but didn't cite. Send plain words, without markdown syntax, in text. Send layout: "list" when you run in a terminal.card from the result in your reply unchanged, unless your app already draws it as a card, then add your own lines. Mark a guessed document type or reader with "(guess)" and ask about it there. Name each change by its ID, such as C2, never by its position.said source.Call kb_list_conventions when the person asks which conventions apply in a folder.
Send the root, requested folder, current knowledge_bus_folders and explicit conventions_files.
Show each convention, its declaring folder, parent mark and inactive reason.
Resolve broken parent selections before proposing moves.
A selected convention keeps its declaring folder as the filing base.
For example, a company convention using Contracts still files under the company folder when Finance selects the convention.
To file documents under Finance/Contracts, save a reviewed local convention in
Finance/.knowledge-bus/plugins/knowledge-mcp/conventions.yaml with Contracts as its folder.
kbp_kinds.
Identify note document types and explicitly list excluded codebase records.
Keep universe spec changes with the knowledge-bus skills.kb_list_convention_templates for the bundled definitions and sources.
Ask which pattern to use when the person has not chosen a pattern.
Map every note document type by its declared purpose and relevant note content.
Read kbp_card when a purpose remains unclear. Filename keywords alone cannot decide the assignment.
Keep unfamiliar types and unresolved mappings visible with a specific question.date property with the actual recorded property before acceptance.
Never derive dates from the current date or filesystem timestamps.knowledge-mcp/conventions/1 text in memory and call kb_get_document_type with supplied naming values for previews.
Mark new folders from the inventory and check existing empty folders with your own tools.
Proposed note folders wait for accepted moves.set_by: agent for template suggestions and set_by: person for conventions the person states.
Keep attribution separate from permission.kb_prepare_conventions with location set to the root, current conventions text, proposed changes and allowed_by.
Set folder to the selected folder and supply ancestor conventions_files, excluding the target file.
Include applicable definitions in knowledge_bus_folders with actual file SHA-256 digests; if unknown, send exact full text.
Send from_parent to replace the complete parent selection; omission preserves the current selection.
Preview every resulting convention before creating a team boundary or changing parent selections.
Keep template proposals local to the selected folder. Choose parent selections explicitly.based_on.
After a concurrent change, prepare again from fresh text and preserve unrelated conventions.record and record the edit through kb_record_edit.
Keep valid conventions YAML with conventions: [] after removing the last local convention.
Preserve accepted from_parent selections and the saved boundary.
Reread saved text and repeat preparation after saving.
Existing files keep their names and folders until the person accepts a proposal.Read filing for the chosen document type. Show the proposed name, folder and supporting files. When a convention applies, show the convention and its source file.
Mark a new folder explicitly.
Keep proposals for candidate types conditional until the person chooses a document type.
Keep writing at the existing path when the person declines a proposal.
A content edit authorizes a move only when the permission also covers the move.
kb_prepare_document_move with location: the knowledge-base root, as text.
Keep the same root across both move calls.
Send the complete listing, the moved document in documents, and the current record or record_digest.
Include old_path, accepted path, case_mode, peer and destination knowledge_bus_folders, and allowed_by.texts_needed, search every Markdown file in the vault for every returned search string.
Search encoded paths too; the returned percent marker includes files containing any URL escape.
Use fixed strings and case-insensitive comparison, including Markdown files in hidden folders outside configuration and implementation directories.
Read the full text of every matching file. Include the moved document even when the search finds no match.
Call the tool again with those documents, searched: true, and search echoed exactly as returned.
Repeat the search when the strings change. A search failure stops the move.bindings with the source path, complete token range and target path. Offsets count Unicode code points.
Case-dependent links and hand-written alias links also require established targets. Keep existing broken links unresolved.based_on.
Compare a fresh inventory with the supplied listing, including fingerprints.
Reprepare from fresh inputs and repeat the search after any concurrent change. Keep unrelated changes from other sessions.kb_record_edit, using the permission covering the operation.
Report completion after verification.kb_record_edit with location, allowed_by, before and after.
Quote the person's words in allowed_by.text and select allowed_by.basis.
For instruction, put the instruction file's path in allowed_by.location.
Show card from the result in your reply unchanged, unless your app already draws it as a card, then add your own lines.kb_list_edits with its location. Show card from the result in your reply unchanged, then write "Still open:" and what the document leaves open.kb_list_edits with location.
Restore before only where the document still contains after.
If the edit record omits after, restore the whole file from before only when the current file's digest equals after_digest.kb-track-document-types.During this work, commit nothing, push nothing, open no issue or pull request, and post no comment.
kb_prepare_document_types with filing_review.folder and a complete vault listing.
Review direct children by default; set recursive: true when the person includes subfolders.
Resolve document types and read naming values from the original documents.
Keep unknown types and missing values visible with specific questions.kb_prepare_document_moves, with every moved document and current configuration.
Never prepare an accepted list by looping over kb_prepare_document_move.
Search every Markdown document using the exact returned strings, including files outside the reviewed folder.
Follow the fixed-string, case-insensitive search and binding rules in Names, folders and moves.
Include full matching text and every moved document; echo search exactly with searched: true.
A failed search stops preparation. Changed inputs require a fresh search.allowed_by.
A changed destination or newly affected document requires a revised preview and renewed acceptance.
Reuse permission when fresh preparation has identical approved effects.
Explain row or byte limits before acceptance and ask for a smaller explicit review.
Never divide an accepted list into independently prepared groups.kb_record_edit, including unchanged-text renames and the document-types file.
Use the root as location, whole_file: true, original before and final after or after_digest.
Supply operation with an opaque id, original old_path, final path, and positive index and count.
Give all records the same operation id and total count; assign each index once.
Stationary referring documents use equal original and final paths.kb_list_edits(location=root).
Verify the complete count, unique indices, final paths and after digests, including the document-types file.
Block automatic undo and list conflicts after later changes or an incomplete group.
Present the complete inverse list and restoration effects, then obtain permission.
Prepare inverse moves together through kb_prepare_document_moves.
Restore recorded original text through the same staging and digest guards.
Restore document-types text only while its recorded after digest matches current text.
Verify restored targets and record the undo edits.What SKILL.md sets; muted values are Claude Code's defaults
9 skills in this plugin
/kb-checkValidate Knowledge Bus definitions and guidance after edits, and explain each failure and its fix./kb-evolveAdd or re-examine document types and the definitions around them — frames, factors, guidance, overview, terms — in a Knowledge Bus universe spec, grounding changes in evidence./kb-exploreInspect or explain a Knowledge Bus universe (a spec or set of definitions): what it covers and for whom; optionally create or open its offline Explorer.Other plugins' skills for the same job
/kb-import-documentUse when the person brings in notes, a transcript or a document written elsewhere, to work it into their non-code files or import it as a new document.npx claudepluginhub sterlingjf/knowledge-mcp --plugin knowledge-mcp