beakr-cli 0.2.1__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. beakr_cli-0.3.0/.claude/commands/kb-audit.md +36 -0
  2. beakr_cli-0.3.0/.claude/commands/kb-research.md +29 -0
  3. beakr_cli-0.3.0/.claude/commands/kb-search.md +17 -0
  4. beakr_cli-0.3.0/.claude/commands/kb-write.md +30 -0
  5. {beakr_cli-0.2.1 → beakr_cli-0.3.0}/.claude/skills/beakr/SKILL.md +43 -36
  6. {beakr_cli-0.2.1 → beakr_cli-0.3.0}/.claude/skills/beakr/examples/answer-org-question.md +8 -7
  7. beakr_cli-0.3.0/.claude/skills/beakr/examples/research-topic.md +49 -0
  8. beakr_cli-0.3.0/.claude/skills/beakr/examples/write-decision-page.md +91 -0
  9. beakr_cli-0.3.0/.claude/skills/beakr/reference/auditing.md +54 -0
  10. beakr_cli-0.3.0/.claude/skills/beakr/reference/provenance.md +58 -0
  11. beakr_cli-0.3.0/.claude/skills/beakr/reference/research-workflow.md +48 -0
  12. beakr_cli-0.3.0/.claude/skills/beakr/reference/writing-pages.md +84 -0
  13. {beakr_cli-0.2.1 → beakr_cli-0.3.0}/PKG-INFO +38 -11
  14. {beakr_cli-0.2.1 → beakr_cli-0.3.0}/README.md +34 -8
  15. {beakr_cli-0.2.1 → beakr_cli-0.3.0}/install.sh +10 -1
  16. {beakr_cli-0.2.1 → beakr_cli-0.3.0}/pyproject.toml +3 -2
  17. {beakr_cli-0.2.1 → beakr_cli-0.3.0}/src/beakr_cli/__init__.py +1 -1
  18. {beakr_cli-0.2.1 → beakr_cli-0.3.0}/src/beakr_cli/client.py +16 -2
  19. {beakr_cli-0.2.1 → beakr_cli-0.3.0}/src/beakr_cli/commands/auth.py +10 -7
  20. {beakr_cli-0.2.1 → beakr_cli-0.3.0}/src/beakr_cli/commands/install.py +25 -3
  21. {beakr_cli-0.2.1 → beakr_cli-0.3.0}/src/beakr_cli/commands/workspace.py +5 -2
  22. {beakr_cli-0.2.1 → beakr_cli-0.3.0}/src/beakr_cli/main.py +106 -3
  23. beakr_cli-0.3.0/src/beakr_cli/mcp_server.py +909 -0
  24. beakr_cli-0.3.0/src/beakr_cli/updates.py +305 -0
  25. beakr_cli-0.3.0/tests/test_auth_cli.py +23 -0
  26. beakr_cli-0.3.0/tests/test_bundled_assets_vocabulary.py +87 -0
  27. beakr_cli-0.3.0/tests/test_client.py +45 -0
  28. beakr_cli-0.3.0/tests/test_mcp_shared_vocabulary.py +132 -0
  29. beakr_cli-0.3.0/tests/test_mcp_source_rendering.py +255 -0
  30. beakr_cli-0.3.0/tests/test_packaging.py +42 -0
  31. beakr_cli-0.3.0/tests/test_updates.py +299 -0
  32. {beakr_cli-0.2.1 → beakr_cli-0.3.0}/uv.lock +4 -2
  33. beakr_cli-0.2.1/.claude/commands/kb-audit.md +0 -36
  34. beakr_cli-0.2.1/.claude/commands/kb-research.md +0 -27
  35. beakr_cli-0.2.1/.claude/commands/kb-search.md +0 -17
  36. beakr_cli-0.2.1/.claude/commands/kb-write.md +0 -30
  37. beakr_cli-0.2.1/.claude/skills/beakr/examples/research-topic.md +0 -49
  38. beakr_cli-0.2.1/.claude/skills/beakr/examples/write-decision-page.md +0 -91
  39. beakr_cli-0.2.1/.claude/skills/beakr/reference/auditing.md +0 -46
  40. beakr_cli-0.2.1/.claude/skills/beakr/reference/provenance.md +0 -51
  41. beakr_cli-0.2.1/.claude/skills/beakr/reference/research-workflow.md +0 -45
  42. beakr_cli-0.2.1/.claude/skills/beakr/reference/writing-pages.md +0 -103
  43. beakr_cli-0.2.1/src/beakr_cli/mcp_server.py +0 -1121
  44. beakr_cli-0.2.1/tests/test_mcp_resolver.py +0 -116
  45. {beakr_cli-0.2.1 → beakr_cli-0.3.0}/.github/workflows/publish.yml +0 -0
  46. {beakr_cli-0.2.1 → beakr_cli-0.3.0}/.gitignore +0 -0
  47. {beakr_cli-0.2.1 → beakr_cli-0.3.0}/LICENSE +0 -0
  48. {beakr_cli-0.2.1 → beakr_cli-0.3.0}/src/beakr_cli/citations.py +0 -0
  49. {beakr_cli-0.2.1 → beakr_cli-0.3.0}/src/beakr_cli/commands/__init__.py +0 -0
  50. {beakr_cli-0.2.1 → beakr_cli-0.3.0}/src/beakr_cli/commands/kb.py +0 -0
  51. {beakr_cli-0.2.1 → beakr_cli-0.3.0}/src/beakr_cli/config.py +0 -0
  52. {beakr_cli-0.2.1 → beakr_cli-0.3.0}/src/beakr_cli/output.py +0 -0
  53. {beakr_cli-0.2.1 → beakr_cli-0.3.0}/tests/__init__.py +0 -0
  54. {beakr_cli-0.2.1 → beakr_cli-0.3.0}/tests/test_citations.py +0 -0
