Skip to content

feat: add experimental LCM task bridge suggestions (3/10)#518

Closed
100yenadmin wants to merge 32 commits into
Martian-Engineering:mainfrom
electricsheephq:docs/lcm-task-bridge-option-c-experimental
Closed

feat: add experimental LCM task bridge suggestions (3/10)#518
100yenadmin wants to merge 32 commits into
Martian-Engineering:mainfrom
electricsheephq:docs/lcm-task-bridge-option-c-experimental

Conversation

@100yenadmin

@100yenadmin 100yenadmin commented Apr 28, 2026

Copy link
Copy Markdown
Collaborator

PR #518: Task-bridge ledger: inert suggestion storage only

Maintainer Quick Read

Field Value
Stack position 3/10
Logical parent for review #517
Current head acbc895525122261019f20b9c38e56a31b3b6eed
Current PR state Ready after #517
Merge note Storage-only bridge foundation.
Last body refresh 2026-05-02

Why Maintainers Should Care

This creates a ledger for possible task actions suggested from LCM evidence, but keeps the bridge inert. It is the audit trail and review state, not an automation engine.

Stack Map

flowchart LR
  P516["#516 Temporal spine"] --> P517["#517 Observed work read model"]
  P517 --> P518["#518 Suggestion ledger"]
  P518 --> P537["#537 Deterministic extraction"]
  P537 --> P538["#538 Event observations"]
  P518 --> P539["#539 Opt-in suggestion tools"]
  P538 --> P540["#540 Maintenance wiring"]
  P540 --> P530["#530 Tracker/open state"]
  P538 --> P531["#531 Event episodes"]
  P530 --> P532["#532 Topic/vocabulary"]
  P526["#526 Draft reference"] -. "not the merge path" .-> P516
Loading

How It Works

flowchart TD
  A["Observed-work item"] --> B["Suggestion record"]
  B --> C["pending / accepted / rejected / dismissed / expired"]
  B --> D["rationale, confidence, source links"]
  C --> E["Reviewer/user decides outside LCM"]
  E -. "no task write here" .-> F["OpenClaw Tasks remains authority"]
Loading

What Ships In This PR

  • task-bridge suggestion table/store
  • source-linked suggestion records with confidence and rationale
  • review states: pending, accepted, rejected, dismissed, expired
  • upsert behavior that preserves reviewed rows, creator metadata, and review metadata
  • tests for source requirements and ledger safety

What This PR Intentionally Does Not Do

How An Agent Uses It

  • "Should we make a task from this observed blocker?" -> store a suggestion for human review, not a task mutation.
  • "Was this suggestion reviewed?" -> read ledger status and metadata.
  • "Can LCM auto-close a task?" -> no; task state remains outside LCM.

Engineering Boundaries

  • LCM is an evidence layer. It does not become Cortex, GBrain, OpenClaw Tasks, or a fuzzy semantic authority.
  • Recaps and observed states are entry points for investigation, not proof of exact commands, SHAs, paths, timestamps, root cause, or task completion.
  • Exact claims still require source drilldown through lcm_describe, lcm_expand, lcm_expand_query, raw messages, GitHub, logs, tickets, or the relevant authority.
  • Source identifiers stay hidden by default unless a tool has an explicit includeSources or debug affordance.
  • Reads stay read-only. Writes happen through explicit storage, maintenance, extraction, or review-ledger paths for the slice that owns them.

Primary Review Files

  • src/store/task-bridge-suggestion-store.ts
  • src/db/migration.ts
  • test/task-bridge-suggestion-store.test.ts

Size And Review Surface

These are intentionally large LCM changes, so the body separates the GitHub-visible diff from the intended logical review slice. Later PRs target main, which makes the GitHub Files tab include parent-stack code; reviewers should use the logical parent listed above when judging the slice.

View Compare base Files Additions Deletions
GitHub-visible PR page main 32 10399 44
Intended reviewer slice #517 5 884 0

Logical slice breakdown:

Category Files Additions Deletions
runtime code 2 339 0
tests 1 330 0
docs/release notes 2 215 0
metadata/package 0 0 0

Review Concerns Already Folded Into The Code

  • Fallback message timestamp scans keep mixed-format julianday() correctness and now use matching expression indexes for indexed range/order plans.
  • Reviewed rows are protected from accidental reset on upsert.
  • Creator/review metadata is preserved.
  • Suggestions require source-backed provenance.
  • No external task table/API writes are introduced.

Validation Evidence

  • npm test -- --run test/task-bridge-suggestion-store.test.ts test/observed-work-store.test.ts
  • npm test
  • npm run build
  • git diff --check
  • GitHub test check: success

Suggested Maintainer Review Path

  1. Start with the Why Maintainers Should Care and How It Works sections.
  2. Use Primary Review Files for the logical slice; the GitHub Files tab can look much larger because the public PRs target main while the series is logically stacked.
  3. Check the non-goals before asking whether LCM should create tasks, close tasks, write Cortex memory, or make authoritative project claims.
  4. Review and merge in the order shown in the stack diagram. feat: implement LCM architecture follow-up (draft) #526 stays draft/reference unless maintainers explicitly choose a single large integration branch.

