Skip to content

feat: implement LCM architecture follow-up (draft)#526

Closed
100yenadmin wants to merge 28 commits into
Martian-Engineering:mainfrom
electricsheephq:feat/lcm-ultimate-architecture
Closed

feat: implement LCM architecture follow-up (draft)#526
100yenadmin wants to merge 28 commits into
Martian-Engineering:mainfrom
electricsheephq:feat/lcm-ultimate-architecture

Conversation

@100yenadmin

@100yenadmin 100yenadmin commented Apr 28, 2026

Copy link
Copy Markdown
Collaborator

PR #526: Draft integration/oracle branch: reference only, not the merge vehicle

Maintainer Quick Read

Field Value
Stack position draft/reference
Logical parent for review main
Current head 3b4398007e96daf70203e74081b4789144c77e12
Current PR state Draft by design
Merge note Keep open as a comparison/oracle branch; do not merge by default.
Last body refresh 2026-05-02

Why Maintainers Should Care

This branch shows the broad architecture in one place, which is useful for comparison, but it is not the recommended production merge path. The decomposed PRs above are smaller, better hardened, and easier to review.

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["#526 broad integration branch"] --> B["Architecture/oracle reference"]
  B --> C["Compare against split PRs"]
  C --> D["#516 temporal"]
  C --> E["#517 observed work"]
  C --> F["#518 suggestion ledger"]
  C --> G["#537-#532 follow-up slices"]
  A -. "not default" .-> H["Do not merge unless maintainers choose mega-PR path"]
Loading

What Ships In This PR

  • a full-stack reference branch for reviewers
  • a comparison point for the decomposed PRs
  • historical context for the architecture split
  • a place to inspect the architecture as one combined change

What This PR Intentionally Does Not Do

  • not the production merge vehicle
  • not guaranteed to contain the newest split-PR hardening
  • not recommended for normal merge review

How An Agent Uses It

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

  • Split PRs are the review files; this draft spans the whole LCM architecture.

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 43 12297 44
Intended reviewer slice main 65 12373 2094

Logical slice breakdown:

Category Files Additions Deletions
runtime code 24 6460 927
tests 14 4068 1107
docs/release notes 25 1823 52
metadata/package 2 22 8

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.
  • This stays draft so maintainers do not accidentally merge the broad integration branch.
  • The split PRs contain the latest hardening and should be treated as the production path.
  • The branch remains useful as an oracle for architecture comparison.
  • No additional comments are needed to understand its role; the body is explicit.

Validation Evidence

  • GitHub test check: success
  • Kept draft/reference rather than restacked into production merge path

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

Copy link
Copy Markdown
Collaborator Author

Implementation follow-up status:

  • Head: e428eab
  • Local validation from /Volumes/LEXAR/repos/lossless-claw-upstream-pr518-20260429-041648:
    • npm test -- --run test/lcm-ultimate-architecture.test.ts passed
    • npm test -- --run test/rollup-store-builder.test.ts test/lcm-tools.test.ts passed
    • npm test passed (48 files, 839 tests)
    • npm run build passed
    • git diff --check passed
  • GitHub CI: test passed
  • GraphQL unresolved review threads: 0

Safety boundaries remain intact: observed-work extraction is deterministic, lcm_event_search is read-only, task suggestion tools are opt-in behind taskBridgeToolsEnabled / LCM_TASK_BRIDGE_TOOLS_ENABLED, and suggestion review only updates the LCM ledger with no external task writes.

@100yenadmin 100yenadmin marked this pull request as ready for review April 29, 2026 06:46
Copilot AI review requested due to automatic review settings April 29, 2026 06:46

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 the “LCM ultimate architecture” follow-up atop the temporal rollups + observed-work + inert task-bridge stack by adding deterministic extraction during maintain(), new read tools for observed work and event cues, and opt-in inert task-suggestion tooling with default source redaction.

Changes:

  • Add observed-work extraction + event observation extraction from new leaf summaries during engine maintenance, with per-conversation processing state.
  • Add new tools: lcm_work_density, lcm_event_search, opt-in lcm_task_suggestions/lcm_task_suggestion_review, plus config-gated lcm_rollup_debug.
  • Extend migrations, config surfaces, specs/docs, and tests to cover the new LCM read models and tool gating/redaction behavior.

Reviewed changes

Copilot reviewed 36 out of 36 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
test/task-bridge-suggestion-store.test.ts Adds suggestion-ledger store tests
test/plugin-prompt-hook.test.ts Updates recall-policy prompt expectations
test/observed-work-store.test.ts Adds observed-work store/tool tests
test/lcm-ultimate-architecture.test.ts End-to-end extraction/tool behavior tests
src/tools/lcm-work-density-tool.ts Implements lcm_work_density tool
src/tools/lcm-task-suggestions-tool.ts Implements inert suggestion/review tools
src/tools/lcm-rollup-debug-tool.ts Implements lcm_rollup_debug tool
src/tools/lcm-event-search-tool.ts Implements lcm_event_search tool
src/timezone-windows.ts Adds/extends timezone window helpers
src/store/task-bridge-suggestion-store.ts Adds suggestion ledger store
src/store/rollup-store.ts Adds rollup store helpers/queries
src/store/observed-work-store.ts Adds observed-work read model store
src/store/index.ts Exports new stores/types
src/store/event-observation-store.ts Adds event observation store
src/rollup-builder.ts Rollup build logic + state updates
src/plugin/index.ts Registers new tools + prompt text
src/observed-work-extractor.ts Deterministic leaf-summary extraction
src/engine.ts Wires stores/builders into engine + maintain()
src/db/migration.ts Adds rollup/observed-work/event/suggestion tables
src/db/config.ts Adds config toggles + env overrides
specs/lcm-ultimate-architecture-plan.md Adds canonical architecture spec
specs/lcm-temporal-memory-plan.md Updates temporal-memory plan/map
specs/lcm-task-bridge-option-c-experimental.md Updates task-bridge spec details
specs/lcm-observed-work-density-option-b.md Updates observed-work spec details
skills/lossless-claw/references/recall-tools.md Updates recall tool guidance
skills/lossless-claw/SKILL.md Updates skill guidance + routing
openclaw.plugin.json Adds config schema/labels for toggles
docs/configuration.md Documents rollup debug toggle
README.md Documents new env vars/toggles
.changeset/lcm-ultimate-architecture.md Changeset for architecture follow-up
.changeset/lcm-temporal-skill-docs.md Changeset for skill doc updates
.changeset/lcm-temporal-rollups.md Changeset for temporal rollups/tools
.changeset/lcm-task-bridge-suggestions.md Changeset for suggestion ledger
.changeset/lcm-observed-work-density.md Changeset for observed-work density

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

