Skip to content

feat(knowledge): scribes set themselves up and maintenance finds the review scribe - #185583

Merged
jalehman merged 6 commits into
mainfrom
openclaw-852.6/knowledge-scribe-skills
Oct 27, 2026
Merged

jalehman merged 6 commits into
mainfrom
openclaw-852.6/knowledge-scribe-skills

Conversation

@jalehman

@jalehman jalehman commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The Knowledge Scribes tab needs scribe conversations that set themselves up from one fixed message, and the unlinked-claims review currently requires a hand-made automation with a far-future placeholder schedule plus a reviewJobId config edit.

User Impact

An owner conversation that receives Knowledge scribe setup: <id> and its JSON options (typed by hand now; the Scribes tab in #185637 sends the same message) sets up its scribe on its own:

  • Review unlinked claims declares one automation (knowledge:scribe:unlinked-review) targeting its own session and ends with a SCRIBE_RESULT line. Maintenance queues that automation automatically when maintenance.reviewJobId is unset, so config edits are no longer needed.
  • Learn from conversations learns from active or active + archived conversations within a since window, either once or on a schedule. A checkpoint page lets reruns skip what was already learned.
  • Learn from Memory is a one-time import of MEMORY.md, daily notes and DREAMS.md. It never modifies Memory files and skips anything Knowledge already has.

maintenance.reviewJobId still wins when set. The maintenance docs give the complete manual setup message, plus repair and recovery.

Why This Change Was Made

Each scribe skill has a Scribe setup section. The shared steps (access check, declaring the automation by declaration key, repair, the result line) live in one shared reference copied into the two scribe skills. Declaration keys are unique per owning conversation and a declarative add does not change a job's session, so setup removes same-key jobs owned by other conversations, retargets its own job with update when needed, carries a paused state over, and reads the job back. A never-written vault reports store unprovisioned with writes off; setup treats that as OK, since the first write creates it. Maintenance looks up the job by declaration key once per pass through the plugin's existing cron access. It prefers an enabled job; a paused one is reported as skipped. The review job's own schedule is a weekly backstop, since maintenance already queues it nightly when claims are left.

Evidence

  • pnpm test extensions/knowledge/src/maintenance.test.ts extensions/knowledge/src/skill-packaging.test.ts extensions/knowledge/src/storage-schema.test.ts: all passed. Tests cover: no scribe job means no review; the enabled scribe job is preferred and queued; a paused one is reported skipped; a configured reviewJobId skips the lookup.
  • node extensions/knowledge/scripts/sync-skill-references.mjs --check, oxfmt and git diff --check: clean.
  • Autoreview (Claude engine, branch mode, P2 threshold; Codex CLI auth was unavailable): scoped-clean.

Live test gateway, build 1207fe12788

The head 46abc3feae0 differs from the tested build only in how one caught scheduler error is formatted for the log (extensions/knowledge/src/maintenance.ts, removing a type assertion for the assertion-safety ratchet); the skill text and lookup logic are identical.

Isolated gateway on fsn1 loopback, fresh state (vault never written), Knowledge in the memory slot, real model. Each setup message, in the exact contract format, was typed into a fresh owner session's Control UI chat composer.

  • Review unlinked claims on a never-written vault: knowledge_status reported store: unprovisioned, scope: private, writesEnabled: false; setup proceeded, listed jobs, and created 462a5fef… (declarationKey: knowledge:scribe:unlinked-review, sessionTarget: session:<its own key>, 45 3 * * 0 America/Los_Angeles, delivery none, failureAlert {after: 2}). It started no run.
    SCRIBE_RESULT {"scribe":"unlinked-review","state":"on","jobId":"462a5fef-6110-4a9b-889c-e20a29cecb34","summary":"Weekly unlinked-claims review automation declared for Sundays 03:45 America/Los_Angeles; first run 2026-11-01."}
    
  • Same-key cleanup and pause carry-over: paused 462a5fef… with cron.update {enabled:false}, then sent the same setup message from a second new conversation. That turn called automations list, remove 462a5fef…, add (targeting its own session), then list again. cron.list afterwards held exactly one knowledge:scribe:unlinked-review job, 9f728a26…, enabled: false, targeting the second conversation.
    SCRIBE_RESULT {"scribe":"unlinked-review","state":"on","jobId":"9f728a26-5af1-450f-bc0d-dbac445e1674","summary":"Weekly review automation declared for this conversation; it stays paused because the replaced job was paused."}
    
  • Learn from conversations, ongoing, scope: "all", since: "today", schedule 0 */6 * * *: two seeded owner conversations, one then archived with sessions.patch {archived:true}. Setup created job 42ee3172… targeting its own session and did no learning. An operator cron.run {mode:"force"} (what the Scribes tab's Run now sends) queued run cron-request.72e63040…, which finished ok in the scribe's session: sessions_list {"archived":"all","excludeSubagents":true}, 2× sessions_history, knowledge_remember, checkpoint page created and updated with knowledge_edit_body. It learned the archived "Billing database choice" conversation (3 claims) and the active one (1 decision), and skipped the 4 scribe conversations.
    SCRIBE_RESULT {"scribe":"conversations","state":"on","jobId":"42ee3172-319b-415e-9c34-d647f9bf052b","summary":"Learned 2 conversations and skipped 4; wrote 4 claims and 1 checkpoint page."}
    
  • Learn from Memory, once, all sources (seeded MEMORY.md, memory/2026-10-21.md, DREAMS.md with a grounded line, a reflection, and checked/unchecked items): knowledge_grep before saves, then knowledge_remember. It saved 4 items from MEMORY.md and the daily note (the decision dated 2026-10-21), saved the DREAMS.md grounded bike fact as agent inference citing the entry, and skipped the reflection and the unconfirmed item. The three files' SHA-256 hashes were unchanged after the run.
    SCRIBE_RESULT {"scribe":"memory","state":"done","jobId":null,"summary":"Read 3 Memory files; saved 5 claims, 0 already known, 2 items skipped."}
    

Negative controls (same gateway, build 1207fe12788)

Vault record count was 10 before and after both runs.

  • Non-owner session refused: an operator-added isolated automation carrying the exact conversations scribe run message, forced with cron.run (cron-request.26faaf8e…). The Gateway logged memory audience unavailable: root session agent:main:cron:30d3add3-…:run:d3d38270-… has no durable chat type, knowledge_status was refused, and nothing was read or saved:
    SCRIBE_RESULT {"scribe":"conversations","state":"failed","jobId":null,"summary":"This run has no access to the owner's private Knowledge store, so a repair from a new direct-chat conversation is needed."}
    
  • Scribe job refused after its conversation is reset: sessions.reset on the conversations scribe's session, a new seed conversation added, then cron.run {mode:"force"} on its declared job 42ee3172… (cron-request.98f59a26…). The run failed in 7 ms, before any agent turn: The operator authority that created this automation was refused … Scheduled operator continuation definition or conversation changed; recreate it from an authenticated turn. The new conversation was not learned.

Maintenance discovery only chooses which job to enqueue; the scheduler's owner check above runs at execution and is unchanged by this PR.

On the earlier build c5a89ae (same maintenance code as this head): with reviewJobId unset, a scheduled maintenance pass logged review enqueued (9 unlinked) and maintenance_status.lastRun.review showed the scribe job and run ID; that run linked 4 claims in the scribe's own session.

Found live and fixed in this PR

  • A run that a setup turn starts against its own session is skipped once the turn ends (agent tool caller authority is no longer active). Setup no longer starts one; the first scheduled, maintenance-queued, or operator Run now run is the test.
  • Declaration keys are unique per owning session, so setting up from a second session created a second job. Setup and repair now remove same-key jobs owned by other conversations and retarget their own.
  • A never-written vault failed the access check. It now proceeds.

Not exercised live

  • Upgrade preservation: this PR changes no stored data shape. An existing maintenance.reviewJobId still takes precedence (unit test); existing automations and vault records are untouched.

@clawsweeper

clawsweeper Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation plugin: knowledge size: M labels Oct 27, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 27, 2026
@clawsweeper

clawsweeper Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR adds skill-driven scribe setup and repair, conversation and Memory ingestion, and automatic discovery of the review automation.

Example: An owner sends the unlinked-review setup message with timezone America/Los_Angeles.

  • Before: The owner creates a worker and automation manually, then configures maintenance.reviewJobId.
  • After: The conversation declares its own Sunday 03:45 automation, which maintenance discovers without a config edit.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Focused implementation, production-entry-point proof, resolved prior findings, and passing exact-head CI support readiness.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Real-model Gateway output exercises manual owner-chat setup, replacement with pause preservation, conversation ingestion including archived sessions, Memory import with unchanged file hashes, and maintenance-triggered review. Negative controls refuse an isolated non-owner run before Knowledge access and a reset conversation before an agent turn, with vault counts unchanged. The live-tested build differs only in error-log formatting. Inspected screenshots belong to the companion UI and are supplemental.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: Starting unattended Knowledge workflows requires hand-written automation setup and a config edit for maintenance review.
Reason: The maintainer-authored direction removes manual setup using existing plugin and scheduler capabilities, with an independently usable documented entry point.

Merge readiness

✅ Ready for maintainer review

This PR provides useful self-configuring Knowledge scribes that current main lacks; the prior findings are resolved, and no blocking defect remains.

Priority: P2
Reviewed head: 46abc3feae017a4d02e750cc9ba9924f38b8827a

Before merge

None.

Findings

None.

Agent review details

How this fits together

Knowledge skills guide owner-authorized agent conversations; the existing automation scheduler runs them, and plugin maintenance queues review when private claims remain unlinked.

flowchart TD
  Owner[Owner conversation] --> Skills[Knowledge scribe skills]
  Skills --> Scheduler[Automation scheduler]
  Maintenance[Knowledge maintenance] --> Scheduler
  Scheduler --> Authority[Live authority checks]
  Authority --> Skills
  Skills --> Vault[Knowledge vault]
Loading

Technical review

Best possible solution:

Use the existing skills and scheduler to configure scribes while preserving explicit reviewJobId selection, paused jobs, and live owner authority.

Do we have a high-confidence way to reproduce the issue?

This is a feature addition; current-main source confirms the manual review setup that the PR replaces, and supplied Gateway output demonstrates the new path.

Is this the best way to solve the issue?

The change fits existing owners: skills describe the workflows, maintenance discovers the job, and the scheduler retains execution authority without a new queue or storage subsystem.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 52b43f7145f9.

Provenance checked

  • Scheduled review setup and reporting changes intended behavior with a stated reason (65ad180: The bundled plugin used a retained owner-delegated worker and explicitly configured review automation to preserve private-vault authority.)
  • Review automation selection keeps the original intent (65ad180: Maintenance handed unlinked private claims to the operator-selected job; the PR preserves that selection and adds discovery only when it is unset.)
  • Self-contained skill references keeps the original intent (65ad180: The existing generator copies shared guidance into each exported skill bundle so references remain self-contained.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Introduced change and current-main boundary: The pinned introduced diff adds declaration-key discovery and scribe instructions; fetched main still requires a configured reviewJobId. (extensions/knowledge/src/maintenance.ts:251, 46abc3feae01)
  • Live behavior and negative controls: The PR body supplies real-Gateway results for setup, duplicate cleanup with pause preservation, archived-conversation ingestion, unchanged Memory files, maintenance discovery, non-owner refusal, and refusal after conversation reset. (46abc3feae01)
  • Tested-build equivalence: The difference from the live-tested build is confined to formatting a caught scheduler error; the exercised skills and discovery logic are unchanged. (extensions/knowledge/src/maintenance.ts:261, 46abc3feae01)
  • Authority remains with existing owners: The service cron adapter checks its active capability at enqueue, while scheduled operator restoration validates the stored job and conversation incarnation before execution; scheduled tools retain current-authority checks. (src/gateway/cron-operator-source.ts:70, 46abc3feae01)
  • Prior findings resolved: Setup explicitly updates an incorrect session target and reads it back; the maintenance guide now includes a complete manual setup and recovery path independent of the unmerged UI. (extensions/knowledge/skills/shared/scribe-setup.md:67, 46abc3feae01)
  • Existing-state compatibility: Configuration changes are descriptions only, configured reviewJobId still takes precedence, and automation and vault formats remain unchanged; checkpoint notes use existing Knowledge page operations. (extensions/knowledge/src/stores-config.ts:22, 46abc3feae01)

Likely related people:

  • Josh Lehman: Raw commit 65ad180 adds extensions/knowledge/src/maintenance.ts:233 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 65ad18005286; files: extensions/knowledge/src/maintenance.ts)

PR surface

Source +26, Tests +68, Docs +372. Total +466 across 11 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 4 37 11 +26
Tests 1 68 0 +68
Docs 6 429 57 +372
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 534 68 +466

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P2: This is a useful, bounded improvement to optional Knowledge automation setup.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (3 earlier review cycles)
  • reviewed 2026-10-27T06:54:47.924Z sha c5a89ae :: blocked before merge. :: [P2] Use an explicit update to repair an existing job's session target | [P2] Document a setup and recovery path that exists in this build
  • reviewed 2026-10-27T08:17:19.377Z sha 46abc3f :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-27T08:32:23.703Z sha 46abc3f :: needs maintainer review before merge. :: none

Reviewed October 27, 2026, 4:37 AM ET / 08:37 UTC (Revision 4).

@jalehman

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Both P2 findings from the c5a89ae review are addressed on 46abc3feae0: setup/repair now remove same-key jobs owned by other conversations and retarget their own job with update (pause carried over, target read back), and the docs give a complete manual setup message plus repair/recovery instead of pointing at the unlanded Scribes tab. The PR body has live gateway proof on 1207fe12788 (the head differs only by a log-formatting line) covering wrong-owner cleanup with pause preservation, an ongoing conversations run including an archived session, the Memory import including DREAMS.md, and setup on a never-written vault. Data-model note: this PR changes no stored data shape; a configured maintenance.reviewJobId still takes precedence (unit-tested).

@clawsweeper

clawsweeper Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 27, 2026
@jalehman

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Added the requested negative controls to the PR body ("Negative controls" section), on the same isolated gateway: a non-owner isolated scheduled run carrying the scribe message was refused memory access before any Knowledge read or write, and the declared scribe job was refused by the scheduler's owner-authority check after its conversation was reset. The vault record count was unchanged across both.

@clawsweeper

clawsweeper Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. clawsweeper:intake:feature Preliminary submission classification; full source review pending. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Oct 27, 2026
@jalehman
jalehman merged commit 288d503 into main Oct 27, 2026
152 of 155 checks passed
@jalehman
jalehman deleted the openclaw-852.6/knowledge-scribe-skills branch October 27, 2026 08:40
@jalehman

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 28, 2026
…review scribe (openclaw#185583)

* feat(knowledge): self-scheduling scribe skills and review lookup by declaration key

* chore(knowledge): use a Set for scribe skill names

* docs(knowledge): weekly backstop for the review scribe

* fix(knowledge): scribes keep one job per key and skip the in-turn test run

* fix(knowledge): scribes retarget their own job, accept a new vault, and document manual setup

* fix(knowledge): report review lookup errors without a type assertion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. plugin: knowledge proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant