Repository navigation
Knowledge notes: agents propose a sourced rules finding, a reviewer approves it, every account reads it - #358
Merged
Merged
Conversation
…pproves it, every account reads it Phase 6 of the skill-tests plan, part one (the admin screen is next). - 089/090: knowledge_note, the knowledge.review permission (admin tiers; grantable to a contributor), queue + review functions, audited, RLS. - /knowledge/notes (propose, dry run by default; read) and /admin/knowledge (queue, review) behind a browser session. - propose_note tool; get_card and rules_lookup show approved notes, quoted as third-party text. - Automatic checks refuse personal data and flag the rest for review. - Counts 31 -> 32 tools (12 write) across docs and the preview card. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015oYErNsTyzvYNppwoipzdY
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
… names and links checked (Astra round 1) - 089 turns RLS on with no policy, so a client role reaches nothing until 090's policies exist (proven in the DB suite between the two files). - knowledge_require_reviewer(): session, active account, knowledge.review; not admin.access, which a contributor can never hold. A contributor now lists and decides notes (tested). - noteKey(): one normal form for storing and looking up card names; rules_lookup passes the names as given, not the punctuation-stripped form. - The source link is checked for an email (as typed and percent-decoded) and user:password; a long number in it is flagged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015oYErNsTyzvYNppwoipzdY
… review (Astra round 2) - knowledge_note_propose() is the only way a note is stored: no INSERT policy, so a client calling Supabase directly cannot skip the limits (20 waiting, 20 an hour), duplicate check or personal-data refusal, which the function enforces itself. Session or token may propose. - The checks column is gone: reviewer flags are computed from the stored note when the queue is read, so a proposer cannot supply an empty list. - The link is decoded escape by escape, so a malformed escape elsewhere no longer hides an encoded email (regression test). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015oYErNsTyzvYNppwoipzdY
…database decodes links fully (Astra round 3) - /knowledge joins the self-host request-transaction paths (now the named SELF_HOST_REQUEST_TX in db.ts, tested), so knowledge_note_propose() sees who is asking instead of answering 403. - knowledge_url_decode(): every %XX escape decoded on its own and repeatedly, so %25%34%30 is caught as @; card names are checked for phone numbers too. DB suite: a self-host identity proposes, and both bypasses are refused (12/12 on PG16). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015oYErNsTyzvYNppwoipzdY
…at it leaves no page stale CI's approvalPhrases and writeRefresh tests require every write tool in Deck-E's tables. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015oYErNsTyzvYNppwoipzdY
…is dated recently, not 2026-09-28 - copy.ts: propose_note in the "Catalog, prices and rules" group of llms.txt and /connect; the Read-and-change line says it can propose a rules note. landingCopy test: 32 tools (20 read, 12 write). - improvement.mjs: validLeg shares a turn with legs recorded at real time, and a turn's latency is integer milliseconds, so the fixed 2026-09-28 leg overflowed it (22003, masked as "Invalid improvement leg numeric field") from 2026-10-23 on every branch. The leg is now a minute old, and the day-filter check asserts what the filter keeps rather than a fixture count that depended on the run date. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015oYErNsTyzvYNppwoipzdY
…ion routers Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015oYErNsTyzvYNppwoipzdY
This branch was successfully deployed
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.
Phase 6, part one: the shared knowledge base. The admin review screen comes in the next PR.
What it adds
089_knowledge_note.sql:knowledge_notetable;knowledge.reviewpermission, seeded to admin, super_admin and owner. The ceiling lets it be granted to a contributor role (tier 30).knowledge_note_queueandknowledge_note_review(SECURITY DEFINER). These need a session. Each note is decided once (P0002 after that) and every decision is audited.090_knowledge_note_rls.sql(@supabase-only): an account sees approved notes plus its own, and inserts only its own pending note. Nobody can update or delete through the table.POST /knowledge/notes: dry run by default; refuses personal data with a 422; 20 an hour; at most 20 pending; duplicates are not stored twice.GET /knowledge/notes?cards=.GET /admin/knowledgeandPOST /admin/knowledge/:id/review: browser session only.propose_note(a write,destructiveHint: falseon the wire).get_cardandrules_lookupprint up to three approved notes, always quoted, under a header that says the source is the authority.rulesplaybook and the tool table mention it.save_deckandcontinue_tokendescriptions were trimmed with the same facts; the tests that pin their phrases pass.Verified
knowledgeNotes.mjsagainst real PG16 with every migration: 7/7.test:variants: 401/401.test:adapter: 24/24.test:cloud(docs counts): 48/48.test:pure: 349/349.tscis clean for agent-tools, api, mcp and web.decisions:checkpasses.Before merge: apply 089/090 to production with the tsx runner.
🤖 Generated with Claude Code
https://claude.ai/code/session_015oYErNsTyzvYNppwoipzdY