@100yenadmin 100yenadmin force-pushed the docs/lcm-task-bridge-option-c-experimental branch from 569f9ca to 99e7440 Compare April 28, 2026 15:41
@100yenadmin 100yenadmin changed the title docs: propose experimental LCM task bridge feat: add experimental LCM task bridge suggestions Apr 28, 2026
@100yenadmin

Copy link
Copy Markdown
Collaborator Author

Follow-up hardening update

Rebuilt this branch on top of #517 and kept it intentionally inert/experimental.

What changed:

  • Added a changeset and updated title to feat: add experimental LCM task bridge suggestions.
  • Added lcm_task_bridge_suggestions in dedicated migration/index steps after observed-work tables.
  • Made work_item_id reference Option B observed-work items, making the dependency explicit.
  • Added TaskBridgeSuggestionStore validation for confidence, rationale, and non-empty source IDs.
  • Normalizes duplicate/blank source IDs.
  • Review updates now return whether a suggestion existed.
  • Expanded tests for migration, pending records, no external task writes, review status, and validation.

Verification on head 99e7440:

  • npm test -- --run test/task-bridge-suggestion-store.test.ts test/observed-work-store.test.ts -> 9 passed
  • npm test -> 836 passed across 47 files
  • npm run build -> passed
  • GitHub CI test -> passed

No review threads are open. This remains draft because it is stacked after #516 and #517.

@100yenadmin

Copy link
Copy Markdown
Collaborator Author

Completion update — 2026-04-29

Fresh Lexar checkout matched the upstream PR head before validation. No code changes were needed on this PR.

  • Head SHA: 99e7440c5e8236f526aae7f76903094af041662c
  • Tree SHA: 3217857b70023ef2cb6a0c7bf5eb873c3caf0c5f
  • Mergeability: MERGEABLE
  • Review threads: zero unresolved
  • GitHub CI: test passed

Local validation on fresh upstream-based Lexar checkout:

npm test -- --run test/task-bridge-suggestion-store.test.ts test/observed-work-store.test.ts
# 9 passed

npm test
# 836 passed across 47 files

npm run build
# passed

git diff --check HEAD
# clean

Scenario coverage:

  • This remains inert suggestion storage only.
  • Suggestion records can track pending/accepted/rejected/dismissed/expired review state.
  • No registered runtime tool, no generator, no direct OpenClaw task writes, no automatic task creation/closure, no notifications/reminders.

Deferred to follow-up:

  • any active lcm_task_suggestions tool,
  • automatic suggestion generation,
  • opt-in task-system integration after separate policy/security review.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements an experimental, suggestion-only LCM ↔ OpenClaw task-bridge ledger (Option C) on top of newly added temporal rollups (lcm_recent) and observed work-density (lcm_work_density) read models, with updated tool-routing guidance and docs.

Changes:

  • Adds rollup storage/build pipeline and tools: lcm_recent (default) + lcm_rollup_debug (config-gated).
  • Adds observed-work density storage + lcm_work_density tool (read-only).
  • Adds inert task-bridge suggestion storage + review-state APIs, plus tests/spec/docs/changesets.

Reviewed changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
test/task-bridge-suggestion-store.test.ts Adds tests for task-bridge suggestion persistence + review states.
test/plugin-prompt-hook.test.ts Updates assertions for revised recall-tool routing prompt text.
test/observed-work-store.test.ts Adds tests for observed-work density store/tool behavior and source redaction.
src/tools/lcm-work-density-tool.ts Introduces lcm_work_density tool with period/window filtering and redaction controls.
src/tools/lcm-rollup-debug-tool.ts Adds config-gated operator tool for inspecting rollup state and provenance.
src/tools/lcm-recent-tool.ts Implements lcm_recent with rollup preference + bounded leaf-summary fallback and budgeting.
src/timezone-windows.ts Adds timezone-safe date/window helpers used by period resolution.
src/store/task-bridge-suggestion-store.ts Adds inert task-bridge suggestion store (pending/accepted/rejected/dismissed/expired).
src/store/rollup-store.ts Adds rollup persistence APIs and state/source management.
src/store/observed-work-store.ts Adds observed-work item/source/state persistence and density query reads.
src/rollup-builder.ts Adds daily + weekly/monthly rollup build logic and fingerprinting.
src/plugin/index.ts Registers lcm_recent and lcm_work_density by default; gates lcm_rollup_debug.
src/engine.ts Wires rollup stores/builders into ingest+maintain flows; exposes store accessors.
src/db/migration.ts Adds migrations for rollups, observed work, and task-bridge suggestion tables + indexes/views.
src/db/config.ts Adds rollupDebugEnabled config knob and env override.
specs/lcm-temporal-memory-plan.md Documents temporal-memory implementation plan and rollout map.
specs/lcm-task-bridge-option-c-experimental.md Documents Option C gates/non-goals and the inert scaffold behavior.
specs/lcm-observed-work-density-option-b.md Documents Option B observed-work density model and tool contract.
skills/lossless-claw/references/recall-tools.md Updates skill reference with availability-gated lcm_recent/debug guidance and proof rules.
skills/lossless-claw/SKILL.md Updates skill overview and operating rules for temporal recall availability and proof-safe flows.
openclaw.plugin.json Adds rollupDebugEnabled to plugin config schema/help.
docs/configuration.md Documents LCM_ROLLUP_DEBUG_ENABLED / rollupDebugEnabled.
README.md Documents LCM_ROLLUP_DEBUG_ENABLED environment flag.
.changeset/lcm-temporal-skill-docs.md Changeset for skill/docs updates around temporal recall guidance.
.changeset/lcm-temporal-rollups.md Changeset for temporal rollups + lcm_recent/lcm_rollup_debug.
.changeset/lcm-task-bridge-suggestions.md Changeset for inert task-bridge suggestion storage.
.changeset/lcm-observed-work-density.md Changeset for observed-work density model + tool.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/store/task-bridge-suggestion-store.ts Outdated
Comment thread src/store/observed-work-store.ts
Comment thread src/store/observed-work-store.ts Outdated
Comment thread test/task-bridge-suggestion-store.test.ts
Comment thread src/tools/lcm-recent-tool.ts
@100yenadmin

