IWE (iwe.md)

v0.37.0
io.github.iwe-org/iwe Checked 12 hours ago Published 18 hours ago

Markdown knowledge base as agent memory.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

iwe_attach

Attach a document as a block reference in one or more target documents determined by configured attach actions. Each target key is derived from the action's key_template (e.g. daily/{{today}}). The `to` field accepts a list of action names; the source is attached under each resolved target. Targets that already contain the source are silently skipped. Use list mode to discover available attach actions.

ParameterTypeDescription
dry_runboolean | nullPreview changes without applying. Default: false
keystring | nullDocument key to attach as a block reference in the target(s)
listboolean | nullList available attach actions instead of executing. Default: false
toarrayConfigured attach action(s) to attach to (e.g. 'today'). Pass one or more action names; the source is attached under each resolved target.

iwe_create

Create a document at an explicit `key` from the complete markdown in `content` — frontmatter block first (when there is one), then the title heading and the body. The content is written verbatim; the server adds nothing and moves nothing. Derive the key from stable metadata (entity name, session date), not the title wording. Pass if_exists: "skip" to make retries idempotent. Stats warnings (dangling links, orphans, similar pages) may ride the result; resolve them before ending the session.

ParameterTypeDescription
content *stringThe complete document, written verbatim: the YAML frontmatter block first (when there is one), then the markdown, normally starting with a `# Title` heading. Nothing is added or moved.
key *stringDocument key — the created document's stable identity. Derive it from stable metadata (entity name, session date), not the title wording. Subdirectory keys allowed (e.g. people/ada); do not include…
if_existsBehavior when the key already exists: "fail" (default) reports an error, "skip" leaves the existing document untouched and returns created: false, which makes retries idempotent.

iwe_delete

Delete a document from the knowledge graph. All block references and inline links to this document in other documents are cleaned up. Stats warnings (dangling links, orphans, similar pages) may ride the result; resolve them before ending the session.

ParameterTypeDescription
key *stringDocument key to delete
dry_runboolean | nullPreview changes without applying. Default: false

iwe_extract

Extract a section from a document into a new standalone document. The original section is replaced with a block reference. Use list mode to discover sections first

ParameterTypeDescription
key *stringSource document key
blockinteger | nullBlock number to extract (1-indexed, use list mode to discover)
dry_runboolean | nullPreview changes without applying. Default: false
listboolean | nullList all sections with block numbers instead of extracting. Default: false
sectionstring | nullSection title to extract (case-insensitive partial match)

iwe_find

Search and discover documents in the knowledge graph. Supports fuzzy match on title and key (`fuzzy`), full-text match on title and body (`lexical`, fused with `fuzzy` when both are given), direct-reference filters (`refs_to`, `refs_from`), the structural set selector (`in` / `in_any` / `not_in` / `max_depth`) for transitive sub-document AND/OR/NOT queries with configurable depth, result and token caps (`limit`, `max_tokens`, `max_document_tokens`), and projections (`project`, `add_fields`).

