Skip to content

chore: add ai harness rules#1843

Open
CarltonXiang wants to merge 17 commits into
mainfrom
dev-20260604-v2.0.19
Open

chore: add ai harness rules#1843
CarltonXiang wants to merge 17 commits into
mainfrom
dev-20260604-v2.0.19

Conversation

@CarltonXiang
Copy link
Copy Markdown
Collaborator

Description

Please include a summary of the change, the problem it solves, the implementation approach, and relevant context. List any dependencies required for this change.

Related Issue (Required): Fixes #issue_number

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (does not change functionality, e.g. code style improvements, linting)
  • Documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Unit Test
  • Test Script Or Test Steps (please provide)
  • Pipeline Automated API Test (please provide)

Checklist

  • I have performed a self-review of my own code | 我已自行检查了自己的代码
  • I have commented my code in hard-to-understand areas | 我已在难以理解的地方对代码进行了注释
  • I have added tests that prove my fix is effective or that my feature works | 我已添加测试以证明我的修复有效或功能正常
  • I have created related documentation issue/PR in MemOS-Docs (if applicable) | 我已在 MemOS-Docs 中创建了相关的文档 issue/PR(如果适用)
  • I have linked the issue to this PR (if applicable) | 我已将 issue 链接到此 PR(如果适用)
  • I have mentioned the person who will review this PR | 我已提及将审查此 PR 的人

Reviewer Checklist

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Made sure Checks passed
  • Tests have been provided

harvey_xiang and others added 17 commits May 29, 2026 16:56
Co-authored-by: harvey_xiang <harvey_xiang22@163.com>
…1861)

* fix: respect autoInstall=false by removing install_recommended bypass

When skillEvolution.autoInstall is set to false, the install_recommended
path in autoInstallIfNeeded() was still triggering automatic installation.
This fix ensures autoInstall=false completely disables all auto-install
behavior.