@@ -0,0 +1,36 @@
1
+ Audit the Beakr knowledge base for quality issues: $ARGUMENTS
2
+
3
+ If no specific focus is given, run a general health check. Pass a project's name or ID as `scope` when the user named one. Follow this procedure:
4
+
5
+ 1. **Get the full picture.** Call `wiki_stats` for counts and `knowledge_base` command `ls` (raise `limit` in `arguments` for a full list). Use command `ontology` to see which page types are in use.
6
+
7
+ 2. **Run diagnostics.** Call `knowledge_base` command `diagnostics`. It reports broken links, orphan pages, and disputes.
8
+
9
+ 3. **Check the graph.** Call `wiki_graph` for the most-connected pages. Look for:
10
+ - **Orphan pages** -- pages with no parent and no incoming links
11
+ - **Dead ends** -- pages with no outgoing links (isolated knowledge)
12
+ - **Missing index pages** -- overview pages that should tie a section together
13
+
14
+ 4. **Spot structural issues.** From `ls` results, look for:
15
+ - Duplicate or near-duplicate page titles
16
+ - Deeply nested hierarchies (more than 3 levels is usually too deep)
17
+ - Pages without a parent (command `suggest_parent` with `{"page": ...}` finds a home)
18
+ - Pages that look like stubs
19
+
20
+ 5. **Sample content quality.** Read 5-10 pages with command `cat` (start with `{"page": ..., "outline": true}`), prioritizing:
21
+ - Heavily edited pages (command `log`) -- is content coherent?
22
+ - Recently created pages (sort `ls` by `created_at`) -- stubs or unreviewed?
23
+ - Overview/index pages -- are they up to date with their children?
24
+
25
+ 6. **Check provenance.** For key pages, call command `provenance` and look for:
26
+ - Sections with no citations (unsourced claims)
27
+ - Sections with `contradicts` citations (disputed content)
28
+ - Excerpts marked (paraphrase) or (unverified), or sources that changed since cited
29
+
30
+ 7. **Report findings** organized as:
31
+ - **Critical** -- broken links, orphaned important pages, contradicted content
32
+ - **Moderate** -- missing sections, stale pages, structural issues
33
+ - **Minor** -- style inconsistencies, missing Related Pages sections
34
+ - **Recommendations** -- specific pages to create, merge, or reorganize
35
+
36
+ Offer to stage fixes with `knowledge_base_write` (actions `edit_section`, `merge` for duplicates, `mv`, `new`) if the user approves. Never call `accept_proposal` unless the user explicitly asks.
@@ -0,0 +1,29 @@
1
+ Research the following topic using the Beakr knowledge base and provide a thorough analysis: $ARGUMENTS
2
+
3
+ Follow this procedure:
4
+
5
+ 1. **Discover the landscape.** Call `list_projects` to understand the available projects. Use `wiki_stats` for the whole accessible knowledge base, and with `project` when a project is clearly relevant.
6
+
7
+ 2. **Ask the researcher.** Call `research` with the topic as `query`. It searches the wiki, documents, and connected services and returns a cited answer. Use it as a starting map.
8
+
9
+ 3. **Broad search.** Run `knowledge_base` command `sections` with `{"query": ...}` using 2-3 phrasings in parallel. Use command `grep` with `{"query": ...}` for exact names or IDs. If a literal grep misses, retry with `sections` before concluding the topic is not covered.
10
+
11
+ 4. **Deep read.** Read the top 5-10 most relevant hits with command `cat`, using `{"page": ..., "section_id": ...}` when a hit points at a section and `{"page": ..., "outline": true}` to see a page's structure. Read in parallel. Pay attention to:
12
+ - Section content and structure
13
+ - `[[links]]`, Children, and "Linked from" to follow
14
+ - Page type (decision pages have different weight than research_notes)
15
+
16
+ 5. **Trace provenance.** For key claims, use command `provenance` with `{"page": ...}` to see which sources support, contradict, or qualify each section. Use command `sources` to see what raw documents fed each page.
17
+
18
+ 6. **Follow the graph.** Use command `links` or `references` with `{"page": ...}` on central pages to discover related pages you may have missed. Use command `timeline` with `{"timeline_query": ...}` to see how events unfolded, and `log` only when the question is about change over time.
19
+
20
+ 7. **Check for conflicts.** Look for citations with stance `contradicts` or `qualifies`. These are the most valuable findings -- they show where the evidence disagrees.
21
+
22
+ 8. **Synthesize.** Write up findings organized by theme, not by page. Include:
23
+ - Key findings with page citations (title)
24
+ - Areas of agreement across sources
25
+ - Contradictions or open questions
26
+ - Gaps -- what the knowledge base does NOT cover that it should
27
+ - Temporal context -- when information was written, whether it may be stale
28
+
29
+ 9. **Recommend.** If the research reveals gaps or stale pages, suggest specific knowledge base updates. Offer to propose pages or edits if appropriate.
@@ -0,0 +1,17 @@
1
+ Search the Beakr knowledge base for information about: $ARGUMENTS
2
+
3
+ Follow this procedure:
4
+
5
+ 1. **Discover scope.** If the user mentioned a specific project, call `list_projects` and pass that project's name or ID as `scope`. Otherwise search everything the user can see (omit `scope`).
6
+
7
+ 2. **Search broadly.** Run `knowledge_base` with command `sections` and `arguments: {"query": ...}`; it is semantic, so try one or two phrasings in parallel. For exact names, IDs, or phrases, also run command `grep` with `{"query": ...}`.
8
+
9
+ 3. **Read the top hits.** For the most relevant results (up to 3-5), call `knowledge_base` command `cat` with `{"page": ..., "section_id": ...}` from the hit. Read the whole page only when you need material outside that section. Do these reads in parallel.
10
+
11
+ 4. **Follow links.** If the pages contain `[[links]]` to other relevant pages, read those too. Use command `links` with `{"page": ...}` to find pages that reference a key page.
12
+
13
+ 5. **Check provenance if needed.** If the user needs to know where information came from, use command `sources` or `provenance` with `{"page": ...}`.
14
+
15
+ 6. **Synthesize and cite.** Present findings with page titles so the user can navigate to them. Quote specific sections when relevant. Note any contradictions found in provenance (stance: contradicts/qualifies) and any excerpt marked (paraphrase) or (unverified).
16
+
17
+ Do NOT just return search results -- read the actual pages and answer the question.
@@ -0,0 +1,30 @@
1
+ Create or update a knowledge base page about: $ARGUMENTS
2
+
3
+ Follow this procedure:
4
+
5
+ 1. **Check for duplicates.** Search with `knowledge_base` command `sections` and `{"query": ...}` across all accessible projects (also `grep` for exact names). If a page already exists on this topic, read it with command `cat` and update it rather than creating a new one.
6
+
7
+ 2. **Pick the project.** Call `list_projects` and pass the target project's name or ID as `scope` on every call below. The personal project is listed with type `personal`. Never guess a scope.
8
+
9
+ 3. **Find the right parent.** For a new page, call command `suggest_parent` with `{"title": ..., "content": <your draft>}`, or walk the hierarchy with command `ls` and `{"parent": ...}`. If unsure, ask the user.
10
+
11
+ 4. **Choose the page type.** Run command `ontology` for the active types. Common ones: `topic` (most common), `person`, `organization`, `decision`, `meeting`, `overview` (index/section pages), `research_note` (ephemeral analysis).
12
+
13
+ 5. **Write the content** following these conventions:
14
+ - The page is `sections`: an ordered list of `{"title": ..., "body": ...}` objects. Beakr writes the `<!-- sec:ID -->` markers and IDs; do not author markers or pass `content`.
15
+ - Put an inline citation token `{{key}}` immediately after every factual claim, table value, date, title, and relationship.
16
+ - Give each token a record in that section's `citations`: `{"key": ..., "source_ref": ..., "stance": ...}` using the `source_ref` from a `knowledge_base` read for sources Beakr already has. For this conversation or a note, use a stable key with `source_type` `conversation`, `agent_note`, or `user_note`, plus `source_title` and `meta.excerpt`.
17
+ - Set `stance` to `support`, `qualifies`, or `contradicts`.
18
+ - Add `event_start`, `event_end`, and `date_precision` (day, month, quarter, year, approx) to dated decisions, meetings, milestones, launches, incidents, and other timeline-worthy sections.
19
+ - Use `[[Page Title]]` for cross-references (check targets exist) and `[[Display Text|Page Title]]` when the text differs.
20
+ - Include a "Related Pages" section at the bottom.
21
+ - Write for a reader with no prior context: name WHO made decisions, WHEN things happened, WHY.
22
+ - Use tables for structured data and code blocks for config/commands.
23
+
24
+ 6. **Stage the proposal** with `knowledge_base_write`:
25
+ - New page: action `new` with `title`, `page_type`, `summary` (one line on what the page is about), `parent`, `sections`, and `rationale`.
26
+ - Existing page: action `edit_section` with `page`, `section_id`, `new_section_body`, `citations`, `edit_note`, and `rationale`. Read the page first; the new body replaces the whole section.
27
+
28
+ 7. **Review.** Show the result with `show_proposal`. Call `accept_proposal` only when the user explicitly asks to apply it.
29
+
30
+ Do NOT create stub pages. Every page should have substantive content.
@@ -24,7 +24,7 @@ You are not just a read interface. When the conversation produces something dura
24
24
  **Capture when all of:**