ParameterTypeDescription
add_fieldsstring | nullAdditive projection: same grammar as project (bare names are frontmatter fields, `$`-selectors are the document's own), extends defaults rather than replacing. Mutually exclusive with project.
fuzzystring | nullFuzzy match on document title and key
inarrayRestrict to candidates that are sub-documents of EVERY listed key (AND). Each entry is either a bare KEY or {key, depth}.
in_anyarrayRestrict to candidates that are sub-documents of AT LEAST ONE listed key (OR).
lexicalstring | nullLexical (BM25) full-text match on title and body
limitinteger | nullMaximum number of results to return. Unlimited if omitted (0 also = unlimited).
max_depthinteger | nullDefault depth for in / in_any / not_in entries that don't specify their own depth. Omit for unbounded.
max_document_tokensinteger | nullCap projected `$content` tokens per result. Unlimited if omitted (0 also = unlimited).
max_tokensinteger | nullCap total projected `$content` tokens across all results. Unlimited if omitted (0 also = unlimited).
not_inarrayExclude candidates that are sub-documents of ANY listed key (NOT).
projectstring | nullReplacement projection (e.g. '$title,priority' or 'body=$content,parents=$includedBy'). Bare names are frontmatter fields, and project null when the document has no such field; document fields are `$`…
refs_fromstring | nullOnly return documents referenced by this key
refs_tostring | nullOnly return documents that reference this key

iwe_inline

Replace a block reference with the actual content of the referenced document. Use list mode to discover block references first

ParameterTypeDescription
key *stringDocument key containing the block reference
as_quoteboolean | nullInline as blockquote instead of section. Default: false
blockinteger | nullBlock number to inline (1-indexed, use list mode to discover)
dry_runboolean | nullPreview changes without applying. Default: false
keep_targetboolean | nullKeep the target document after inlining. Default: false
listboolean | nullList all block references instead of inlining. Default: false
referencestring | nullReference key or title to inline (partial match)

iwe_normalize

Normalize all document formatting across the knowledge graph. Re-parses and re-writes all documents to ensure consistent formatting

iwe_query

Run an IWE query/block-selection operation document. `find` and `count` read; `update` mutates frontmatter and blocks (operators $replace, $replaceText, $insertBefore, $insertAfter, $append, $delete); `delete` removes documents. Membership uses the `$content` filter operator; reads project `$content` narrowing, `$blocks`, and `$matches`. Always strict: every mutating application must carry an `expect` guard (document-level `expect` plus one per block operator). Use `find` with `$blocks`/`$matches` to locate targets and learn counts before mutating. Update/delete results may carry stats warning…

ParameterTypeDescription
document *stringThe operation document as YAML. Uses the IWE query + block-selection language: `filter` (with $content block membership), `project`/`addFields` ($content narrowing, $blocks, $matches), `sort` (`field:…
operation *Operation kind: find (read documents), count (count documents), update (mutate frontmatter and/or blocks), or delete (remove documents).
dry_runboolean | nullPreview mutations without writing to disk (update/delete only). Default: false.

iwe_rename

Rename a document key. All block references and inline links across the entire graph are updated to point to the new key

ParameterTypeDescription
new_key *stringNew document key
old_key *stringCurrent document key
dry_runboolean | nullPreview changes without applying. Default: false

iwe_retrieve

Retrieve documents from the knowledge graph. Reads the given `keys` (or search seeds) and expands the graph around them via `expand` (includes / includedBy / references / referencedBy). With `search`/`fuzzy`, seeds are found by relevance within the candidate set (keys + selector); `limit` caps the seeds before expansion and `max_documents` caps the documents returned after expansion.

ParameterTypeDescription
backlinksboolean | nullInclude incoming inline references. Default: true
childrenboolean | nullPopulate the `includes` array with child document edges. Default: false
contextinteger | nullDEPRECATED: use `expand: { includedBy: N }`.
depthinteger | nullDEPRECATED: use `expand: { includes: N }`.
excludearray | nullDocument keys to exclude from results
expandExpansion directions to follow out from each seed: object over includes / includedBy / references / referencedBy → integer depths (0 = unbounded, omitted = not followed). Expansion is doc-only when…
frontmatterboolean | nullInclude each document's frontmatter as a `frontmatter` object, omitted when the document has none. Default: true
fuzzystring | nullSeed search: fuzzy query over title and key. Fuses with `search` (RRF).
inarrayRestrict to candidates that are sub-documents of EVERY listed key (AND). Each entry is either a bare KEY or {key, depth}.
in_anyarrayRestrict to candidates that are sub-documents of AT LEAST ONE listed key (OR).
keysarrayDocument keys to retrieve, or the candidate set searched within when `search`/`fuzzy` is present. Unknown keys are an error unless searching, where they match nothing. Can be empty when a structural s…
limitinteger | nullCap the number of seed documents kept before expansion — top-N by relevance when searching, the first N of the selection otherwise. Unlimited if omitted (0 also = unlimited).
linksboolean | nullDEPRECATED: use `expand: { references: 1 }`.
max_depthinteger | nullDefault depth for in / in_any / not_in entries that don't specify their own depth. Omit for unbounded.
max_document_tokensinteger | nullCap content tokens per document. Unlimited if omitted (0 also = unlimited).
max_documentsinteger | nullCap the number of documents returned after expansion, trimming periphery documents first. Unlimited if omitted (0 also = unlimited).
max_tokensinteger | nullCap total content tokens across all documents. Unlimited if omitted (0 also = unlimited).
not_inarrayExclude candidates that are sub-documents of ANY listed key (NOT).
searchstring | nullSeed search: BM25 full-text query over title and body. Present → the tool searches the candidate set and reads the ordered seeds.

iwe_squash

Expand all block references into a single flat markdown document. Useful for export or generating a complete view of a document tree

ParameterTypeDescription
key *stringRoot document key to expand
depthinteger | nullLevels of references to expand. Default: 2

iwe_stats

Get comprehensive statistics about the knowledge graph including document counts, reference patterns, broken links, and most connected documents

ParameterTypeDescription
keystring | nullDocument key for per-document stats. Omit for aggregate graph statistics

iwe_tree

View the hierarchical tree structure of the knowledge graph showing how documents are connected via block references. Supports the structural set selector (in / in_any / not_in / max_depth) — when provided, the tree roots are restricted to (or selected from) that set.

ParameterTypeDescription
depthinteger | nullMaximum traversal depth. Default: 4
inarrayRestrict to candidates that are sub-documents of EVERY listed key (AND). Each entry is either a bare KEY or {key, depth}.
in_anyarrayRestrict to candidates that are sub-documents of AT LEAST ONE listed key (OR).
keysarray | nullStarting document keys. Unknown keys are an error. If empty and no selector, shows all root documents.
max_depthinteger | nullDefault depth for in / in_any / not_in entries that don't specify their own depth. Omit for unbounded.
not_inarrayExclude candidates that are sub-documents of ANY listed key (NOT).

iwe_update

Update the full markdown content of an existing document. Stats warnings (dangling links, orphans, similar pages) may ride the result; resolve them before ending the session.

ParameterTypeDescription
content *stringNew full markdown content
key *stringDocument key to update