memory.server¶
memory.server ¶
Memory MCP server — persistent research tree, skills library, and live code graph.
Storage: entries are markdown files with YAML frontmatter in .memory/.
The KGLite .memory.kgl file is a disposable cache rebuilt from these files.
Three disconnected subgraphs
- Research tree: typed entries in parent-child branches
- Skills library: flat procedural/pattern knowledge store
- Code graph (separate in-memory KG): auto-generated codebase structure (rebuilt on git changes)
Tool groups
Research tree: record, discard, move, link, recall, search, codebase, history (digest/reconstruct), suggest_relationships, set_relationship, resolve_pin, drift (create_project is only registered while the repo is un-bootstrapped) Skills: save_skill, get_skill, search_skills (empty query = list), delete_skill Documents: documents (register/list/deregister) Sessions: handoff, pickup, search_sessions Maintenance/visualization: health, launch_dashboard
Federated view: another repo's tree can be browsed alongside this one as a
read-only overlay in the dashboard. It is configured via federated_repos in
.memory/config.yaml and surfaced only through launch_dashboard (the
recall/search tools stay local-repo only); see that tool's docstring for the
step-by-step setup.
Artifact/experiment tools (DVC large files, S3, pipelines, experiment reruns)
live in the separate memory-artifacts server (memory/artifacts_server.py) so
that heavy, rarely-used block can be toggled independently in Cursor without
consuming this server's tool slots.
sync, vacuum, attach_plan, and the individual skill/document CRUD helpers remain importable for tests and CLI use but are not registered as MCP tools (Cursor caps total MCP tools across servers, so the surface is kept deliberately lean).
startup ¶
One-time process startup: reap dead sidecars, publish a live session.
Called by the MCP entry point so freshly started servers appear as live session cards immediately instead of after the first tool call.
Source code in memory/server.py
create_project ¶
Create the root research project for this repo. Only one project is allowed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Unique project name (typically the repo name) |
required |
description
|
str
|
What this project is about |
required |
Source code in memory/server.py
overview ¶
Use this first when you're unsure how to work with memory: a compact orientation map.
Read-only. Returns the memory server's purpose, the handful of workflows you
reach for most often, and a tool -> action index so you can pick the right
tool without reading every docstring. Authoritative action values also live
on each tool's own action schema enum.
Source code in memory/server.py
record ¶
record(project: str, title: str, body: str, tags: str = '', type: str = 'note', node_label: str = '', parent_id: str = '', success: bool | None = None, reason: str = '', files: str = '', invalidates: str = '', auto_invalidate: bool = False) -> str
Use this when you need to save a decision, checkpoint, experiment, note, or plan to the research tree so it survives across sessions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project
|
str
|
Project name |
required |
title
|
str
|
Full descriptive title |
required |
body
|
str
|
Free-form markdown content |
required |
tags
|
str
|
Comma-separated keywords |
''
|
type
|
str
|
Entry type (plan/checkpoint/experiment/decision/note/annotation) |
'note'
|
node_label
|
str
|
Short label for visualization (auto-derived if empty) |
''
|
parent_id
|
str
|
Parent entry id (defaults to project root if empty) |
''
|
success
|
bool | None
|
Whether this succeeded (experiments only, null for others) |
None
|
reason
|
str
|
Rationale for the has_child edge |
''
|
files
|
str
|
Comma-separated file paths this entry references (auto-committed and git-pinned) |
''
|
invalidates
|
str
|
Entry id this supersedes (creates invalidated_by edge) |
''
|
auto_invalidate
|
bool
|
If true for decisions, semantically detect and apply invalidation edges |
False
|
Source code in memory/server.py
3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 | |
discard ¶
Mark an entry as discarded (soft delete).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entry_id
|
str
|
The entry to discard |
required |
reason
|
str
|
Why it's being discarded |
''
|
Source code in memory/server.py
move ¶
Move an entry to a different parent in the tree.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entry_id
|
str
|
The entry to move |
required |
new_parent_id
|
str
|
New parent entry id (or project id for top-level) |
required |
Source code in memory/server.py
3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 | |
link ¶
Create a bidirectional cross-reference between two entries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entry_a
|
str
|
First entry id |
required |
entry_b
|
str
|
Second entry id |
required |
rationale
|
str
|
Why these are connected |
required |
Source code in memory/server.py
suggest_relationships ¶
suggest_relationships(project: str, entry_id: str, relation: str = 'related', limit: int = 5) -> str
Suggest semantically similar entries before choosing a relationship.
This tool only previews candidates. Use set_relationship to apply a
related or invalidation edge after deciding what the similarity means.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project
|
str
|
Project name |
required |
entry_id
|
str
|
Entry to compare against |
required |
relation
|
str
|
Intended relation context ("related" or "invalidates") |
'related'
|
limit
|
int
|
Max candidates to return |
5
|
Source code in memory/server.py
3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 | |
set_relationship ¶
set_relationship(entry_a: str, entry_b: str, relationship: str = 'related', rationale: str = '', action: str = 'add') -> str
Add or remove an explicit relationship between two entries.
Use relationship='related' for connected notes/decisions that should
both remain valid. Use relationship='invalidated_by' only when
entry_b supersedes entry_a.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entry_a
|
str
|
Source/older entry id |
required |
entry_b
|
str
|
Target/newer entry id |
required |
relationship
|
str
|
"related" or "invalidated_by" |
'related'
|
rationale
|
str
|
Why these entries are connected |
''
|
action
|
str
|
"add" or "remove" |
'add'
|
Source code in memory/server.py
3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 | |
recall ¶
recall(project: str = '', entry_id: str = '', type: str = '', view: str = 'tree', depth: int = 0, include_body: bool = False, include_discarded: bool = False, limit: int = 0, offset: int = 0, prose: bool = False) -> str
Use this when you need to read the current research tree — nested hierarchy, structural outline, or flat list — to orient before working.
Designed to stay legible on large trees: the server nests children under their
parents (no client-side reconstruction from parent_id), summarizes deep or
collapsed branches as descendant counts, and always returns a summary block
plus open_phases for fast orientation.
Scope is THIS repo only. To view another repo's tree alongside this one,
configure federated_repos in .memory/config.yaml and use the dashboard
(launch_dashboard) — federation is a read-only dashboard overlay and is
not surfaced through this tool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project
|
str
|
Project name. Optional — omit it and the sole root project is auto-detected (this repo has exactly one). |
''
|
entry_id
|
str
|
If provided, root the tree/outline at this entry (its subtree) |
''
|
type
|
str
|
Filter to entries of this type. Forces a flat list (nesting is dropped). |
''
|
view
|
str
|
"tree" (default, nested with depth control), "outline" (plan-node
scaffold only, leaf entries collapsed into counts, each node prefixed
with a hierarchical section number like 1, 1.2, 3.2.1 — best first call
on a big tree), "flat" (paginated flat list, like a classic dump), or
"brief" (a deterministic rollup summary of |
'tree'
|
depth
|
int
|
For view="tree", max generations below the root to expand (0 = unlimited).
Branches deeper than |
0
|
include_body
|
bool
|
If true, include full body text (default false to keep payloads small). |
False
|
include_discarded
|
bool
|
If true, include discarded/superseded entries (default active only). |
False
|
limit
|
int
|
For view="flat" only — max entries per page (0 = all). |
0
|
offset
|
int
|
For view="flat" only — entries to skip for pagination. |
0
|
prose
|
bool
|
For view="brief" only — if true AND a narrative generator is
injected ( |
False
|
Source code in memory/server.py
3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 | |
search ¶
Use this when you're looking for prior entries by keyword, semantic similarity, or both — search here before exploring the codebase.
Scope is THIS repo only. Federated (other-repo) trees are not searched —
browse them via the dashboard repo dropdown (see launch_dashboard).
In "hybrid" mode an optional blended reranker can layer graph-importance
(degree centrality), session-recency, and MMR diversification on top of the
keyword+semantic recall. It is OFF by default (output byte-identical to plain
hybrid RRF) and opt-in via env vars: MEMORY_RERANK_W_IMPORTANCE /
MEMORY_RERANK_W_RECENCY (channel weights, 0 = off),
MEMORY_RERANK_MMR_LAMBDA (1.0 = no MMR), MEMORY_RERANK_OVERFETCH
(recall multiplier), and MEMORY_RECENCY_HALF_LIFE_DAYS. When on, each
text match carries a rerank breakdown (fused/importance/recency).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
Search query (file path, keyword, or natural language question) |
required |
project
|
str
|
Optional project filter |
''
|
mode
|
str
|
"hybrid" (default) combines keyword + semantic, "keyword" for exact substring, "semantic" for vector only |
'hybrid'
|
Source code in memory/server.py
4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 | |
codebase ¶
codebase(action: Literal['lookup', 'blast', 'callers', 'callees', 'imports', 'context', 'ownership', 'health'] = 'lookup', query: str = '', scope: str = '', path: str = '', depth: int = 0, limit: int = 0, expand_synapse: bool = False) -> str
Use this when working with code — find a symbol, see what breaks if you change it, or learn why it exists — via the live code graph.
A structural map of the repo's functions, classes, and modules, parsed from
the working tree and rebuilt when git HEAD changes. Single dispatch tool
keyed on action (all return JSON). Fully back-compatible: omit action
(or pass lookup) and only query / scope for the original search.
Actions — action(params): lookup(query?, scope?): default — census (no args) or name/scope CONTAINS search over functions/classes/modules; each hit carries type, file, line. blast(query|path, depth?): "what breaks if I change this?" reverse CALLS BFS from a symbol or file, depth/node-capped, graded breaks (direct) vs maybe (transitive). callers(query, limit?): 1-hop inbound call edges (with call_lines). callees(query, limit?): 1-hop outbound call edges (with call_lines). imports(query|path, limit?): file/module import neighborhood (imports + imported_by). context(query|path, expand_synapse?): "why does this exist?" the memory tip + provenance chain tethered to the anchor; expand_synapse hops to ZK. ownership(query|path): "who authored this?" git-blame attribution over the anchor's line span or whole file, ranked by lines (memory-mcp excluded). health(): graded drivers (god_object / coupling / cycle / churn / dead_code) with located file:line and a suggestion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
action
|
Literal['lookup', 'blast', 'callers', 'callees', 'imports', 'context', 'ownership', 'health']
|
One of lookup|blast|callers|callees|imports|context|ownership|health. |
'lookup'
|
query
|
str
|
Symbol name/qualified_name (or search term for lookup). |
''
|
scope
|
str
|
Directory subtree filter (lookup). |
''
|
path
|
str
|
File-path anchor for blast/imports/context. |
''
|
depth
|
int
|
Blast BFS depth (default 2, capped at 4). |
0
|
limit
|
int
|
Result cap for callers/callees/imports. |
0
|
expand_synapse
|
bool
|
For context, include the synapse-hop hint for the tip id. |
False
|
Source code in memory/server.py
4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 | |
history ¶
history(action: Literal['digest', 'reconstruct'], granularity: str = 'auto', scope: str = '', max_eras: int = 12, max_commits: int = 5000, era: str = '', include_messages: bool = False, project: str = '', entries_json: str = '', dry_run: bool = False, force: bool = False, session_label: str = 'git-history reconstruction') -> str
Use this when onboarding an existing (brownfield) repo into memory: digest git history, then reconstruct a back-dated tree.
Bridges a codebase's git history into an initially-empty research tree so
recall is useful on day one. See the onboard-existing-codebase skill.
Actions — name(required, optional?):
digest(granularity?, scope?, max_eras?, max_commits?, era?, include_messages?):
read-only, deterministic summary of how the repo evolved (eras, churn,
representative commits, contributors, milestones), sized for an LLM to
synthesize; memory-mcp's own commits excluded. granularity =
auto|tag|month|quarter; drill into one era (+ include_messages).
reconstruct(project, entries_json?, dry_run?, force?, session_label?):
bulk-persist a back-dated tree synthesized from a digest — honours
path@sha pins, auto-tags entries reconstructed/git-history,
bypasses live-session drift. Refuses a tree already holding
non-reconstructed entries unless force=true; dry_run previews.
Both return JSON.
Source code in memory/server.py
save_skill ¶
Create or overwrite a skill.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Unique skill name (e.g. "connect-to-postgres") |
required |
category
|
str
|
"procedural" or "pattern" |
required |
content
|
str
|
The knowledge (markdown, code, steps) |
required |
tags
|
str
|
Comma-separated keywords |
required |
Source code in memory/server.py
get_skill ¶
Read full skill content by name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Skill name to retrieve |
required |
Source code in memory/server.py
search_skills ¶
Search skills by keyword/semantic similarity, or list all when query is empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
Search query (keyword or natural language). Empty = list all skills. |
''
|
mode
|
str
|
"hybrid" (default), "keyword", or "semantic" |
'hybrid'
|
category
|
str
|
List mode only: filter by category (procedural/pattern) |
''
|
tags
|
str
|
List mode only: filter by tag (comma-separated, matches any) |
''
|
Source code in memory/server.py
5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 | |
list_skills ¶
List all skills, optionally filtered by category or tags.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
category
|
str
|
Filter by category (procedural/pattern) |
''
|
tags
|
str
|
Filter by tag (comma-separated, matches any) |
''
|
Source code in memory/server.py
delete_skill ¶
Remove a skill by name (soft-delete).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Skill name to delete |
required |
Source code in memory/server.py
register_document ¶
register_document(path: str, title: str, description: str = '', project: str = '', links_to: str = '') -> str
Register a report/document and optionally link it to a tree entry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Relative file path (e.g. "documents/260605_report_agent_memory_1.md") |
required |
title
|
str
|
Human-readable title |
required |
description
|
str
|
Brief description of what the document covers |
''
|
project
|
str
|
Project name (auto-detected from graph if omitted) |
''
|
links_to
|
str
|
Entry ID to cross-reference (creates a 'related' edge) |
''
|
Source code in memory/server.py
5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 | |
list_documents ¶
List all registered documents for a project.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project
|
str
|
Project name (auto-detected from graph if omitted) |
''
|
Source code in memory/server.py
deregister_document ¶
Remove a document from the tree (soft delete).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
doc_id
|
str
|
The document ID to deregister |
required |
Source code in memory/server.py
documents ¶
documents(action: Literal['register', 'list', 'deregister'], path: str = '', title: str = '', description: str = '', project: str = '', links_to: str = '', doc_id: str = '') -> str
Use this when you need to register, list, or deregister markdown documents (reports, plans) linked to the research tree.
Actions — name(required, optional?):
register(path, title, description?, project?, links_to?): register a
document; links_to is an entry ID for a 'related' edge.
list(project?): list all registered documents, optionally for one project.
deregister(doc_id): soft-delete a document.
project is auto-detected when omitted. All return JSON.
Source code in memory/server.py
attach_plan ¶
Attach an external plan file to a memory entry.
Reads the file content and stores both the path (for linking) and the full content (for semantic search portability). If the file is later deleted, the content remains searchable and the dashboard shows a 'missing' indicator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entry_id
|
str
|
The memory entry to attach the plan to |
required |
plan_path
|
str
|
Absolute path to the .plan.md file |
required |
Source code in memory/server.py
handoff ¶
Persist the current session's activity and prepare for handoff to a new agent.
Saves a session record listing which memory entries were created, accessed, and modified during this session. Call this at end of session or when handing off to a new chat window.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project
|
str
|
Project name. Optional — auto-detected (the sole root project) when omitted. |
''
|
summary
|
str
|
First line is a short descriptive title; remaining lines are the body summary of what was accomplished and what's next |
''
|
kind
|
str
|
Session classification — "session" (default), "pipeline" (coordinator run), or "task" (short single-purpose interaction) |
'session'
|
Source code in memory/server.py
5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 | |
pickup ¶
Load a previous session's context for a new agent picking up work.
With no query: returns the most recent session (default behavior). With a query: semantically searches all past sessions and returns the best matches — useful for resuming a workflow from days or months ago.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project
|
str
|
Project name. Optional — auto-detected (the sole root project) when omitted. |
''
|
query
|
str
|
Optional search query to find sessions by topic (e.g. "auto-invalidation work") |
''
|
Source code in memory/server.py
search_sessions ¶
Search or list past sessions.
With a query: performs semantic search over session history to find relevant past sessions by topic (e.g. "dashboard work", "coordinator pipeline runs"). Without a query: lists the N most recent sessions, ordered newest first.
Returns lightweight summaries — use pickup(query=...) for full session context.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
Optional search query (natural language or keywords) |
''
|
project
|
str
|
Project name (auto-detected if empty) |
''
|
limit
|
int
|
Max sessions to return (default 10) |
10
|
Source code in memory/server.py
6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 | |
skill ¶
skill(action: Literal['save', 'get', 'search', 'delete'], name: str = '', category: str = '', content: str = '', tags: str = '', query: str = '', mode: str = 'hybrid') -> str
Use this when you want to save, retrieve, search, or delete a reusable procedure/pattern in the skill library.
Actions — name(required, optional?):
save(name, category, content, tags): create/overwrite a skill.
get(name): retrieve full skill content.
search(query?, mode?, category?, tags?): find skills; empty query lists
the whole library.
delete(name): remove a skill.
All return JSON.
Source code in memory/server.py
relate ¶
relate(action: Literal['link', 'set', 'suggest', 'merge', 'bulk', 'export'], entry_a: str = '', entry_b: str = '', rationale: str = '', relationship: str = 'related', op: str = 'add', project: str = '', entry_id: str = '', relation: str = 'related', limit: int = 5, mode: str = '', ids: str = '', add_tags: str = '', remove_tags: str = '', set_type: str = '') -> str
Use this when you need to cross-reference or clean up entries: link/set edges, suggest duplicates, merge, bulk-edit tags/types, or export the graph.
Actions — name(required, optional?):
link(entry_a, entry_b, rationale): create a bidirectional related
cross-reference between two entries.
set(entry_a, entry_b, relationship?, op?, rationale?): add/remove an
explicit edge (relationship = related|invalidated_by; op =
add|remove). Generalizes link.
suggest(project, entry_id, relation?, limit?, mode?): preview semantically
similar candidates before deciding on a relation; mode="duplicate"
returns near-DUPLICATE merge targets (high cosine + lexical confirm).
merge(entry_a, entry_b): losslessly collapse entry_a (loser) into
entry_b (winner) — reparent children, union tags/files/relationships,
redirect inbound refs, soft-discard the loser (merged_into:<winner>).
bulk(ids, add_tags?, remove_tags?, set_type?): batch-edit entries (ids
comma-separated) in one commit.
export(): export the tree (entry nodes + has_child/related edges) as a
GEXF 1.2 document for Gephi/networkx. Read-only.
All return JSON.
Source code in memory/server.py
6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 | |
session ¶
session(action: Literal['handoff', 'pickup', 'search'], project: str = '', summary: str = '', kind: str = 'session', query: str = '', limit: int = 10) -> str
Use this when starting or ending a work session: hand off the current session, pick up a previous one, or search past sessions.
project is optional throughout — the sole root project is auto-detected
when omitted.
Actions — name(required, optional?):
handoff(project?, summary?, kind?): persist the current session's activity
for the next agent (summary first line = title; kind =
session|pipeline|task). Called by the session-end hook.
pickup(project?, query?): load a previous session's focused context; with a
query, semantically search past sessions by topic. Called by the
session-start hook.
search(project?, query?, limit?): search/list past sessions; empty query
lists the most recent limit.
All return JSON.
Source code in memory/server.py
resolve_pin ¶
Retrieve file content at a pinned git SHA.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pinned_ref
|
str
|
A pinned reference like "memory/server.py@a3f7c2e" |
required |
Source code in memory/server.py
drift ¶
Scan git-pinned entries for code drift, and optionally sweep stale ones.
Compares each pinned file (path@sha) against the current HEAD. When symbol
refinement is on (MEMORY_SYMBOL_DRIFT, default), a file-level-drifted entry
is further judged at symbol granularity: an entry is semantically stale only
when a code symbol its body names actually changed; a file that drifted but
left every named symbol untouched is a spurious flag. Entries are ranked by
drift count, most drifted first.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project
|
str
|
Optional project filter. If empty, scans all entries. |
''
|
action
|
str
|
|
'report'
|
apply
|
bool
|
Only meaningful for |
False
|
Source code in memory/server.py
6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 | |
sync ¶
Reconcile .memory/ files with the in-memory cache.
Call after git pull or external edits to .memory/ files. Reads what
changed and applies an incremental delta by default; pass force=True
(or hit a schema mismatch / deletion) to rebuild the whole KGLite cache
from scratch. Reports what changed either way.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
force
|
bool
|
Rebuild the entire cache from files instead of applying a delta. |
False
|
Source code in memory/server.py
health ¶
Report memory system health and diagnostics.
Returns cache freshness, unpushed commit count, entry/skill/session counts, embeddings coverage, format version, and install location.
Source code in memory/server.py
6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 | |
vacuum ¶
Archive discarded entries older than N days and rebuild the cache.
Moves qualifying entry files to .memory/archive/entries/, then rebuilds the KGLite cache from the remaining .memory/ files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
days_old
|
int
|
Only remove entries discarded more than this many days ago (default 30) |
30
|
dry_run
|
bool
|
If true (default), report what would be removed without changing anything |
True
|
Source code in memory/server.py
7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 | |
repair_projects ¶
Fold stray/phantom project roots back under the single canonical root.
A store must have exactly one project root (see create_project). Accidents —
historically a typo'd project/parent_id in an old record() call —
could mint extra "phantom" roots that hold real entries as an orphaned
subtree, which the dashboard surfaces via its multi-project switcher. This
finds entries not under the canonical root (a project tag other than the
canonical one, or a parent_id that resolves to neither an existing entry
nor the root) and, unless dry_run, retags them to the canonical project
and reparents the dangling ones onto the root, then rebuilds the cache so the
now-empty phantom project nodes disappear.
The canonical root is the one backed by .memory/project.md. Entries whose
parent_id points at another entry are left in place (only their tag is
fixed), so an entire mis-rooted subtree collapses under the root as a
subproject with its internal shape intact.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dry_run
|
bool
|
If true (default), report what would change without writing. |
True
|
Source code in memory/server.py
7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 | |
launch_dashboard ¶
Launch the memory research-tree dashboard (backend + frontend).
Adapts to the install: the backend always starts and, in a plain (non-editable) install, serves the bundled UI itself on :8744. In a source checkout it also starts the Vite dev server on :5175 (live reload). The chat agent runs in-process in the backend (cursor-sdk's bundled bridge — no system Node.js needed). If already running, returns the URL immediately unless force_restart=True; handles port conflicts by killing stale processes.
This is the memory/research-tree visualizer — for browsing entries, sessions, skills, and the code graph. NOT the zettelkasten dashboard.
FEDERATED VIEW — viewing another repo's tree inside this tree:
The dashboard is the ONLY place that can show a related repo's memory tree
alongside this repo's (the recall/search tools are local-repo only). It
is a read-only overlay — external entries are projected in, never imported
or mutated. To guide a user through it:
1. Edit .memory/config.yaml in THIS repo and add a federated_repos
list. Each entry needs path (absolute, or relative to the workspace
root) pointing at the other repo, plus an id and name. The target
repo must already have a .memory/project.md. Example:
federated_repos:
- id: other-repo
name: Other Repo
path: C:\path\to\other-repo
enabled: true # optional, default true
2. Call launch_dashboard (or rerun with force_restart=True if it is
already open) and open the URL.
3. In the toolbar, use the repo dropdown: "All repos" merges the
federated subtrees under the local project root, or pick a single repo
to isolate it. Federated nodes are badged read-only.
Misconfigured repos surface non-fatal errors in the dashboard's
federationErrors; the most common cause is a path that does not resolve
or a target missing .memory/project.md.
Returns the dashboard URL and component status.
Source code in memory/server.py
7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 | |