Closes #1398

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat: add harness (#1836)

Co-authored-by: harvey_xiang <harvey_xiang22@163.com>

* chore: update gitignore

* fix: respect autoInstall: false config in all auto-install paths

- Remove install_recommended bypass that ignored autoInstall config
- Consolidate logic: check autoInstall once at method entry
- Add unit tests verifying autoInstall: false blocks all installations

Fixes #1398

* fix: respect autoInstall=false config in skill evolution

- Fix autoInstallIfNeeded to skip ALL auto-installation when autoInstall=false
- Previously install_recommended path bypassed autoInstall config check
- Add comprehensive test coverage for autoInstall behavior (false/true/default)
- Closes #1398

---------

Co-authored-by: jiachengzhen <jiacz@memtensor.cn>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: HarveyXiang <harvey_xiang@163.com>
Co-authored-by: harvey_xiang <harvey_xiang22@163.com>
Co-authored-by: MemOS AutoDev <autodev@memos.dev>
…in Viewer UI (#1865)

* fix(memos-local-plugin): guard OpenClaw runtime startup

* fix:The failed task was wrongly recorded as a "successful experience".

* fix(openclaw): correct Alibaba Bailian endpoint default in Viewer UI

Change incorrect endpoint from https://dashscope.aliyuncs.com/compatible-mode/v1
to correct endpoint https://coding.dashscope.aliyuncs.com/v1 in both
packages/memos-core and apps/memos-local-openclaw viewer files.

Fixes #1489

---------

Co-authored-by: jiang <fdjzy@qq.com>
Co-authored-by: Jiang <33757498+hijzy@users.noreply.github.com>
Co-authored-by: 黑布林 <11641432+heiheiyouyou@user.noreply.gitee.com>
Co-authored-by: Dubberman <48425266+whipser030@users.noreply.github.com>
Co-authored-by: AutoDev Agent <autodev@memtensor.com>
…started outside Python (#1866)

* fix(memos-local-plugin): guard OpenClaw runtime startup

* fix:The failed task was wrongly recorded as a "successful experience".

* fix: add --home CLI flag for Docker deployment config path

- Add --home parameter to bridge.cts for explicit config directory
- Enhance config missing warning with remediation steps and docs link
- Log config warnings during bootstrap
- Add comprehensive Docker deployment documentation
- Update README with configuration and troubleshooting guides

Fixes #1520

---------

Co-authored-by: jiang <fdjzy@qq.com>
Co-authored-by: Jiang <33757498+hijzy@users.noreply.github.com>
Co-authored-by: 黑布林 <11641432+heiheiyouyou@user.noreply.gitee.com>
Co-authored-by: Dubberman <48425266+whipser030@users.noreply.github.com>
Co-authored-by: MemOS AutoDev <autodev@memos.dev>
…ort — skipped traces s (#1870)

fix: exclude short traces from embedding maintenance stats

- Add shouldTraceHaveEmbeddings() helper to filter traces with insufficient content
- Skip traces where both user_text and agent_text are under 10 chars
- Skip traces where total combined length is under 20 chars
- Fixes misleading 'missing' count after bulk import (issue #1746)
- Applies filter consistently to stats computation and repair operations

Co-authored-by: AutoDev Agent <autodev@memtensor.com>
…tored as user chunks (#1879)

fix: prevent system messages from being stored as user memory chunks

- System messages (including internal review prompts) were incorrectly
  stored as LongTermMemory chunks, polluting user's retrievable memory
- Modified SystemParser.parse_fast() to return empty list for
  non-tool-schema system messages
- Tool schema handling remains unchanged (stored as ToolSchemaMemory)
- Added comprehensive test coverage for system message handling

Fixes #1518

Co-authored-by: MemOS AutoDev <autodev@memos.ai>
docs(memos-local-plugin): clarify install path and stale dir names (#1540)

The README's 'Quick start' section told users to use install.sh instead
of npm install, but the warning was buried and users still tried
'npm install -g @memtensor/memos-local-plugin' first. The reporter in
#1540 encountered this on a Hermes deployment.

This change:

- Promotes the 'do not run npm install -g' notice to a prominent
  IMPORTANT callout explaining why global install is wrong (no
  agent-home deploy, no config.yaml, no bridge/viewer) and that the
  tarball intentionally ships built artifacts only.
- Adds a Troubleshooting subsection covering the two specific symptoms
  in the bug report: the 'package not found' misread, and the stale
  web/ and site/ directory names (web/ is now viewer/, site/ was
  removed by commit 26e7e3d).
- Mentions install.ps1 for Windows alongside install.sh.
- CHANGELOG: record the docs fix and reference #1540.

Documentation-only change; no code or runtime behavior touched.

Co-authored-by: MemOS AutoDev <autodev@memtensor.ai>
#1877)

fix: increase trace pagination limit from 500 to 10,000

Fixes #1593 - Web UI memory count stuck at 500

Root cause: Multiple layers enforced a 500-item hard cap on trace queries,
preventing accurate metrics calculation when trace count exceeded 500.

Changes:
- apps/memos-local-plugin/core/storage/repos/_helpers.ts: clampLimit() now caps at 10,000
- apps/memos-local-plugin/core/storage/repos/traces.ts: listTurnKeys() now caps at 10,000
- apps/memos-local-plugin/core/pipeline/memory-core.ts: listTraces() now caps at 10,000

The metrics() function requests 10,000 traces to calculate sessions, embeddings,
writesToday, and dailyWrites statistics. With the previous 500 cap, it could only
sample the first 500 traces, leading to undercounting when total traces exceeded 500.

Impact:
- Default pagination limit (50) unchanged
- High-limit requests (e.g., metrics calculation) can now fetch up to 10,000 items
- Existing indexes on ts and (episode_id, turn_id) support efficient 10K queries
- Backward compatible with all existing API clients

Co-authored-by: AutoDev Bot <autodev@memtensor.ai>
…er called in QClaw des (#1880)

fix(memos-local-openclaw): connect to Hub on plugin load (QClaw desktop)

The QClaw desktop app loads this plugin without calling service.start(),
which used to mean connectToHub() inside startServiceCore() never ran.
The Hub Server saw zero incoming connections from QClaw users and team
sharing was completely non-functional, even though local memory worked.

Split the client-side Hub connection out of startServiceCore() into a
small idempotent helper and fire it eagerly at the end of register(),
independent of the host's service lifecycle. The gateway CLI path still
calls it via service.start() and the guard prevents a duplicate attempt.

Fixes #1612

Cherry-picked from commit a645ddd

Co-authored-by: MemOS AutoDev <autodev@memtensor.local>
…id semantics (#1876)

feat: expose cube creation in HTTP API + clarify mem_cube_id semantics

- Add CreateCubeRequest/Response models for cube creation
- Add RegisterCubeRequest/Response models for cube registration
- Create CubeHandler with create_cube() and register_cube() methods
- Add POST /product/create_cube endpoint
- Add POST /product/register_cube endpoint
- Update API documentation to clarify cube_id vs mem_cube_id equivalence
- Add integration tests in tests/api/test_cube_endpoints.py
- All code passes Ruff linting

Closes #1681

Co-authored-by: MemOS AutoDev <autodev@memos.ai>
…gin on Node 25 (#1875)

fix: upgrade better-sqlite3 to 12.10.0 for Node.js 25 support

- Upgrade better-sqlite3 from 12.6.3 to 12.10.0 in memos-local-plugin
- Upgrade better-sqlite3 from 12.6.3 to 12.10.0 in memos-local-openclaw
- Remove Node.js <25.0.0 constraint from memos-local-openclaw engines

better-sqlite3 12.10.0 includes prebuilt native binaries for Node.js 25,
resolving ABI mismatch errors on the latest Node.js version.

Fixes #1734

Co-authored-by: MemOS AutoDev <autodev@memtensor.com>
…pisodes never scored (#1872)

fix: include abandoned episodes in reward pipeline and add periodic rescore

- Add closeReason === 'abandoned' to episodeRewardIsDirty() check
- Add 10-minute periodic timer in init() to rescore dirty episodes
- Timer uses unref() to prevent blocking shutdown
- Fixes #1782: 98% of closed episodes were skipped (219 of 224 had closeReason: 'abandoned')

Before: Only 7 episodes scored on bootstrap (stale open episodes)
After: All 219 abandoned episodes eligible for scoring

Co-authored-by: AutoDev Bot <autodev@memtensor.com>
…00% CPU on databases > (#1871)

fix(memos-local-plugin): avoid bootstrap hang on large databases (#1787)

The `namespace-visibility` migration was issuing a blanket
`UPDATE ${table} SET share_scope='private' WHERE share_scope IS NULL`
against every owner-aware table — including the `traces` table, which
on busy installs is the largest, fattest table in the database. On
databases past ~500 MB, that UPDATE held the synchronous bootstrap
transaction in CPU-bound row rewriting (re-validating the JSON CHECK
constraints on every row) for many minutes and never reached
`migrations.summary`, manifesting as the regression filed in #1787:
bridge process burns 80–157 % CPU after `sqlite.open` and never
becomes healthy.

The read path already normalises NULL share_scope to 'private' via
`normalizeShareScope` and `COALESCE(share_scope, 'private')` in
`visibilityWhere`, and new rows pick up the column DEFAULT, so the
bulk UPDATE was cosmetic. Dropping it removes the bootstrap-time row
rewrite entirely.

The same issue also showed up in `memory-core.init()`'s startup
"dirty-closed-episode" scan, which called
`getManyByIds(traceIds).some(tr => tr.ts > scoredAt)` — hydrating
every column of every trace (embedding BLOBs, full `tool_calls_json`,
agent text) into Node memory just to inspect a single number for up
to 500 episodes. Replaced with a new
`traces.hasAnyNewerThan(ids, ts)` helper that issues a single
`SELECT 1 ... LIMIT 1` per chunk.

Tests:
- Added a regression test in `tests/unit/storage/migrator.test.ts`
  that pre-seeds rows with NULL `share_scope` and asserts they stay
  NULL after migration 007 (would flip back to 'private' if the bulk
  UPDATE returned).
- Added coverage for `traces.hasAnyNewerThan` in
  `tests/unit/storage/repos.test.ts`.

Fixes #1787

Co-authored-by: MemOS AutoDev <autodev@memtensor.cn>
… (false positive) (#1874)

fix: openclaw doctor reports false positive DuplicateOpenClawRuntimeError

Add diagnostic mode detection to skip runtime lock acquisition when
openclaw doctor is running alongside the gateway.

Changes:
- Add skipLock parameter to AcquireOpenClawRuntimeLockOptions
- Modify acquireOpenClawRuntimeLock to return no-op lock when skipLock=true
- Add isDiagnosticMode() helper checking OPENCLAW_DIAGNOSTIC_MODE env var and process args
- Update register() to detect diagnostic mode and skip lock acquisition
- Add unit tests for diagnostic mode skipLock behavior
- Add integration test verifying doctor can run alongside gateway

Fixes #1873

Co-authored-by: AutoDev Bot <autodev@memtensor.ai>
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