25
25
  - **Durable**: would still matter in 6 months
26
26
  - **Shareable**: others would benefit, not just this user right now
27
- - **Not already in Beakr**: check with `kb_search` first
27
+ - **Not already in Beakr**: check with `knowledge_base` command `sections` first
28
28
  - **In scope**: the user can write to it (their personal project, or a team project they belong to — confirm with `list_projects`)
29
29
 
30
30
  **Good candidates:**
@@ -45,36 +45,50 @@ You are not just a read interface. When the conversation produces something dura
45
45
  - **Surface the suggestion before writing**: "This decision about X seems worth capturing — want me to propose it for your wiki?"
46
46
  - Never auto-write. Always propose, always wait for explicit OK.
47
47
  - One capture offer per significant thread — don't pepper the user.
48
- - Cite the current session as `conversation:<short-id>` with `meta.excerpt` so the source is traceable.
48
+ - Cite the current session as a `conversation` source with `meta.excerpt` so it is traceable.
49
49
 
50
- ## Core tools
50
+ ## Tools
51
51
 
52
52
  | Tool | When to use |
53
53
  |------|-------------|
54
- | `research` | First choice for broad questions. Searches knowledge base, docs, Slack, Gmail, Calendar, Jira in one call. Returns cited answers. |
55
- | `kb_search` | Find specific pages by semantic or keyword search. |
56
- | `kb_cat` | Read a page's full content by slug, title, or UUID. |
57
- | `kb_ls` | Browse pages. Filter by type, parent, or scope. |
58
- | `kb_timeline` | Find decisions, meetings, and events by date range. |
59
- | `kb_graph` | Understand how pages connect. Shows top linked pages. |
54
+ | `research` | First choice for broad questions. Searches the knowledge base, documents, and connected services (Slack, Gmail, Calendar, Jira...) in one call. Returns a cited answer. |
55
+ | `knowledge_base` | Every read over the wiki, chosen by `command`: `sections`, `grep`, `ls`, `cat`, `hover`, `links`, `references`, `timeline`, `provenance`, `blame`, `sources`, `log`, `diff`, `show`, `ontology`, `suggest_parent`, `diagnostics`, `completions`, `proposals`. |
56
+ | `knowledge_base_write` | Every change, chosen by `action`: `edit_section`, `new`, `edit`, `find_replace`, `mv`, `archive`, `merge`, `copy`, `page_type`. Always stages a proposal. |
57
+ | `show_proposal` / `accept_proposal` / `dismiss_proposal` | Review a staged proposal; accept only when the user explicitly asks. |
58
+ | `list_projects` | Discover projects (including the personal one) to use as `scope`. |
59
+ | `get_profile`, `wiki_stats`, `wiki_graph` | Org/project profile, counts, and the most-connected pages. |
60
+ | `beakr_version` / `update_beakr` | Check for a newer Beakr release; update only when the user asks. |
61
+
62
+ Both `knowledge_base` tools take a `command`/`action`, a flat `arguments` object, and an optional `scope`:
63
+
64
+ ```
65
+ knowledge_base(command="sections", arguments={"query": "who owns billing"})
66
+ knowledge_base(command="cat", arguments={"page": "Billing", "section_id": "sec_owner"})
67
+ knowledge_base_write(action="edit_section", scope="Team Wiki", arguments={...})
68
+ ```
69
+
70
+ There is no `search` command. Use `sections` (semantic, start here) or `grep` (literal text).
60
71
 
61
72
  ## Quick decision tree
62
73
 
63
74
  ```
64
75
  User asks a question about their org
65
- → Use `research` (it searches everything)
76
+ → research(query=...)
77
+
78
+ User asks about a specific fact, decision, or page
79
+ → knowledge_base sections {query}, then cat {page, section_id} on the best hit
66
80
 
67
- User asks about a specific page
68
- → Use `kb_cat` with the page title/slug
81
+ User wants an exact name, ID, or phrase
82
+ → knowledge_base grep {query}
69
83
 
70
- User wants to browse or list pages
71
- → Use `kb_ls` (optionally with --type, --roots, --parent)
84
+ User wants to browse pages
85
+ → knowledge_base ls {parent?, page_type?, sort_by?}
72
86
 
73
- User wants to know what happened on a date
74
- → Use `kb_timeline` with date range
87
+ User wants to know what happened when
88
+ → knowledge_base timeline {timeline_query?, start_date?, end_date?}
75
89
 
76
90
  User wants to verify sources for a claim
77
- → Use `kb_provenance` or `kb_blame` on the relevant page
91
+ → knowledge_base provenance {page} or blame {page}
78
92
 
79
93
  User wants to create/update a page
80
94
  → See [reference/writing-pages.md](reference/writing-pages.md)
@@ -85,33 +99,26 @@ User wants to audit knowledge base quality
85
99
 
86
100
  ## Scoping
87
101
 
88
- All tools accept an optional `project` parameter:
89
- - Omit it to search across the entire organization
90
- - Pass a project ID to scope results (use `list_projects` to discover IDs)
91
- - Pass `personal_only=true` to limit to the user's personal project
102
+ - `knowledge_base` and `knowledge_base_write` take `scope`: a project name or ID. Omit it on reads to search everything the user can see.
103
+ - `research`, `wiki_stats`, and `wiki_graph` take `project` (a project ID).
104
+ - The personal project is a project like any other: `list_projects` reports it with type `personal`. Pass its name or ID as the scope.
92
105
 
93
106
  ## Citing sources
94
107
 
95
108
  Always cite sources when presenting information from the knowledge base:
96
109
  - Include the page title so the user can find it
97
- - For `research` results, the response includes numbered citations -- present them
98
- - For claims that need verification, use `kb_provenance` to show supporting/contradicting sources
99
- - When writing wiki pages, put inline citation tokens like `{{rag:abc123}}` or
100
- `{{!rag:abc123}}` immediately after every factual claim, table row/value,
101
- date, title, and relationship. Also include the same keys in
102
- `sections[].citations` with `support`, `qualifies`, or `contradicts` stance.
103
- Add `event_start`, `event_end`, and `date_precision` for dated decisions,
104
- meetings, milestones, and other timeline-worthy sections. For current-session
105
- or other not-yet-indexed sources, cite a stable key with `source_type`
106
- `conversation`, `agent_note`, or `user_note`, plus `source_title` and
107
- `meta.excerpt`, `meta.content`, or `meta.text`.
110
+ - For `research` results, the response includes numbered citations with their `{{token}}` keys -- present them
111
+ - An excerpt marked `(paraphrase)`, `(human asserted)`, or `(unverified)` is not a checked quote; open the source before relying on it
112
+ - For claims that need verification, use `provenance` to show supporting/contradicting sources
113
+ - When writing pages, see [reference/writing-pages.md](reference/writing-pages.md) for inline tokens and citation records
108
114
 
109
115
  ## Page references
110
116
 
111
- Pages can be referenced by any of:
112
- - UUID (exact match)
113
- - Slug (exact match, e.g., `api-design`)
114
- - Title (search, e.g., `"API Design"`)
117
+ `page` accepts any of:
118
+ - Title (e.g., `"API Design"`)
119
+ - Slug (e.g., `api-design`)
120
+ - UUID
121
+ - Wiki citation key from a read (e.g., `wiki:8f3a0c21`)
115
122
 
116
123
  ## Advanced workflows
117
124
 
@@ -6,25 +6,26 @@
6
6
  ## Workflow
7
7
 
8
8
  ### Step 1: Research
9
- Call `research` with query "who owns the onboarding flow":
9
+ Call `research` with the question:
10
10
 
11
11
  ```
