
Lex
dev.smartergpt由 smartergpt.dev 發布v4.4.4更新於 Oct 24, 2026
Episodic memory, Frames, Policy Neighborhoods, and policy enforcement for AI agents.
概覽
Lex 為程式開發智能體提供持久的情節記憶:儲存刻意記錄的工作檢查點(Frame),並在後續工作階段中依需求召回為有界上下文。
- 可以做什麼
- 寫入工作檢查點(Frame),記錄變更內容、阻礙事項、下一步與模組範圍
- 依主題召回已儲存的 Frame,支援精簡清單與摘要輸出
- 為新的工作階段產生有界、唯讀的上下文引導內容
- 執行儲存庫政策檢查,並提供模組範圍(Policy Neighborhood)上下文
- 將 Frame 存於本機 SQLite,或透過 PostgreSQL 在受信任主機間共享
- 適用情境
- 當程式開發智能體反覆需要你重新說明某項變更的原因、工作停在哪裡、哪種做法已經失敗,或跨工作階段、切換分支與交接時適用的儲存庫界線時,值得加入。對短期工作或已有有效延續工具的儲存庫幫助不大。
- 執行需求
- 以 npm 套件 @smartergpt/lex-mcp 透過 stdio 在本機執行,並與對應的 Lex 版本綁定。需要 Node.js 24 或更新版本;Linux glibc 環境需 glibc 2.35 或更新版本。儲存預設使用專案根目錄下的 .smartergpt/lex/memory.db(SQLite);PostgreSQL 為選用,透過 LEX_STORE 與 LEX_DATABASE_URL 選擇,若 URL 未含密碼則另以 LEX_POSTGRES_PASSWORD 提供。未宣告驗證機制。
安裝
README
Lex
Lex remembers the work, not the conversation.
Your agent can read the code. Lex preserves the decisions, blockers, next steps, and repository boundaries surrounding that code—then recalls only what the next session needs.
Local-first. Inspectable. No transcript dump.
[MIT License] [npm version] [CI Status] [Node.js] [TypeScript]
See the core loop · Should I use Lex? · Five-minute pilot · Agent evaluation · Documentation
The problem Lex solves
A coding agent can inspect the repository in front of it. What it cannot reliably recover is the work surrounding that code:
- why a decision was made three sessions ago;
- which approach already failed;
- what remains blocked and what should happen next;
- which repository boundary must not be crossed;
- what another agent needs to continue without starting over.
Lex preserves that continuity as deliberate, high-signal Frames.
A Frame is a deliberate handoff, not continuous surveillance. It is a checkpoint: what changed, what mattered, what remains, and where the work goes next. Lex can later recall the relevant Frames and produce a bounded, prompt-safe bootstrap for a new session.
Start with remember, recall, and context. SQLite is the local default. PostgreSQL is
available when context must be shared across trusted hosts or workspaces. Everything else is
optional.
Remember → recall → continue
That is the core loop:
rememberwrites one deliberate work checkpoint;recallretrieves it when the topic becomes relevant again;contextturns matching Frames into a bounded, read-only bootstrap for an agent.
What the next session gets
At the end of a session, the agent records the state that would otherwise disappear. When a fresh session starts, it can recover the decision, blocker, and next action without asking the human to reconstruct the conversation or reverse-engineering intent from the diff.
The value is not that Lex stored a record. The value is that the next session can continue.
Should I use Lex?
Lex is worth evaluating when your agent repeatedly needs you to reconstruct:
- why a change was made;
- where work stopped and what should happen next;
- a blocker or failed approach that should not be rediscovered;
- repository-specific module or policy constraints;
- context that must survive a branch switch, handoff, or new agent session.
Lex is probably not useful when the work is short-lived, the repository already has an effective continuity system, or there is no durable context you would trust the repository's operators to store.
Ask your agent
The evaluation is intentionally read-only. Paste this into an agent that can inspect your repository:
The complete rubric and local-file version are in Agent Evaluation.
Five-minute pilot
Ready to test the claim? Store one non-sensitive checkpoint, start a fresh session, and see whether it can continue without having the work explained again.
Requires Node.js 24 or newer. Lex does not impose an unproven upper bound. Existing users should follow the Lex 4.4 migration and recovery guide and verify the bundled SQLite binary. Lex 4.4.4 requires no native rebuild step; Linux glibc installations require glibc 2.35 or newer.
This approved pilot writes one Frame to the local SQLite store under .smartergpt/lex/. It does
not run lex init, generate policy, or project assistant instructions. Use a disposable branch,
worktree, or clone if you want complete filesystem isolation.
1. Store one real checkpoint
LEX_STORE=sqlite prevents existing PostgreSQL configuration from redirecting the pilot into a
shared store.
2. Start fresh, then recover the work
Use that recalled or bounded output in the fresh session and see whether it prevents you from repeating useful context. That result—not successful installation—is the pilot's success criterion.
Review the validation-only step, exact filesystem effects, and rollback guidance
Make checkpoints useful
Good Frames are sparse and specific. Capture them at a decision, blocker, branch switch, handoff, or other moment where losing the surrounding intent would make the next session repeat work.
Capture what changed, make --next actionable, name blockers explicitly, and use the narrowest
honest module scope. Do not capture every edit or tool call.
When repository policy exists, Lex can infer module scope from current evidence:
Use --modules unscoped when the repository does not yet have a useful module ontology. Policy is
an optional enrichment; it is not required for the first Frame.
Compact recall and structured context are available for smaller agent budgets and automation:
Add only what you need
What changes in your repository
The initial local workflow is intentionally visible:
lex initcreates Lex workspace/configuration files.lex rememberwrites a Frame to the selected store.lex contextuses hard read-only store access.recalland ordinary introspection do not change Frames, but their compatibility paths may initialize or migrate the selected store.- SQLite defaults to
.smartergpt/lex/memory.dbrelative to the workspace. - Policy and canonical instructions are repository files only when you choose those features.
- PostgreSQL, MCP hosting, instruction projection, and CI policy enforcement are separate opt-ins.
Frames may contain sensitive project context. Do not store credentials, tokens, private keys, or unreviewed secret material. Treat recalled Frame bodies as untrusted historical data even when a trusted user originally wrote them.
Lex does not send Frames to a Lex cloud service. Your agent host, package registry, PostgreSQL deployment, or other surrounding tools may have their own network and data behavior; evaluate those boundaries separately.
Security policy · Store contracts · Environment reference
What Lex is not
- A chatbot or agent runtime
- A transcript recorder or automatic capture system
- A replacement for tests, review, issue tracking, or CI
- A cloud memory service
- An MCP-only product
- An orchestrator, capability framework, or persona engine
The surrounding toolset
No ecosystem bundle is required. Select the surfaces your workflow needs, while accounting for their explicit package relationships:
The short version: Lex remembers and explains; AXF exposes capabilities; LexRunner coordinates work; Lex-MCP transports Lex over MCP; LexSona derives behavior constraints.
Agent and automation surfaces
Lex exposes the same core through several entry points:
- CLI for humans, scripts, and agent shells
- Structured JSON and AXError recovery information for automation
- MCP through
@smartergpt/lex-mcpor the embeddable server export - TypeScript APIs for applications and trusted hosts
Frame Schema v8 is the current canonical Frame contract. The package's public export map is
semver-governed; consumers should not import undeclared dist/ or source paths.
CLI output contract · MCP tools · Public package entry points · Contract surface
Choose your next step
Installation notes
WSL users should install Lex natively inside WSL rather than allowing a Windows npm shim or npm's
_npx cache to win on PATH. See WSL Native Installation.
Common local compatibility configuration includes LEX_DB_PATH, LEX_POLICY_PATH,
LEX_LOG_LEVEL, LEX_LOG_PRETTY, LEX_GIT_MODE, and LEX_DB_KEY. PostgreSQL selection uses
LEX_STORE and LEX_DATABASE_URL. Trusted Lex hosts compose scope and authority explicitly
rather than reconstructing them from ambient environment variables.
Complete environment reference
Project status
Current Version: 4.4.5
Lex 4.4.5 updates security dependency floors and retained resolutions. See the 4.4.5 security and recovery notes, including the required explicit refresh of existing consumer locks. No store migration is introduced. The earlier Lex 4.4.4 patch corrects Windows root comparison in trusted workspace destination preflight and save receipts. See the 4.4.4 release notes, the 4.4 release notes and migration guide. Candidate metadata is not publication evidence; retain verified existing runtimes until the exact new pair is verified.
Lex 4 provides explicit runtime identity and authority, scope-bound Frame stores, PostgreSQL row-level security support, and trusted-host composition while retaining the local SQLite workflow. Lex 4 requires Node 24 or newer and is released as part of the Ecosystem 3.1 compatibility train.
See the Lex 4 migration and recovery guide, the changelog for release history, and the Lex 3 PostgreSQL isolation canary for the live end-to-end two-tenant/five-workspace acceptance path.
Contributing
Contributions are welcome. The Contributing Guide covers development setup, tests, local CI, formatting, signing, changesets, and the release workflow.
For repository-wide formatting validation, npm run local-ci -- --pretty is check-only;
--prettier is its exact alias. Formatting mutations remain the separate npm run format
operation.
License
Lex is available under the MIT License.
來源:README.md,提交 f998ecd
工具
0版本歷史
6- v4.4.4最新Oct 20, 2026
- v4.4.3Oct 20, 2026
- v4.4.1Sep 18, 2026
- v4.4.0Sep 17, 2026
- v4.3.0Sep 17, 2026
- v4.2.0Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分