Skip to content
Back to skills

Rule Daemon Knowledge

ASecurity

Knowledge store — documents, revisions, places, review of agent writes, the knowledge tools. A repository rule for apps/daemon/src/v1/knowledge/**, apps/daemon/src/v1/mcp/tools/**/knowledge-*, apps/daemon/src/v1/mcp/tools/paged-text*, apps/daemon/src/v1/agents/**/knowledge-*, apps/daemon/src/v1/agents/**/host-knowledge*, apps/daemon/src/db/knowledge-*; read it before editing a file there.

  • 8 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 17, 2026
ai-agentsgosqldatabase

Works with

  • cli
  • mcp

Security analysis

A100/100

Scanned November 28, 2026

npx -y skills add geniro-io/geniro-app --skill rule-daemon-knowledge --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Rule Daemon Knowledge?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Rule Daemon Knowledge
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/geniro-io-rule-daemon-knowledge/badge)](https://www.skillsdirectory.com/skills/geniro-io-rule-daemon-knowledge)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: rule-daemon-knowledge
description: "Knowledge store — documents, revisions, places, review of agent writes, the knowledge tools. A repository rule for apps/daemon/src/v1/knowledge/**, apps/daemon/src/v1/mcp/tools/**/knowledge-*, apps/daemon/src/v1/mcp/tools/paged-text*, apps/daemon/src/v1/agents/**/knowledge-*, apps/daemon/src/v1/agents/**/host-knowledge*, apps/daemon/src/db/knowledge-*; read it before editing a file there."
---
<!-- GENERATED by scripts/sync-agent-rules.mjs from .claude/rules/daemon-knowledge.md. DO NOT EDIT: edit the source, then run `pnpm sync:agent-rules`. -->

# Knowledge store

`v1/knowledge` — Markdown documents filed in a project, a team or Global, listed to agents by a short index and reached through `knowledge_search`, `knowledge_read` and `knowledge_save` (base `KnowledgeMcpTool`, `.claude/rules/mcp-tools.md`). Instructions keep a line naming a document's handle; the agent reads the body only when it helps.

- `knowledge_documents` and `knowledge_revisions` are teardown-exempt (`.claude/rules/storage-split.md`), with no foreign keys. `place_key` (`project:<id>`, `team:<slug>`, `global`) carries the unique `(place_key, handle)`, because SQLite treats NULLs as distinct. Archive is `status`, never `deletedAt`: a permanent delete is hard, so the FTS `AFTER DELETE` trigger fires and the handle is freed.
- Every write goes through `KnowledgeService`, serialized. The user's write applies at once, rev + 1, stamping `approvedAt`, with hidden characters taken out of its text (`withoutHiddenText`), where an agent's is refused naming the line; a stale `rev` answers `KNOWLEDGE_STALE`. An agent's write follows `agentWrites`: `review` (default) makes a `proposed` document at rev 0 or a `pending` revision and leaves the document as it was; `direct` applies it and clears `approvedAt`; `off` refuses `KNOWLEDGE_READ_ONLY`. At most `KNOWLEDGE_PENDING_MAX` pending revisions per document, and decided revisions past the newest `KNOWLEDGE_REVISIONS_KEPT` are dropped.
- Approve is refused `PROPOSAL_STALE` once the document moved past the proposal's `baseRev`: the review offers the text to merge by hand. Reject marks a change `rejected` and hard deletes a proposed document, which frees its handle. A document `direct` saved stays unreviewed (`approvedAt` null, kept out of the index and read inside a fence) until a write of the user's takes its text — their own edit, or approving a change proposed on it, which approves its whole text, as the review says — or the user loads it into the index (`POST /v1/knowledge/:id/index`, `KnowledgeService.setIndexed`, which stamps `approvedAt` on the document and its current revision; `/search-only` clears both; both refuse a document that is not active). `knowledge_revisions.approvedAt` records whether the user took a version's text, so restoring one they never did leaves the document unreviewed. Archive, restore and a permanent delete are the user's only, but for a `retire` item the user applied (`.claude/rules/daemon-thread-analysis.md`).
- A run's place comes from `ProjectScopeService.placeOf` / `placeFor`, never from an argument; `knowledge_save`'s `place` picks a level (`project`, `team`, `global`) of the run's own places. A builder or analysis chat has a null `teamId`, so it sees project and Global only of its own.
- An analysis, a team's builder chat and a project's own chat may name another place (user decision): all three tools take `project` (an id) or `team` (a slug), listed only there (`isAppOwnChat`), and that place and Global stand in for the run's own for the one call (`KnowledgeMcpTool.run`, `KnowledgeService.placeNamed`, `NO_PROJECT` / `NO_TEAM`); a `knowledge_read` there that finds nothing in the run's own places says how to name another (`knowledgeMissingText`). Every other chat and every team member keeps its own places, and its reader refuses the two names as unknown. The write rules, the actor and the index are unchanged: `agentWrites` decides as for any write, and the index stays the run's own. An approved document read from another project or team is prefaced as data, not as the user's instructions to this chat (`prefaceOf`). The transcript row reads it back from the named place (`headsInNamedPlace`, twin of `placeKeysOf`).
- The page's search (`list` with `q`) ranks like the agent's, title and when-to-read first with the any-word retry (`rankedMatches`), over at most `KNOWLEDGE_LIST_SEARCH_POOL` rows of the filter, and returns one page.
- `GET /v1/knowledge/runs/:runId/search` (`runSearch`) is `knowledge_search` for the transcript: a row whose CLI kept no result text asks it, so it finds what the agent's search finds, shadowing and the any-word fallback included.
- `visibleHeads` is the one visibility rule: a body-free read of `active` rows on the run's keys, and per handle the row of the nearest key (`nearestOf`, project, then team, then Global). Search, read and the index all go through it, so a shadowed Global document never answers. Lists, counts, the index and visibility never read `body`: a bare read of 256 KB bodies stalls the event loop.
- `knowledge_fts` is FTS5 over title, when-to-read and body, the third exception in `.claude/rules/database-queries.md`. Its `rank` is `bm25(0, 8.0, 4.0, 1.0)`, weights positional and counting the UNINDEXED column, an INSERT stored in `knowledge_fts_config`, so `KnowledgeTextIndexService.ensure` runs it at every boot. A query that finds nothing with every term retries with any term over one character, since FTS5 has no Russian stemmer.
- A new run snapshots the index once (`KnowledgeService.runSnapshot`, in the same two Run builders as memory's) onto `Run.knowledgeIndex`, because it joins `sessionKey`; every read is live. It lists only documents with `approvedAt`, at most `KNOWLEDGE_INDEX_MAX_BYTES`, and is composed only where the turn's MCP tools were delivered. Until Electron's first push the daemon holds only the default, so a run is created without an index.
- Approved text reaches an agent as the user's own instructions; a `direct` document with no `approvedAt` is prefaced as unreviewed and marked in every listing. This is the one deliberate difference from memory's "data, not instructions" fence. Every result is masked with `redactSecrets`.
- `knowledge_read` pages at `PAGE_BYTES` through `tools/paged-text.ts`, shared with `read_teams`; a body over about one page opens with its outline. `knowledge_save` changes a document through `edits`, each `find` unique, never a whole body, and a missing or repeated `find` refuses the set.
- Deleting a project settles its documents inside `ProjectsService.remove`'s transaction through a removal participant (`KnowledgeProjectRemovalService`, registered at init, because `KnowledgeModule` imports `ProjectsModule`). Every statement is built on `tx` and it takes no write queue: a forked statement awaited there waits for ever on the connection the transaction holds. `global` moves documents one by one, a taken handle getting `-2`, `-3`; the answer reports each rename, and `knowledge_changed` is published after the commit. Deleting a team settles the same way through `TeamChatService.deleteTeam` → `settleDeletedTeam`. Both default to `global`.
- Each write publishes `knowledge_changed` (`KnowledgeEventBus`) to EVERY client, ids and place only. The routes (`KnowledgeController`, `/v1/knowledge`) are open to paired devices, approve included, as `/v1/memories` is; the config push (`PUT /v1/knowledge/config`, `KnowledgeConfigController`) is desktop only, and `Settings.knowledge` stays writable from a paired device.
- Auto-approved in chats and team members (`isHostKnowledgeCall`): a card reaches no team member, and the write rules live in the service.
- A revert keeps `KNOWLEDGE_TEXT_TABLES` in `skipTables`: a profile that ran the feature holds `knowledge_fts`, whose untyped columns make the schema sync throw at every boot.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.