docs(knowledge-pages): document Knowledge Pages and Mental Models, and manage them from the CLI - #3151
Merged
Merged
Conversation
Knowledge Pages shipped in #2455 with no documentation at all — no architecture page, no API page, no mention in the sidebar. Mental models had an API page but nothing explaining what they are or why they are fast. Add both, as top-level entries under Architecture and API. - Architecture: how pages are mental models with a simplified, document-shaped configuration; the folder hierarchy; the `hindsight fs` filesystem projection; page-level search; and why a projected view over reconciled memory is not the same thing as a folder of raw files. - Architecture: mental models as standing answers built in the background, so an application reads the current version instead of paying for synthesis on the request path. - API: the full knowledge-base endpoint surface, the page defaults and what each one buys, staleness gating, what a refresh reads, and how delta mode edits a structured document instead of regenerating prose. The mental-model trigger table gains the seven settings it was missing. - FAQ: mental model vs knowledge page. Also corrects the neighbouring answer, which described mental models as built automatically during retain — that is observations. The API examples use the maintained clients like every other API page, so this adds the knowledge-base surface to the Python and TypeScript wrappers (kept at parity, with request-mapping tests on both sides) and runnable Python/Node/Go examples.
The knowledge base was reachable from every client except the CLI, where
the eight endpoints were listed as deliberate coverage skips ("managed in
the control plane UI"). That left `hindsight fs` able to mirror pages
read-only but nothing able to create, edit, search, or delete them — and
it meant the API docs could not show a CLI tab alongside Python/Node/Go.
Adds `hindsight knowledge-base` with tree, create-folder, create-page,
get-page, search, update, delete, and export, removing the skips so
cli-coverage-check enforces the surface from here on.
`create-page` sends no trigger unless --mode or --fact-types is passed, so
the server's page defaults stand; when either is given the whole trigger
has to be restated, because a supplied trigger replaces the defaults
rather than merging with them.
Also adds the CLI tab to the Knowledge Pages API page and a Knowledge Base
section to the CLI reference.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Knowledge Pages shipped in #2455 with no documentation at all — no architecture page, no API page, not even a sidebar entry. Mental models had an API page but nothing explaining what they are or why an application would reach for one. This adds both, as top-level entries under Architecture and API, and closes the CLI gap the docs exposed.
Docs
Architecture → Mental Models (new) — a standing answer to a question you define, built in the background so the application reads the current version instead of paying for retrieval and synthesis on the request path. Covers the mental model / observation / raw fact ladder that reflect walks, freshness, scope isolation, and provenance. Deliberately conceptual — the flags live in the API page.
Architecture → Knowledge Pages (new) — pages are mental models with the mechanics pre-decided, so nobody has to think about synthesis scope to keep a wiki. Covers the folder hierarchy, the
hindsight fsfilesystem projection, page-level search, and a "why not just raw files?" section: a page is a projected view over memory that has already deduplicated and reconciled contradictions, so an amended decision reads as the current one instead of two paragraphs disagreeing.API → Knowledge Pages (new) — the full endpoint surface with Python / Node.js / CLI / Go examples, the page defaults and what each one buys, staleness gating, what a refresh actually reads, and the storage split.
API → Mental Models — the trigger settings table gained the seven options it was missing (
fact_types,exclude_mental_models,exclude_mental_model_ids,include_chunks,recall_max_tokens,recall_chunks_max_tokens), plus new sections on staleness gating, what a refresh reads, and how delta mode edits a structured document rather than regenerating prose.FAQ — new entry on mental model vs knowledge page. Also corrects the neighbouring answer, which described mental models as "automatically built during retain" — that describes observations.
Clients
The API examples use the maintained clients like every other API page, which meant the knowledge-base surface had to exist in each of them.
Python + TypeScript wrappers, kept at parity:
get_knowledge_base_tree·create_knowledge_folder·create_knowledge_page·get_knowledge_page·search_knowledge_base·update_knowledge_node·delete_knowledge_node·export_knowledge_base.update_knowledge_nodeonly serializes the arguments the caller passed — the server treats an absent field as "leave alone" but an explicit nullparent_idas "move to the root", and passing every field through would make those indistinguishable. Request-mapping regression tests cover this on both sides.Rust CLI —
hindsight knowledge-basewithtree,create-folder,create-page,get-page,search,update,delete,export. All eight endpoints were previously listed as deliberate skips in.openapi-coverage.toml("managed in the control plane UI, not the end-user CLI"); those are removed, socli-coverage-checknow enforces the surface.create-pagesends no trigger unless--modeor--fact-typesis given, so the server's page defaults stand — and when either is given the whole trigger is restated, because a supplied trigger replaces the defaults rather than merging.Runnable Python / Node / CLI / Go examples added under
hindsight-docs/examples/api/, and a Knowledge Base section added to the CLI reference.Verification
cli-coverage-checkpasses: all 84 operations and 108 request params coveredcargo test118 passed; new unit tests for the--fact-types/--modeparsersdocusaurus buildpasses; no broken links or anchors from the new pages (the two reported are pre-existing in a 0.5.5 blog post)./scripts/hooks/lint.shclean;check-unused.shcleanskills/hindsight-docsmirror regenerated, link validation passesNotes, not addressed here
client-coverage-checkreportsreflect.apply_all_directivesmissing from both wrappers — introduced by feat(reflect): add apply_all_directives to bypass directive tag scoping (#3031) #3046 and unrelated to this change. That check is not wired into CI.