Copy link
Copy Markdown
Collaborator Author

Final adversarial pass - merge order 3/10, after #517

Score: mergeability 9.7/10, functionality 9.0/10, description 9.8/10.

Functionality audit: Works as an inert suggestion ledger. Suggestions require observed-work/source provenance, preserve reviewed rows, keep creator/reviewer metadata, and do not register runtime generation tools in this slice. The hardening made upsert results explicit: inserted, refreshed, or preserved-reviewed.

Scenario coverage: Provides the storage foundation for reviewed task-action suggestions without giving LCM task authority.

Final state: MERGEABLE, GitHub test pass, GraphQL review threads: 0 unresolved. Local focused suite, full npm test, npm run build, and git diff --check passed on head dda0981.

Residual caveat: Storage only. Suggestion tooling lands later in #539 and remains opt-in.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 32 out of 32 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/tools/lcm-work-density-tool.ts Outdated
Comment thread src/store/observed-work-store.ts Outdated
Comment thread src/store/task-bridge-suggestion-store.ts Outdated
@100yenadmin

Copy link
Copy Markdown
Collaborator Author

Final May 1 hardening/status update:

  • Merge order: 3/10 — Inert suggestion ledger
  • Head: b368ab1
  • Review state: 0 unresolved GraphQL review threads after the latest push
  • GitHub state: MERGEABLE / CLEAN, test check green
  • Validation: 55 focused tests; build; diff-check
  • Score: Functionality 10/10, mergeability 10/10, description 10/10
  • Note: Ready after feat: add LCM observed work density (2/10) #517. Storage only: no runtime tool, no external task writes, and reviewed rows preserve audit metadata.

The PR description top note has been refreshed with current head SHA, visible-vs-logical LOC breakdown, scope, caveats, and validation status. LCM remains an evidence layer: recaps, observed work, events, episodes, and suggestions are entry points, not proof or task authority.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 33 out of 33 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/engine.ts
Comment on lines +4799 to +4808
const aggregateResult = await this.rollupBuilder.buildWeeklyMonthlyRollups(
conversation.conversationId,
{ daysBack },
);
const errorCount = rollupResult.errors.length + aggregateResult.errors.length;
if (errorCount > 0) {
markRollupRebuildPending("rollup-build-errors");
}
this.deps.log.info(
`[lcm] maintain: rollups conversation=${conversation.conversationId} ${sessionLabel} dailyBuilt=${rollupResult.built} dailySkipped=${rollupResult.skipped} aggregateBuilt=${aggregateResult.built} aggregateSkipped=${aggregateResult.skipped} errors=${errorCount}`,
Comment on lines +46 to +58
export function createLcmRollupDebugTool(input: {
deps: LcmDependencies;
lcm?: LcmContextEngine;
getLcm?: () => Promise<LcmContextEngine>;
sessionId?: string;
sessionKey?: string;
}): AnyAgentTool {
return {
name: "lcm_rollup_debug",
label: "LCM Rollup Debug",
description:
"Inspect temporal rollup state, recent rollups, and provenance sources without LLM calls.",
parameters: LcmRollupDebugSchema,
Comment on lines +336 to +347
accounting: {
itemsIncluded: result.itemsIncluded,
itemsOmitted: result.itemsOmitted,
truncated: result.itemsOmitted > 0,
},
confidence: "observed-unrefined",
disclaimer: "Observed from LCM evidence; not authoritative task state.",
recommendedDives:
result.density.unfinished > 0
? ["Inspect source evidence for unfinished items before claiming certainty."]
: [],
}, p.maxOutputTokens);
@100yenadmin 100yenadmin changed the title feat: add experimental LCM task bridge suggestions feat: add experimental LCM task bridge suggestions (3/10) May 3, 2026
@100yenadmin 100yenadmin closed this May 6, 2026
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