12
12
  research(query="who owns the onboarding flow")
13
13
  ```
14
14
 
15
- The response returns a cited answer mentioning Sarah Chen [1] and links to the relevant page.
15
+ The response returns a cited answer mentioning Sarah Chen [1] and the pages it drew on.
16
16
 
17
17
  ### Step 2: Verify if needed
18
- If the user wants more detail, read the specific page:
18
+ If the user wants more detail, find the exact section and read just that:
19
19
 
20
20
  ```
21
- kb_cat("onboarding-architecture")
21
+ knowledge_base(command="sections", arguments={"query": "onboarding flow owner"})
22
+ knowledge_base(command="cat", arguments={"page": "Onboarding Architecture", "section_id": "sec_ownership"})
22
23
  ```
23
24
 
24
25
  ### Step 3: Present
25
- "Based on the knowledge base, Sarah Chen owns the onboarding flow [onboarding-architecture]. She took ownership in Q1 2026 as part of the platform team reorganization [team-structure]."
26
+ "Based on the knowledge base, Sarah Chen owns the onboarding flow (Onboarding Architecture). She took ownership in Q1 2026 as part of the platform team reorganization (Team Structure)."
26
27
 
27
28
  ## Key points
28
29
  - Start with `research` -- it searches everything in one call
29
- - Always cite the page title/slug
30
- - If the answer involves people, check for a `person` page with `kb_cat`
30
+ - Always cite the page title
31
+ - If the answer involves people, check for a `person` page with `sections {query, page_type: "person"}`
@@ -0,0 +1,49 @@
1
+ # Example: Deep research on API redesign
2
+
3
+ ## User prompt
4
+ "Research everything we know about the API redesign and summarize the current state"
5
+
6
+ ## Workflow
7
+
8
+ ### Step 1: Broad search (in parallel)
9
+ ```
10
+ knowledge_base(command="sections", arguments={"query": "API redesign"})
11
+ knowledge_base(command="sections", arguments={"query": "API architecture changes"})
12
+ knowledge_base(command="grep", arguments={"query": "v2 migration"})
13
+ ```
14
+
15
+ ### Step 2: Read top hits (in parallel, narrowest read first)
16
+ ```
17
+ knowledge_base(command="cat", arguments={"page": "API Redesign Decision"})
18
+ knowledge_base(command="cat", arguments={"page": "API Architecture", "section_id": "sec_current_state"})
19
+ knowledge_base(command="cat", arguments={"page": "V2 Migration Plan", "outline": true})
20
+ ```
21
+
22
+ ### Step 3: Check timeline
23
+ ```
24
+ knowledge_base(command="timeline", arguments={"timeline_query": "API redesign", "start_date": "2026-01-01"})
25
+ ```
26
+
27
+ ### Step 4: Trace provenance on key claims
28
+ ```
29
+ knowledge_base(command="provenance", arguments={"page": "API Redesign Decision"})
30
+ ```
31
+
32
+ ### Step 5: Follow links
33
+ ```
34
+ knowledge_base(command="links", arguments={"page": "API Architecture"})
35
+ ```
36
+
37
+ ### Step 6: Synthesize
38
+ Present findings by theme:
39
+ - **Decision**: The team decided to migrate to v2 in January 2026 (API Redesign Decision)
40
+ - **Current state**: Migration is 60% complete per the March update (V2 Migration Plan)
41
+ - **Open questions**: Authentication approach still under discussion -- two proposals exist with contradicting provenance (API Architecture)
42
+ - **Gap**: No page covers the data migration strategy
43
+
44
+ ## Key points
45
+ - Use multiple phrasings to cast a wide net; `sections` for meaning, `grep` for exact terms
46
+ - Read in parallel, and read sections rather than whole pages when a hit points at one
47
+ - Check provenance to surface contradictions
48
+ - Organize findings by theme, not by page
49
+ - Call out gaps explicitly
@@ -0,0 +1,91 @@
1
+ # Example: Creating a decision record
2
+
3
+ ## User prompt
4
+ "Document our decision to switch from REST to GraphQL for the internal API"
5
+
6
+ ## Workflow
7
+
8
+ ### Step 1: Check for duplicates
9
+ ```
10
+ knowledge_base(command="sections", arguments={"query": "REST to GraphQL decision internal API"})
11
+ ```
12
+ No existing page found.
13
+
14
+ ### Step 2: Pick the project and parent
15
+ ```
16
+ list_projects()
17
+ knowledge_base(command="suggest_parent", scope="Platform", arguments={"title": "Internal API: REST to GraphQL", "content": "... draft with [[API Architecture]] links ..."})
18
+ ```
19
+ Suggested parent: "API Architecture".
20
+
21
+ ### Step 3: Gather sources
22
+ ```
23
+ research(query="internal API architecture GraphQL REST", project="<platform project id>")
24
+ knowledge_base(command="sources", arguments={"page": "API Architecture"})
25
+ ```
26
+ Note each source's citation key and `source_ref`.
27
+
28
+ ### Step 4: Stage the page
29
+
30
+ ```
31
+ knowledge_base_write(
32
+ action="new",
33
+ scope="Platform",
34
+ arguments={
35
+ "title": "Internal API: REST to GraphQL",
36
+ "page_type": "decision",
37
+ "summary": "Decision to move internal service-to-service APIs from REST to GraphQL.",
38
+ "parent": "API Architecture",
39
+ "rationale": "The user asked to record this decision; no existing page covers it.",
40
+ "sections": [
41
+ {
42
+ "title": "Summary",
43
+ "body": "The engineering team decided to migrate the internal API from REST to GraphQL, effective Q2 2026 {{gdrive:api-decision-doc}}. The public API remains REST {{gdrive:api-decision-doc}}.",
44
+ "citations": [
45
+ {"key": "gdrive:api-decision-doc", "source_ref": "beakr-source:v1:...", "stance": "support"}
46
+ ]
47
+ },
48
+ {
49
+ "title": "Decision",
50
+ "body": "**Decision maker:** Sarah Chen (CTO) {{gdrive:api-decision-doc}}\n\nAdopt GraphQL for internal service communication using Apollo Federation {{gdrive:api-decision-doc}}. It reduces over-fetching by 60% based on traffic analysis {{conversation:graphql-traffic}}.",
51
+ "event_start": "2026-03-15",
52
+ "date_precision": "day",
53
+ "citations": [
54
+ {"key": "gdrive:api-decision-doc", "source_ref": "beakr-source:v1:...", "stance": "support"},
55
+ {
56
+ "key": "conversation:graphql-traffic",
57
+ "source_type": "conversation",
58
+ "source_title": "Claude Code session on API traffic",
59
+ "stance": "support",
60
+ "meta": {"excerpt": "Traffic analysis showed GraphQL would cut over-fetching by about 60%."}
61
+ }
62
+ ]
63
+ },
64
+ {
65
+ "title": "Alternatives considered",
66
+ "body": "1. **Keep REST, add OpenAPI codegen** -- lower migration cost but doesn't solve over-fetching {{gdrive:api-decision-doc}}\n2. **gRPC** -- better performance but weaker tooling for our stack {{gdrive:api-decision-doc}}",
67
+ "citations": [
68
+ {"key": "gdrive:api-decision-doc", "source_ref": "beakr-source:v1:...", "stance": "support"}
69
+ ]
70
+ },
71
+ {
72
+ "title": "Related Pages",
73
+ "body": "- [[API Architecture]]\n- [[Platform Team]]"
74
+ }
75
+ ]
76
+ }
77
+ )
78
+ ```
79
+
80
+ ### Step 5: Review with the user
81
+ ```
82
+ show_proposal(proposal_id="...")
83
+ ```
84
+ Call `accept_proposal` only after the user explicitly says to apply it.
85
+
86
+ ## Key points
87
+ - Use the `decision` page type; include the date (`event_start` + `date_precision`), decision maker, and alternatives
88
+ - `sections` is a list of `{title, body}`; Beakr adds the section markers
89
+ - Put an inline `{{key}}` token after every factual claim, and a matching citation record in that section
90
+ - Reuse `source_ref` for sources Beakr already has; cite this conversation with `source_type: "conversation"` and `meta.excerpt`
91
+ - Link related pages with `[[Page Title]]`
@@ -0,0 +1,54 @@
1
+ # Knowledge Base Audit
2
+
3
+ Use this workflow to check knowledge base quality and find issues.
4
+
5
+ ## Procedure
6
+
7
+ ### 1. Get the full picture
8
+
9
+ Call `wiki_stats` for counts and `knowledge_base` command `ls` to list pages (raise `limit` for a full list). Use `ontology` to see which page types the org uses.
10
+
11
+ ### 2. Run diagnostics
12
+
13
+ Call `knowledge_base` command `diagnostics`. It reports broken links, orphan pages, and disputes directly.
14
+
15
+ ### 3. Check the graph
16
+
17
+ Call `wiki_graph` for the most-connected pages. Look for:
18
+ - **Orphan pages** -- no parent and no incoming links
19
+ - **Dead ends** -- pages with no outgoing links (isolated knowledge)
20
+ - **Missing index pages** -- overview pages that should tie sections together
21
+
22
+ Use `links {page}` or `references {page}` to inspect a specific page's neighborhood.
23
+
24
+ ### 4. Spot structural issues
25
+
26
+ From `ls` results, look for:
27
+ - Duplicate or near-duplicate page titles (fix with `merge`, not `archive`)
28
+ - Deeply nested hierarchies (more than 3 levels is usually too deep)
29
+ - Pages without a parent (use `suggest_parent {page}` to find a home)
30
+ - Pages that look like stubs
31
+
32
+ ### 5. Sample content quality
33
+
34
+ Read 5-10 pages with `cat {page, outline: true}` first, then the sections that matter. Prioritize:
35
+ - Heavily edited pages (`log {page}`) -- is the content coherent?
36
+ - Recently created pages -- are they stubs or unreviewed?
37
+ - Overview/index pages -- are they up to date with their children?
38
+
39
+ ### 6. Check provenance
40
+
41
+ For key pages, call `provenance {page}` and look for:
42
+ - Sections with no citations (unsourced claims)
43
+ - Sections with `contradicts` citations (disputed content)
44
+ - Excerpts marked `(paraphrase)` or `(unverified)`, or sources marked "source changed since cited"
45
+
46
+ ### 7. Report findings
47
+
48
+ Organize by severity:
49
+ - **Critical** -- broken links, orphaned important pages, contradicted content
50
+ - **Moderate** -- missing sections, stale pages, structural issues
51
+ - **Minor** -- style inconsistencies, missing Related Pages sections
52
+ - **Recommendations** -- specific pages to create, merge, or reorganize
53
+
54
+ Offer to stage fixes with `knowledge_base_write` (`edit_section`, `merge`, `mv`, `new`) if the user approves.
@@ -0,0 +1,58 @@
1
+ # Understanding Provenance
2
+
3
+ Provenance tracks where knowledge base content came from and how well-supported each claim is. All three views are `knowledge_base` commands.
4
+
5
+ ## Commands
6
+
7
+ ### blame
8
+ Paragraph-level source attribution. Use to answer "where did this paragraph come from?"
9
+
10
+ ```
11
+ knowledge_base(command="blame", arguments={"page": "API Design"})
12
+ ```
13
+
14
+ ### sources
15
+ The source documents behind a page, each with the other pages that draw on it. Also accepts a source title or citation token as `page` to get that one document's entry.
16
+
17
+ ```
18
+ knowledge_base(command="sources", arguments={"page": "API Design"})
19
+ ```
20
+
21
+ Structured results carry `source_ref`, filename, provider, URL/path, excerpt, and locator for each source. Reuse `source_ref` when citing that source in a write.
22
+
23
+ ### provenance
24
+ Per-section citation rollups with stance. The most useful view for judging a claim.
25
+
26
+ ```
27
+ knowledge_base(command="provenance", arguments={"page": "API Design"})
28
+ ```
29
+
30
+ Each citation carries a stance:
31
+ - **support** -- the source confirms the claim
32
+ - **contradicts** -- the source disagrees with the claim
33
+ - **qualifies** -- the source adds nuance or conditions to the claim
34
+
35
+ ## Reading evidence labels
36
+
37
+ - An unmarked excerpt is a verbatim quote from the source.
38
+ - `(normalized)` is the source's words with whitespace or formatting normalized.
39
+ - `(paraphrase)` is the compiler's wording, not the source's.
40
+ - `(human asserted)` was supplied by a person without checking the source text.
41
+ - `(unverified)` was never checked against the source.
42
+ - "source changed since cited" means the source has a newer version than the one the claim was checked against.
43
+
44
+ Open the source (its `url`) before quoting a paraphrase or unverified excerpt, or before resting a conclusion on it.
45
+
46
+ ## When to use
47
+
48
+ - User asks "where did this information come from?"
49
+ - User questions the accuracy of a claim
50
+ - You need to verify before presenting information as fact
51
+ - Auditing page quality (see [auditing.md](auditing.md))
52
+
53
+ ## Interpreting stances
54
+
55
+ - Multiple `support` citations = high confidence
56
+ - A `contradicts` citation = flag it to the user, present both sides
57
+ - A `qualifies` citation = include the nuance in your response
58
+ - No citations on a section = unsourced, note this to the user
@@ -0,0 +1,48 @@
1
+ # Deep Research Workflow
2
+
3
+ Use this workflow when the user needs a thorough, multi-source analysis of a topic.
4
+
5
+ ## Procedure
6
+
7
+ ### 1. Discover the landscape
8
+
9
+ Call `list_projects` to understand the org structure, and `wiki_stats` (with `project` when one is clearly relevant) to know where knowledge lives.
10
+
11
+ ### 2. Ask the researcher
12
+
13
+ Call `research` with the question. It searches the wiki, documents, and connected services and returns a cited answer. Treat it as a starting map, not the final word.
14
+
15
+ ### 3. Broad wiki search
16
+
17
+ Run `knowledge_base` command `sections` with 2-3 phrasings in parallel -- it is semantic, so natural language works. Use `grep` for exact names, IDs, or phrases; if a literal `grep` misses, the wording may differ, so retry with `sections` rather than concluding the knowledge base lacks it.
18
+
19
+ ### 4. Deep read
20
+
21
+ Read the top hits with `cat`, narrowest first: `section_id` from the hit, or `outline: true` to see a page's sections. Read whole pages only when you need material the hit did not point at. Pay attention to:
22
+ - `[[links]]`, Path, Children, and "Linked from" in the output -- follow those edges
23
+ - Page type (`decision` pages carry different weight than `research_note`)
24
+
25
+ ### 5. Trace provenance
26
+
27
+ For key claims, use `provenance {page}` to see which sources support, contradict, or qualify each section, and `sources {page}` to see what fed the page.
28
+
29
+ ### 6. Follow the graph and history
30
+
31
+ Use `links {page}` or `references {page}` on central pages to find related pages you missed. Use `timeline {timeline_query}` for how events unfolded, and `log {page}` only when the question is about change over time.
32
+
33
+ ### 7. Check for conflicts
34
+
35
+ Look for citations with stance `contradicts` or `qualifies`. These are the most valuable findings -- they show where evidence disagrees.
36
+
37
+ ### 8. Synthesize
38
+
39
+ Write up findings organized by theme, not by page. Include:
40
+ - Key findings with page citations (title)
41
+ - Areas of agreement across sources
42
+ - Contradictions or open questions
43
+ - Gaps -- what the knowledge base does NOT cover
44
+ - Temporal context -- when information was written, whether it may be stale
45
+
46
+ ### 9. Recommend
47
+
48
+ If research reveals gaps or stale pages, suggest specific knowledge base updates.