Skip to content

sources/wiki split, truth-timeline page structure, and MCP server#11

Closed
kelsi-bizer wants to merge 1 commit into
masterfrom
claude/sources-truth-timeline-mcp
Closed

sources/wiki split, truth-timeline page structure, and MCP server#11
kelsi-bizer wants to merge 1 commit into
masterfrom
claude/sources-truth-timeline-mcp

Conversation

@kelsi-bizer

Copy link
Copy Markdown
Owner

Summary

Three concrete patterns borrowed from the GBrain and Karpathy-pattern comparisons we discussed, all within BizerOS Knowledge's filesystem-pure philosophy:

  1. sources/ vs pages/ vs daily/ folder split (Karpathy-inspired)
  2. Compiled-truth + timeline page structure (GBrain-inspired)
  3. MCP server so the brain works with any MCP-capable agent, not only those that load .agents/skills/

Nothing in here adds a database, an embedding pipeline, or any external dependency. The brain is still a folder of plain .md files; the new patterns just make the convention sharper and the agent surface broader.

1. Folder convention update — .agents/skills/bizeros-knowledge/SKILL.md

The skill now teaches three distinct folders with three distinct jobs:

Folder Role Mutability
sources/ Raw, immutable inputs — transcripts, articles, email dumps, dictated notes Agent: read + append-only (never rewrite the body)
pages/ The wiki: synthesized topical or per-entity notes Agent: owns — creates, maintains, restructures
daily/ The user's journal, one note per day User's home turf — agent appends conservatively

The boundary that matters most: sources/ is the receipts, pages/ is the synthesis, daily/ is the human's voice. The agent's procedures are now split accordingly — "Capturing from a conversation" updates daily/; a new "Ingesting a source" procedure files raw input under sources/ and links it back to the relevant pages/.

2. Page structure — compiled truth + timeline

Every pages/<Entity>.md now follows:

# Sarah Johnson

Lead engineer on Project Aurora. Joined March 2025. Lives in Berlin.
Reports to Marcus. Owns the API redesign.

---

## Timeline

- 2026-05-09 — Mentioned in [[daily/2026-05-09]]: "Sarah will own the launch checklist by Friday"
- 2026-04-22 — Source [[sources/q2-review-transcript]]: confirmed as Aurora lead
- 2026-03-14 — First mentioned in [[daily/2026-03-14]]: introduction

The compiled truth above the --- is rewritable — the agent keeps it current as facts evolve. The timeline below is append-only — every meaningful piece of evidence gets a new dated entry with a back-link to where it came from. Never edited, never deleted.

This solves a real problem with pure-markdown knowledge bases: provenance. When the agent says "Sarah lives in Berlin," the user can scroll down and see which raw note that came from and when. Without this convention, the agent either hallucinates or gets stuck in conservative "I'm not sure" mode.

New pitfalls in the skill: never rewrite sources/, never delete or edit timeline entries.

3. MCP server — packages/mcp-server

New package exposing the same four tools (list_notes, search_notes, read_note, write_note) over the Model Context Protocol via stdio.

Why this matters: agentskills.io skills work great in Hermes, OpenClaw, and Claude Code, but MCP is the broader, more portable standard. Adding an MCP server makes BizerOS Knowledge usable from any MCP-capable agent — Claude Code, Cursor, MCP-Inspector, custom clients — by adding one line to their MCP config:

{
  "mcpServers": {
    "bizeros-knowledge": {
      "command": "node",
      "args": ["/opt/bizeros-knowledge/packages/mcp-server/src/server.js"],
      "env": { "BRAIN_DIR": "/srv/bizeros/brain" }
    }
  }
}

Implementation

packages/mcp-server/
├── package.json                # @modelcontextprotocol/sdk ^1.27.1
├── src/
│   ├── brain.js                # filesystem ops (mirrors brain_tools.py)
│   └── server.js               # MCP Server + StdioServerTransport
└── test/
    ├── brain.test.js           # 12 tests on the filesystem layer
    └── server.test.js          # 6 tests at the MCP protocol layer

src/brain.js mirrors the same safety contract as brain_tools.py: path traversal blocked via path.relative() check, null bytes rejected, atomic writes (tmp + rename), consistent {ok, ...} return shape.