Comment thread src/tools/lcm-work-density-tool.ts
Comment thread src/store/task-bridge-suggestion-store.ts Outdated
Comment thread src/observed-work-extractor.ts Outdated
Comment thread src/observed-work-extractor.ts Outdated
Comment thread docs/configuration.md
Comment thread src/db/config.ts Outdated
@100yenadmin 100yenadmin changed the title feat: implement LCM ultimate architecture follow-up feat: implement LCM architecture follow-up Apr 29, 2026
@100yenadmin

Copy link
Copy Markdown
Collaborator Author

Completion / review-thread triage update for head 9e29aa056c12651bc9f8153d978369041f2f1166.

Implemented and verified in this slice:

  • Conservative observed-work extraction from leaf summaries, with rowid-based incremental cursoring so same-second summary inserts are not skipped.
  • Event observation scaffolding for primary/secondary/injected/echo/imported evidence.
  • Opt-in task suggestion ledger tools only; no OpenClaw task writes.
  • taskBridgeToolsEnabled documented and typed as a concrete boolean.
  • lcm_work_density topic schema wording now matches deterministic topic_key / title / rationale matching.
  • Suggestion re-records preserve reviewed status, review metadata, and original creator; regression test covers dismissed -> re-upsert -> still dismissed.
  • Bounded follow-up reads: lcm_work_density and task suggestions reject allConversations=true for now.
  • Rollup maintenance uses bounded daysBack based on last_rollup_check_at instead of fixed 30-day sweeps on every pending rebuild.
  • lcm_rollup_debug parses SQLite timestamps as UTC before formatting.

Review threads addressed and resolved: 6/6. No unresolved review threads remain.

Verification:

  • Local: npm test -> 48 files / 847 tests passed.
  • Local: npm run build -> passed.
  • Local: git diff --check -> passed.
  • GitHub CI: test passed.

Scope caveat: this remains LCM evidence/observation/suggestion infrastructure. It does not grant LCM task authority, does not write Cortex/OpenClaw tasks, and keeps exact proof routed through source drilldown.

@100yenadmin

Copy link
Copy Markdown
Collaborator Author

Decomposition status update: this PR is now intentionally a draft/reference branch, not the merge candidate.

The over-broad integration work has been split into reviewable follow-up slices:

The current merge path remains #516 -> #517 -> #518, then the narrow follow-ups above. The old #526 branch stays useful as an integration/reference artifact but should not be merged as-is.

Latest cleanup applied across the split stack:

@100yenadmin

Copy link
Copy Markdown
Collaborator Author

Final adversarial pass - keep draft/reference

Score: mergeability 6.5/10 as a production PR, functionality 8.3/10 as an integration oracle, description 9.8/10.

Functionality audit: This branch is green and useful as an end-to-end architecture/reference branch. It now includes the same key hardening from the split stack: temporal aggregate fix, event-extraction atomicity, source caps, preserved-reviewed task suggestion accounting, deterministic date-window tests, and ultimate-architecture topic-key alignment.

Scenario coverage: Demonstrates the full intended architecture in one place: temporal recap, observed-work extraction, event search, task suggestions, topic matching, and maintenance wiring.

Final state: MERGEABLE, GitHub test pass, GraphQL review threads: 0 unresolved, but still draft by design. Local focused suite plus ultimate-architecture tests, full npm test, npm run build, and git diff --check passed on head c191929.

Recommendation: Do not merge #526 by default. Keep it as a draft/reference/oracle branch and land the decomposed production path: #516 -> #517 -> #518 -> #537 -> #538 -> #539 -> #540 -> #530 -> #531 -> #532.

@100yenadmin

Copy link
Copy Markdown
Collaborator Author

Final May 1 hardening/status update:

  • Merge order: draft/reference — Integration/oracle branch
  • Head: c191929
  • Review state: 0 unresolved GraphQL review threads after the latest push
  • GitHub state: MERGEABLE / CLEAN, test check green
  • Validation: GitHub CI green; not the merge vehicle
  • Score: Reference only, not scored as production merge path
  • Note: Keep draft. The decomposed PRs now carry newer hardening; use feat: implement LCM architecture follow-up (draft) #526 for comparison/architecture traceability, not default merge.

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.

@100yenadmin 100yenadmin changed the title feat: implement LCM architecture follow-up feat: implement LCM architecture follow-up (draft) 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