Tool descriptions in server.js carry the new conventions through to the agent — the write_note description explicitly mentions the compiled-truth + timeline structure so MCP-only agents (which don't load the SKILL.md) get the same guidance.

Tests

18 passing (node --test test/*.test.js):

  • brain layer (12): round-trip, .md auto-append, traversal blocked, null byte rejected, search returns first matching line as snippet, list sorted alphabetically.
  • protocol layer (6): tools/list exposes all four tools with full schemas; tools/call round-trips read+write; unknown tool names handled; traversal rejected at the protocol boundary too.

End-to-end MCP stdio smoke test (passed)

Drove the server with a real JSON-RPC sequence:

  • initialize → server announces capabilities
  • tools/list → all 4 tools with descriptions and JSON Schema
  • tools/call write_note{"ok":true,"path":"pages/Hello.md","bytes":19}
  • cat /tmp/brain-mcp-live/pages/Hello.md → exact content

What's not touched

  • packages/notes-app — web UI unchanged.
  • packages/file-api — HTTP file service unchanged.
  • Docker image — unaffected; nothing in the build context changed.

Test plan

  • cd packages/mcp-server && pnpm install && pnpm test — 18 tests pass
  • Configure Claude Code (or any MCP client) with the snippet above, then ask the agent to "list my notes" — it should call list_notes via the MCP server and return the contents of $BRAIN_DIR
  • Have the agent capture a meeting → it should write daily/<today>.md with [[wiki links]] and create/update relevant pages/<Entity>.md files following the truth + timeline pattern
  • Drop a transcript into sources/2026-05-XX <topic>.md → agent extracts entities, links from pages/<Entity>.md timelines back to [[sources/2026-05-XX <topic>]]

Generated by Claude Code

Brings two cross-cutting patterns into BizerOS Knowledge that have been
proven elsewhere (Karpathy's LLM Wiki pattern, GBrain's compiled-truth
structure) and adds a Model Context Protocol server so the brain works
with any MCP-capable agent, not only those that load .agents/skills/.

1. Folder convention: sources/, pages/, daily/

The SKILL.md now teaches three distinct folders:

- sources/  raw, immutable inputs (transcripts, articles, email
             dumps). Agent treats as append-only.
- pages/    the wiki: synthesized topical/per-entity notes the agent
             owns and maintains.
- daily/    the user's journal, mutable by the human.

The agent's procedures are split accordingly: "Capturing from a
conversation" updates daily/; a new "Ingesting a source" procedure
files raw input under sources/ and links it back to pages/.

2. Page structure: compiled truth + timeline

Every pages/<Entity>.md now has a stable, rewritable "compiled truth"
section above a "---" separator and an append-only "## Timeline"
below, with dated entries that back-link to [[daily/...]] or
[[sources/...]]. The truth section is overwritten when facts change;
timeline entries are never edited or removed. The user gets the
current understanding AND the provenance trail in one file.

Pitfalls added: never rewrite sources/, never delete timeline
entries, never edit existing timeline entries.

3. MCP server (packages/mcp-server)

New package exposing the same four tools (list_notes, search_notes,
read_note, write_note) over the Model Context Protocol via stdio.
Agents that speak MCP natively (Claude Code, Cursor, any MCP client)
can use BizerOS Knowledge by adding one line to their MCP config:

    {
      "mcpServers": {
        "bizeros-knowledge": {
          "command": "node",
          "args": ["/opt/bizeros-knowledge/packages/mcp-server/src/server.js"],
          "env": { "BRAIN_DIR": "/srv/bizeros/brain" }
        }
      }
    }

Implementation:
- src/brain.js  filesystem ops with the same safety contract as
                 brain_tools.py: path traversal blocked, atomic
                 writes (tmp + rename), consistent {ok, ...} shape.
- src/server.js  MCP Server wired to StdioServerTransport. Tool
                 schemas mirror the JSON Schema in tools/definitions.
                 json but include the truth-timeline guidance in the
                 write_note description.

Tests (18 passing, node:test):
- brain.test.js   round-trip, ensureMd, traversal blocked, null byte
                  rejected, search snippet correctness, list sorted.
- server.test.js  list_tools exposes all four with schemas, call_tool
                  round-trips, unknown tool name handled, traversal
                  rejected at the protocol layer.

End-to-end stdio smoke test confirmed: real MCP client sequence
(initialize -> tools/list -> tools/call) returns valid JSON-RPC
responses and writes a file to BRAIN_DIR.

No code changes outside .agents/skills/bizeros-knowledge/SKILL.md
and packages/mcp-server/. The web UI (packages/notes-app), file-api
(packages/file-api), and docker image are unaffected.
@kelsi-bizer kelsi-bizer mentioned this pull request May 11, 2026
4 tasks
kelsi-bizer added a commit that referenced this pull request May 11, 2026
Renames the product across every surface that ships to a user — the
SPA, the file-api, the agent skill, the docker image tag, and
default paths. Doesn't touch the upstream-Logseq files (those will
be deleted by PR #10) or the README (likewise rewritten by PR #10).

Why now: BizerBrain is shorter, matches the /brain folder we
already use everywhere, and sits in the same naming family as
GBrain (deliberate positioning, not derivative). This is the
earliest moment to rename — image hasn't been pulled in production,
ClawHub hasn't been submitted, no external references exist yet.

Surface changes:

- Skill folder: .agents/skills/bizeros-knowledge -> bizerbrain
  (renamed via git mv, history preserved)
- SKILL.md frontmatter: name=bizerbrain, tags includes bizerbrain
- SKILL.md body heading: # BizerBrain
- SKILL.md default path: /srv/bizeros/brain -> /srv/bizerbrain/brain
- brain_tools.py: docstring + default BRAIN_DIR
- packages/notes-app/index.html: <title>BizerBrain</title>
- packages/notes-app/src/App.tsx: app-title text + localStorage key
  (bizeros-view-mode -> bizerbrain-view-mode)
- packages/notes-app/src/hooks/useTheme.ts: localStorage key
  (bizeros-theme -> bizerbrain-theme)
- packages/notes-app/package.json: name -> @bizerbrain/notes-app
- packages/file-api/package.json: name -> @bizerbrain/file-api
- docker/entrypoint.sh: header comment
- .github/workflows/build-docker.yml: IMAGE_NAME -> bizerbrain
  (image now publishes to ghcr.io/<owner>/bizerbrain:latest)

Verified:
- packages/notes-app: pnpm typecheck passes with new package name
- packages/file-api: pnpm test passes (20/20)
- grep "BizerOS\|bizeros" returns zero hits in our owned files

Not in this PR:
- Repo rename on GitHub (UI action, owner does it whenever; the image
  path is already on the new name regardless)
- README.md (still upstream Logseq content; PR #10 rewrites)
- LICENSE (added by PR #10)
- Open PRs #10 and #11 will need a small rebase to use the new name
  (mostly the SKILL.md and package.json identifiers)

Co-authored-by: Claude <noreply@anthropic.com>
kelsi-bizer added a commit that referenced this pull request May 11, 2026
…#14)

Redo of closed PR #11 with BizerBrain naming throughout. Brings two
cross-cutting patterns into BizerBrain that have been proven elsewhere
(Karpathy's LLM Wiki pattern, GBrain's compiled-truth structure) and
adds a Model Context Protocol server so the brain works with any
MCP-capable agent.

1. Folder convention: sources/, pages/, daily/

The SKILL.md now teaches three distinct folders:

- sources/  raw, immutable inputs (transcripts, articles, email
             dumps). Agent treats as append-only.
- pages/    the wiki: synthesized topical/per-entity notes the agent
             owns and maintains.
- daily/    the user's journal, mutable by the human.

A new "Ingesting a source" procedure files raw input under sources/
and links it back to pages/. The boundary: sources/ is the receipts,
pages/ is the synthesis, daily/ is the human's voice.

2. Page structure: compiled truth + timeline

Every pages/<Entity>.md now has a stable, rewritable "compiled truth"
section above a "---" separator and an append-only "## Timeline"
below, with dated entries that back-link to [[daily/...]] or
[[sources/...]]. The truth section is overwritten when facts change;
timeline entries are never edited or removed.

Pitfalls added: never rewrite sources/, never delete timeline
entries, never edit existing timeline entries.

3. MCP server (packages/mcp-server)

New package exposing the same four tools (list_notes, search_notes,
read_note, write_note) over the Model Context Protocol via stdio.
Agents that speak MCP natively (Claude Code, Cursor, any MCP client)
can use BizerBrain by adding one line to their MCP config:

    {
      "mcpServers": {
        "bizerbrain": {
          "command": "node",
          "args": ["/opt/bizerbrain/packages/mcp-server/src/server.js"],
          "env": { "BRAIN_DIR": "/srv/bizerbrain/brain" }
        }
      }
    }

Implementation:
- src/brain.js  filesystem ops with the same safety contract as
                 brain_tools.py: path traversal blocked, atomic writes
                 (tmp + rename), consistent {ok, ...} shape.
- src/server.js  MCP Server wired to StdioServerTransport. Tool
                 schemas include the truth-timeline guidance in the
                 write_note description so MCP-only agents (which
                 don't load SKILL.md) get the same convention.

Tests (17 passing, node:test):
- brain.test.js   round-trip, ensureMd, traversal blocked, null byte
                  rejected, search snippet correctness, list sorted.
- server.test.js  list_tools exposes all four with schemas, call_tool
                  round-trips, unknown tool name handled, traversal
                  rejected at the protocol layer.

No code changes outside .agents/skills/bizerbrain/SKILL.md and
packages/mcp-server/. The web UI (packages/notes-app), file-api
(packages/file-api), and docker image are unaffected.

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants