@rubytech/create-maxy-code 0.1.132 → 0.1.138

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/dist/__tests__/installer-specialist-registration.test.js +5 -40
  2. package/dist/index.js +24 -28
  3. package/dist/specialist-registration.js +0 -15
  4. package/package.json +1 -1
  5. package/payload/platform/lib/graph-search/dist/boosts.d.ts +39 -0
  6. package/payload/platform/lib/graph-search/dist/boosts.d.ts.map +1 -0
  7. package/payload/platform/lib/graph-search/dist/boosts.js +57 -0
  8. package/payload/platform/lib/graph-search/dist/boosts.js.map +1 -0
  9. package/payload/platform/lib/graph-search/dist/dedup.d.ts +29 -0
  10. package/payload/platform/lib/graph-search/dist/dedup.d.ts.map +1 -0
  11. package/payload/platform/lib/graph-search/dist/dedup.js +97 -0
  12. package/payload/platform/lib/graph-search/dist/dedup.js.map +1 -0
  13. package/payload/platform/lib/graph-search/dist/index.d.ts +70 -8
  14. package/payload/platform/lib/graph-search/dist/index.d.ts.map +1 -1
  15. package/payload/platform/lib/graph-search/dist/index.js +323 -62
  16. package/payload/platform/lib/graph-search/dist/index.js.map +1 -1
  17. package/payload/platform/lib/graph-search/dist/query-expansion.d.ts +37 -0
  18. package/payload/platform/lib/graph-search/dist/query-expansion.d.ts.map +1 -0
  19. package/payload/platform/lib/graph-search/dist/query-expansion.js +101 -0
  20. package/payload/platform/lib/graph-search/dist/query-expansion.js.map +1 -0
  21. package/payload/platform/lib/graph-search/dist/route.d.ts +29 -0
  22. package/payload/platform/lib/graph-search/dist/route.d.ts.map +1 -0
  23. package/payload/platform/lib/graph-search/dist/route.js +53 -0
  24. package/payload/platform/lib/graph-search/dist/route.js.map +1 -0
  25. package/payload/platform/lib/graph-search/dist/rrf-fusion.d.ts +31 -0
  26. package/payload/platform/lib/graph-search/dist/rrf-fusion.d.ts.map +1 -0
  27. package/payload/platform/lib/graph-search/dist/rrf-fusion.js +57 -0
  28. package/payload/platform/lib/graph-search/dist/rrf-fusion.js.map +1 -0
  29. package/payload/platform/lib/graph-search/src/__tests__/boosts.test.ts +59 -0
  30. package/payload/platform/lib/graph-search/src/__tests__/dedup.test.ts +83 -0
  31. package/payload/platform/lib/graph-search/src/__tests__/query-expansion.test.ts +96 -0
  32. package/payload/platform/lib/graph-search/src/__tests__/route.test.ts +62 -0
  33. package/payload/platform/lib/graph-search/src/__tests__/rrf-fusion.test.ts +39 -0
  34. package/payload/platform/lib/graph-search/src/boosts.ts +61 -0
  35. package/payload/platform/lib/graph-search/src/dedup.ts +108 -0
  36. package/payload/platform/lib/graph-search/src/index.ts +407 -65
  37. package/payload/platform/lib/graph-search/src/query-expansion.ts +129 -0
  38. package/payload/platform/lib/graph-search/src/route.ts +70 -0
  39. package/payload/platform/lib/graph-search/src/rrf-fusion.ts +62 -0
  40. package/payload/platform/neo4j/schema.cypher +80 -1
  41. package/payload/platform/plugins/admin/hooks/session-end-retrospective.sh +4 -2
  42. package/payload/platform/plugins/admin/mcp/dist/index.js +6 -4
  43. package/payload/platform/plugins/admin/mcp/dist/index.js.map +1 -1
  44. package/payload/platform/plugins/docs/references/internals.md +36 -10
  45. package/payload/platform/plugins/docs/references/neo4j.md +63 -0
  46. package/payload/platform/plugins/docs/references/session-retrospective.md +11 -4
  47. package/payload/platform/plugins/graph-viewer/mcp/dist/tools/graph-render.js +2 -2
  48. package/payload/platform/plugins/graph-viewer/mcp/dist/tools/graph-render.js.map +1 -1
  49. package/payload/platform/plugins/memory/mcp/dist/index.js +114 -5
  50. package/payload/platform/plugins/memory/mcp/dist/index.js.map +1 -1
  51. package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/graph-write-gate-property.test.d.ts +2 -0
  52. package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/graph-write-gate-property.test.d.ts.map +1 -0
  53. package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/graph-write-gate-property.test.js +25 -0
  54. package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/graph-write-gate-property.test.js.map +1 -0
  55. package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/timeline-extractor.test.d.ts +2 -0
  56. package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/timeline-extractor.test.d.ts.map +1 -0
  57. package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/timeline-extractor.test.js +70 -0
  58. package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/timeline-extractor.test.js.map +1 -0
  59. package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/typed-edge-schema.test.d.ts +2 -0
  60. package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/typed-edge-schema.test.d.ts.map +1 -0
  61. package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/typed-edge-schema.test.js +50 -0
  62. package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/typed-edge-schema.test.js.map +1 -0
  63. package/payload/platform/plugins/memory/mcp/dist/lib/compiled-truth-rewriter.d.ts +33 -0
  64. package/payload/platform/plugins/memory/mcp/dist/lib/compiled-truth-rewriter.d.ts.map +1 -0
  65. package/payload/platform/plugins/memory/mcp/dist/lib/compiled-truth-rewriter.js +99 -0
  66. package/payload/platform/plugins/memory/mcp/dist/lib/compiled-truth-rewriter.js.map +1 -0
  67. package/payload/platform/plugins/memory/mcp/dist/lib/graph-write-gate.d.ts +21 -0
  68. package/payload/platform/plugins/memory/mcp/dist/lib/graph-write-gate.d.ts.map +1 -1
  69. package/payload/platform/plugins/memory/mcp/dist/lib/graph-write-gate.js +24 -0
  70. package/payload/platform/plugins/memory/mcp/dist/lib/graph-write-gate.js.map +1 -1
  71. package/payload/platform/plugins/memory/mcp/dist/lib/timeline-extractor.d.ts +13 -0
  72. package/payload/platform/plugins/memory/mcp/dist/lib/timeline-extractor.d.ts.map +1 -0
  73. package/payload/platform/plugins/memory/mcp/dist/lib/timeline-extractor.js +151 -0
  74. package/payload/platform/plugins/memory/mcp/dist/lib/timeline-extractor.js.map +1 -0
  75. package/payload/platform/plugins/memory/mcp/dist/lib/typed-edge-pass.d.ts +55 -0
  76. package/payload/platform/plugins/memory/mcp/dist/lib/typed-edge-pass.d.ts.map +1 -0
  77. package/payload/platform/plugins/memory/mcp/dist/lib/typed-edge-pass.js +290 -0
  78. package/payload/platform/plugins/memory/mcp/dist/lib/typed-edge-pass.js.map +1 -0
  79. package/payload/platform/plugins/memory/mcp/dist/lib/typed-edge-schema.d.ts +19 -0
  80. package/payload/platform/plugins/memory/mcp/dist/lib/typed-edge-schema.d.ts.map +1 -0
  81. package/payload/platform/plugins/memory/mcp/dist/lib/typed-edge-schema.js +102 -0
  82. package/payload/platform/plugins/memory/mcp/dist/lib/typed-edge-schema.js.map +1 -0
  83. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-search-fields.test.js +18 -1
  84. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-search-fields.test.js.map +1 -1
  85. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-update-emit.test.js +5 -0
  86. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-update-emit.test.js.map +1 -1
  87. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-write-emit.test.js +2 -0
  88. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-write-emit.test.js.map +1 -1
  89. package/payload/platform/plugins/memory/mcp/dist/tools/memory-search.d.ts.map +1 -1
  90. package/payload/platform/plugins/memory/mcp/dist/tools/memory-search.js +14 -0
  91. package/payload/platform/plugins/memory/mcp/dist/tools/memory-search.js.map +1 -1
  92. package/payload/platform/plugins/memory/mcp/dist/tools/memory-typed-edge-pass.d.ts +29 -0
  93. package/payload/platform/plugins/memory/mcp/dist/tools/memory-typed-edge-pass.d.ts.map +1 -0
  94. package/payload/platform/plugins/memory/mcp/dist/tools/memory-typed-edge-pass.js +22 -0
  95. package/payload/platform/plugins/memory/mcp/dist/tools/memory-typed-edge-pass.js.map +1 -0
  96. package/payload/platform/plugins/memory/mcp/dist/tools/memory-update.d.ts +31 -1
  97. package/payload/platform/plugins/memory/mcp/dist/tools/memory-update.d.ts.map +1 -1
  98. package/payload/platform/plugins/memory/mcp/dist/tools/memory-update.js +182 -50
  99. package/payload/platform/plugins/memory/mcp/dist/tools/memory-update.js.map +1 -1
  100. package/payload/platform/plugins/memory/mcp/dist/tools/memory-write.d.ts.map +1 -1
  101. package/payload/platform/plugins/memory/mcp/dist/tools/memory-write.js +76 -1
  102. package/payload/platform/plugins/memory/mcp/dist/tools/memory-write.js.map +1 -1
  103. package/payload/platform/plugins/memory/mcp/dist/tools/session-retrospective-skip-rate.d.ts +30 -0
  104. package/payload/platform/plugins/memory/mcp/dist/tools/session-retrospective-skip-rate.d.ts.map +1 -0
  105. package/payload/platform/plugins/memory/mcp/dist/tools/session-retrospective-skip-rate.js +129 -0
  106. package/payload/platform/plugins/memory/mcp/dist/tools/session-retrospective-skip-rate.js.map +1 -0
  107. package/payload/platform/plugins/memory/mcp/scripts/backfill-typed-edges.ts +72 -0
  108. package/payload/platform/plugins/memory/mcp/scripts/generate-edge-docs.ts +75 -0
  109. package/payload/platform/plugins/memory/mcp/vitest.config.ts +5 -0
  110. package/payload/platform/plugins/memory/references/schema-base.md +44 -0
  111. package/payload/platform/scripts/seed-neo4j.sh +49 -0
  112. package/payload/platform/templates/agents/admin/IDENTITY.md +4 -3
  113. package/payload/platform/templates/specialists/agents/database-operator.md +9 -1
  114. package/payload/server/{adminuser-self-heal-QAWOZ3JV.js → adminuser-self-heal-YC47O34W.js} +2 -1
  115. package/payload/server/{chunk-JSBRDJBE.js → chunk-HYQNUVGO.js} +9 -1
  116. package/payload/server/{chunk-HCYM5FLU.js → chunk-T3DJD5QR.js} +3 -1
  117. package/payload/server/maxy-edge.js +3 -2
  118. package/payload/server/public/assets/{admin-FcRHAL-3.js → admin-BM9aXUUh.js} +1 -1
  119. package/payload/server/public/assets/{data-Ds37mflX.js → data-Ds2ECtfP.js} +1 -1
  120. package/payload/server/public/assets/{graph-CmWRhaiS.js → graph-BzxObKMM.js} +1 -1
  121. package/payload/server/public/assets/{graph-labels-Ch2r00Gt.js → graph-labels-Dwgep_nr.js} +1 -1
  122. package/payload/server/public/assets/{page-BcHhJXUt.js → page-BlkBsjP2.js} +1 -1
  123. package/payload/server/public/assets/page-h_SA5SVQ.js +51 -0
  124. package/payload/server/public/data.html +3 -3
  125. package/payload/server/public/graph.html +3 -3
  126. package/payload/server/public/index.html +4 -4
  127. package/payload/server/server.js +803 -76
  128. package/payload/server/public/assets/page-BOtNny_4.js +0 -51
@@ -11,20 +11,29 @@ Use this reference when assessing capabilities, diagnosing retrieval behaviour,
11
11
  Every knowledge query flows through a hybrid search pipeline that combines semantic similarity with keyword matching, applies layered access controls, expands results via graph traversal, and optionally re-ranks via LLM reasoning.
12
12
 
13
13
  ```
14
- QUERY
14
+ QUERY ── (retrievalClass from Task 304 gateway-classifier)
15
15
 
16
- ├── EMBED (EMBED_MODEL, default nomic-embed-text) ──► VECTOR SEARCH (per index, cosine)
17
-
18
- ├──► MERGE ──► EXPAND ──► RESULTS
19
-
20
- └── ESCAPE (Lucene special chars) ──────► BM25 FULL-TEXT ──┘
21
- (entity_search index universal coverage)
22
-
23
- Merge formula: combined = 0.7 × vector_score + 0.3 × normalised_bm25_score
24
- Deduplication: by nodeId — when a node appears in both paths, keep the max score from each method independently, then combine.
16
+ ├── EXPAND (Haiku 3-5 paraphrases, 1h cache) [flag: MAXY_GS_EXPANSION]
17
+
18
+ ├── ROUTE (per-class label filter + fusion weights) [flag: MAXY_GS_ROUTE]
19
+
20
+ ├── For each query ────► EMBED ──► VECTOR SEARCH ──┐
21
+ │ ├─► FUSE (weighted-sum or RRF) [flag: MAXY_GS_RRF]
22
+ │ └────► BM25 FULL-TEXT ──────────┘
23
+ │ (entity_search universal coverage)
24
+
25
+ ├── BOOST (compiledTruth +15%, backlinks log 5-25%) [flag: MAXY_GS_BOOSTS]
26
+ ├── DEDUP (4 layers: nodeId, slug, canonicalName, hash) [flag: MAXY_GS_DEDUP]
27
+ ├── THRESHOLD + SORT + SLICE
28
+ └── GRAPH EXPAND ──► RESULTS
29
+
30
+ Fusion (default / weighted-sum): combined = 0.7 × vector + 0.3 × bm25_norm
31
+ Fusion (RRF): score = Σ 1 / (60 + rank_i) across ranked lists
25
32
  Fallback: if the full-text index doesn't exist, vector-only results are returned (graceful degradation, no error).
26
33
  ```
27
34
 
35
+ Each Task 308 enhancement is independently flagged. All flags default OFF — the unflagged pipeline is identical to the baseline weighted-sum + nodeId-only-dedup behaviour. Tasks 305 (typed-edge backlinks) and 306 (compiledTruth property) have landed, so the boost data is populated; flag activation, soak windows, and per-flag measurement live under Task 337.
36
+
28
37
  ### Hybrid Search Detail
29
38
 
30
39
  **Vector path:** The query is embedded via Ollama (model per `EMBED_MODEL` env var, default `nomic-embed-text`). The resulting vector is compared against Neo4j's HNSW cosine indexes — one per indexed label. Dimensions are configured at install time (default 768). The search runs against all discovered indexes (or a subset if the caller specifies label filters). Scores are in [0, 1] (cosine similarity).
@@ -33,6 +42,23 @@ Fallback: if the full-text index doesn't exist, vector-only results are returned
33
42
 
34
43
  **Merge:** Results from both paths are collected in a single map keyed by `nodeId`. A node appearing in both paths accumulates the max vector score and max BM25 score independently. The combined score is `0.7 * vectorScore + 0.3 * bm25Score`. Results are sorted descending by combined score, then sliced to the requested limit (default 10).
35
44
 
45
+ ### Task 308 enhancements (flagged, default off)
46
+
47
+ | Stage | Module | Flag | What it does |
48
+ |---|---|---|---|
49
+ | Routing | `route.ts` | `MAXY_GS_ROUTE` | Picks per-class label filter + fusion weights from the `retrievalClass` hint produced by Task 304's gateway-classifier. `entity` → vector-heavy + Person/Company/Concept; `temporal` → BM25-heavy over Event; `event` → BM25-only over Event; `general` → balanced; `none` → skip the lookup. |
50
+ | Multi-query expansion | `query-expansion.ts` | `MAXY_GS_EXPANSION` | Haiku generates 3-5 paraphrases per query; each runs through vector + BM25 in parallel, with results unioned before fusion. Per-call 1-hour cache keyed by (accountId, query, retrievalClass). Graceful degrade on Haiku failure — original query only. |
51
+ | RRF fusion | `rrf-fusion.ts` | `MAXY_GS_RRF` | Replaces weighted-sum with Reciprocal Rank Fusion (k=60 by default). Sums `1 / (k + rank)` per node across the ranked lists each pass produces. More robust to score-distribution drift between indexes than weighted-sum. Weighted-sum stays as the fallback. |
52
+ | compiledTruth boost | `boosts.ts` | `MAXY_GS_BOOSTS` | +15% to the combined score of any hit whose node carries a non-null `compiledTruth` property (populated by Task 306 on Person/Company/Concept). The property is in the `entity_search` index so BM25 hits against summary text are also matched. |
53
+ | Backlink boost | `boosts.ts` | `MAXY_GS_BOOSTS` | `bump = clamp(0.05 + 0.05 × log10(backlinkCount), 0.05, 0.25)`. 1 backlink → +5%; 10 → +10%; 100 → +15%; 1000+ → +20%; capped at +25%. Reads `backlinkCount` populated by Task 305's typed-edge hook. |
54
+ | 4-layer dedup | `dedup.ts` | `MAXY_GS_DEDUP` | Strict superset of nodeId-only dedup. Layers: `nodeId`, `slug`, `canonicalName` (case-insensitive, falls back to `name`), `contentHash` (sha256 of `compiledTruth || content`). Highest-score representative wins per collision class. Missing keys skip the layer, no false collision. |
55
+
56
+ A per-call log line lets the operator see which stages ran with which counts:
57
+
58
+ ```
59
+ [graph-search:hybrid] accountId=<8c> retrievalClass=<c> expansions=<n> vector=<n> bm25=<n> fused=<n> boosted=<n> deduped=<n> final=<n> mode=<hybrid|rrf|bm25> ms=<ms> expand-ms=<ms>
60
+ ```
61
+
36
62
  ### What the hybrid approach catches
37
63
 
38
64
  Vector search excels at semantic meaning — "how do I contact someone" finds nodes about communication even if the word "contact" doesn't appear. BM25 excels at exact terms — invoice numbers, product codes, proper nouns, technical identifiers. The hybrid combination ensures both modes contribute, with semantic similarity weighted higher (0.7) because most user queries are natural language.
@@ -0,0 +1,63 @@
1
+ # Neo4j edge types — operator reference
2
+
3
+ How Maxy's graph wires itself.
4
+
5
+ ## Typed-edge auto-extraction
6
+
7
+ At the end of every admin session (`/end`, `/archive`, `end session`, `archive this session`), the admin agent delegates one final pass to the `database-operator` specialist. That pass reads every prose-bearing node your account wrote since the last completed retrospective — messages, meetings, notes, pages, posts, reports, emails, ideas — and asks Claude Haiku to propose typed edges from the text. Only edges that match a closed allowlist of `(sourceLabel, EDGE_TYPE, targetLabel)` shapes are MERGEd into the graph. The graph wires itself; you do not have to ask for it.
8
+
9
+ If a session closes without one of the four typed end-intent tokens (Sidebar Archive, tab-close, power loss), the pass for that session is deferred — its prose nodes land at the next `/end`. Nothing is lost, just delayed by one session.
10
+
11
+ ## Typed-edge allowlist
12
+
13
+ <!-- TYPED-EDGE-TABLE:START -->
14
+
15
+ <!-- Generated by platform/plugins/memory/mcp/scripts/generate-edge-docs.ts from TYPED_EDGE_ALLOWLIST. Do not edit by hand. -->
16
+
17
+ | Source label | Edge type | Target label |
18
+ |---|---|---|
19
+ | Person | ATTENDED | Event |
20
+ | Person | ATTENDED | Meeting |
21
+ | Person | WORKS_AT | Organization |
22
+ | Person | WORKS_AT | LocalBusiness |
23
+ | Person | INVESTED_IN | Organization |
24
+ | Person | INVESTED_IN | LocalBusiness |
25
+ | Organization | INVESTED_IN | Organization |
26
+ | Organization | INVESTED_IN | LocalBusiness |
27
+ | Person | FOUNDED | Organization |
28
+ | Person | FOUNDED | LocalBusiness |
29
+ | Person | ADVISES | Organization |
30
+ | Person | ADVISES | LocalBusiness |
31
+ | Person | ADVISES | Person |
32
+ | Message | MENTIONS | Person |
33
+ | Message | MENTIONS | Organization |
34
+ | Message | MENTIONS | LocalBusiness |
35
+ | Message | MENTIONS | Event |
36
+ | Page | MENTIONS | Person |
37
+ | Page | MENTIONS | Organization |
38
+ | Page | MENTIONS | LocalBusiness |
39
+ | Page | MENTIONS | Event |
40
+ | Meeting | MENTIONS | Person |
41
+ | Meeting | MENTIONS | Organization |
42
+ | Email | MENTIONS | Person |
43
+ | Email | MENTIONS | Organization |
44
+ | Note | MENTIONS | Person |
45
+ | Note | MENTIONS | Organization |
46
+ | Idea | MENTIONS | Person |
47
+ | Idea | MENTIONS | Organization |
48
+ | Post | MENTIONS | Person |
49
+ | Post | MENTIONS | Organization |
50
+ | Report | MENTIONS | Person |
51
+ | Report | MENTIONS | Organization |
52
+ | Person | AUTHORED | Post |
53
+ | Person | AUTHORED | Report |
54
+ | Person | AUTHORED | Page |
55
+ | Person | AUTHORED | Note |
56
+ | Email | ATTACHED_TO | Meeting |
57
+ | Page | ATTACHED_TO | Project |
58
+ | Note | ATTACHED_TO | Project |
59
+ | Page | REFERENCES | Page |
60
+ | Report | REFERENCES | Report |
61
+ | Report | REFERENCES | Page |
62
+
63
+ <!-- TYPED-EDGE-TABLE:END -->
@@ -1,20 +1,27 @@
1
1
  # Session-end retrospective
2
2
 
3
- When you end an admin session by typing `/end`, `/archive`, `end session`, or `archive this session`, the admin agent runs one extra turn before the session closes. It walks the session and writes down three kinds of thing that would otherwise be lost:
3
+ When you end an admin session by typing `/end`, `/archive`, `end session`, or `archive this session`, the admin agent runs one extra turn before the session closes. It walks the session and writes down four kinds of thing that would otherwise be lost:
4
4
 
5
5
  - corrections and learnings you gave the agent during the session,
6
6
  - tonal and working-style preferences worth carrying forward,
7
- - people, decisions, commitments, or business facts that came up but were not yet saved to the graph.
7
+ - people, decisions, commitments, or business facts that came up but were not yet saved to the graph,
8
+ - typed edges between any new prose-bearing nodes (messages, meetings, notes, pages) and the entities they mention — the auto-extraction pass that "wires the graph" so future questions can hop from a person to the companies they founded to the events they attended.
8
9
 
9
10
  The next session starts against an up-to-date picture of you and your business — not just the parts that got recorded mid-flow.
10
11
 
11
- The extra turn is one or two messages from the agent, then a short summary of what was written. It runs inside the same session you were already in; nothing happens in the background, no second session is spawned.
12
+ The extra turn is one or two messages from the agent, then a short summary of what was written. It runs inside the same session you were already in; nothing happens in the background, no second session is spawned. The typed-edge pass itself is delegated to the `database-operator` specialist so the writes land where graph writes are supposed to live.
12
13
 
13
14
  ## When the retrospective is skipped
14
15
 
15
16
  - Clicking the Archive button in the Sidebar closes the session directly and skips the retrospective. The four typed phrases above are the only signals that trigger it.
16
17
  - Closing the browser tab or losing power closes the session without the retrospective. The mid-session recording route (the agent writes facts as they come up) is the primary safety net; the retrospective is the catch-net for what slips through.
17
18
 
19
+ Skipped sessions do not lose typed-edge work. The next session's retrospective picks up any prose nodes the previous session wrote, because the pass is scoped by "what changed since the last completed retrospective" — not by which session wrote it. The cost of skipping is one session of delay, not lost extraction.
20
+
21
+ ## Skip-rate visibility
22
+
23
+ At the start of every admin session, the agent checks how many of your recent sessions closed without firing the retrospective. If any did, it surfaces one line — for example, "the last 10 sessions: 4 ended without a retrospective; their typed edges land at the next `/end`." This is informational, not nagging — it lets you choose to end the next session properly so the deferred extraction lands sooner.
24
+
18
25
  ## What you see if the agent tries to skip it
19
26
 
20
- If the agent replies with a prose summary of "what it learned" without actually performing the retrospective, the session does not close — the Stop gate blocks until the agent calls the deterministic completion tool. You can tell it happened correctly by the final reply naming the counts ("I wrote two learnings, one tonal observation, and three graph updates"); the absence of those counts is the signal that something went wrong.
27
+ If the agent replies with a prose summary of "what it learned" without actually performing the retrospective, the session does not close — the Stop gate blocks until the agent calls the deterministic completion tool. You can tell it happened correctly by the final reply naming the five counts (learnings, tonal observations, graph updates, typed edges accepted, prose nodes scanned); the absence of those counts is the signal that something went wrong.
@@ -24,9 +24,9 @@ import { getSession } from "../lib/neo4j.js";
24
24
  import { layoutGraph } from "../render/layout.js";
25
25
  import { drawGraph } from "../render/draw.js";
26
26
  function getAccountsDir() {
27
- const root = process.env.MAXY_PLATFORM_ROOT;
27
+ const root = process.env.PLATFORM_ROOT ?? process.env.MAXY_PLATFORM_ROOT;
28
28
  if (!root) {
29
- throw new Error("[graph-render] MAXY_PLATFORM_ROOT not set — cannot resolve account output dir.");
29
+ throw new Error("[graph-render] PLATFORM_ROOT not set (also checked MAXY_PLATFORM_ROOT) — cannot resolve account output dir.");
30
30
  }
31
31
  return resolve(root, "..", "data/accounts");
32
32
  }
@@ -1 +1 @@
1
- {"version":3,"file":"graph-render.js","sourceRoot":"","sources":["../../src/tools/graph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AM;YACvB,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACpC,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;AACH,CAAC"}
@@ -41,6 +41,8 @@ import { conversationMemoryExpunge } from "./tools/conversation-memory-expunge.j
41
41
  import { conversationArchiveDeriveInsights, } from "./tools/conversation-archive-derive-insights.js";
42
42
  import { conversationArchiveEnrichRejection } from "./tools/conversation-archive-enrich-rejection.js";
43
43
  import { fetchImageAsContent } from "./tools/image-fetch.js";
44
+ import { memoryTypedEdgePass } from "./tools/memory-typed-edge-pass.js";
45
+ import { sessionRetrospectiveSkipRate } from "./tools/session-retrospective-skip-rate.js";
44
46
  import { getSession, closeDriver } from "./lib/neo4j.js";
45
47
  import { embed } from "./lib/embeddings.js";
46
48
  import { notTrashed } from "../../../../lib/graph-trash/dist/index.js";
@@ -205,7 +207,11 @@ eagerTool(server, "memory-search", "Search the knowledge graph using semantic ve
205
207
  .array(z.string())
206
208
  .optional()
207
209
  .describe("Narrow the response `properties` to these keys per result. Omit to return all properties (default). Empty array returns no properties (explicit 'none'). Unknown keys are silently skipped; nodes lacking a requested key omit it on that row. Use for known-shape lookups (slug → name) to avoid shipping bios, notes, source URLs on every turn. Ranking is unaffected — hybrid() sees the full text either way. See `references/graph-primitives.md` § Projecting fields."),
208
- }, async ({ query, labels, limit, expandHops, keywords, keywordMatch, agentSlug: toolAgentSlug, fields }) => {
210
+ retrievalClass: z
211
+ .enum(["entity", "temporal", "event", "general", "none"])
212
+ .optional()
213
+ .describe("Hint that selects the per-class index mix (route-hint contract). Pass 'entity' for who/what-is-this lookups (vector-heavy, Person|Company|Concept filter), 'temporal' for when-did-this-happen (BM25-heavy over :Event with Timeline), 'event' for pure event listings, 'none' to skip graph lookup entirely (greetings/instructions). Omit or pass 'general' for the balanced default. Routing only takes effect when MAXY_GS_ROUTE is enabled; otherwise the value is recorded in the log line but does not change index selection."),
214
+ }, async ({ query, labels, limit, expandHops, keywords, keywordMatch, agentSlug: toolAgentSlug, fields, retrievalClass }) => {
209
215
  if (!accountId)
210
216
  return refuseNoAccount("memory-search");
211
217
  // Env var takes precedence over tool param (security: public agent server-level enforcement)
@@ -223,6 +229,7 @@ eagerTool(server, "memory-search", "Search the knowledge graph using semantic ve
223
229
  agentSlug: effectiveAgentSlug,
224
230
  keywordSubscriptions: envKeywordSubscriptions,
225
231
  fields,
232
+ retrievalClass,
226
233
  });
227
234
  if (results.length === 0) {
228
235
  return {
@@ -633,12 +640,20 @@ if (!readOnly) {
633
640
  };
634
641
  }
635
642
  });
636
- server.tool("memory-update", "Update properties on an existing node in the knowledge graph. Finds the node by element ID, verifies account ownership, sets the provided properties, and recomputes the embedding.", {
643
+ server.tool("memory-update", "Update properties on an existing node in the knowledge graph. Finds the node by element ID, verifies account ownership, sets the provided properties, and recomputes the embedding. For :Person / :Organization / :Concept, pass rewriteCompiledTruth=true to recompute the compiled-truth summary from the most recent :TimelineEvent rows; direct writes to compiledTruth / compiledTruthUpdatedAt / compiledTruthSource are refused.", {
637
644
  nodeId: z.string().describe("Element ID of the node to update (from memory-search results)"),
638
645
  properties: z
639
646
  .record(z.string(), z.unknown())
640
- .describe("Properties to set or overwrite. Restricted keys (embedding, accountId, createdAt) are ignored."),
641
- }, async ({ nodeId, properties }) => {
647
+ .describe("Properties to set or overwrite. Restricted keys (embedding, accountId, createdAt) are ignored. compiledTruth / compiledTruthUpdatedAt / compiledTruthSource are system-managed and rejected loudly — use rewriteCompiledTruth instead."),
648
+ rewriteCompiledTruth: z
649
+ .boolean()
650
+ .optional()
651
+ .describe("When true, run the compiled-truth rewriter against the node's most recent :TimelineEvent rows and set the result on compiledTruth. Only valid on :Person / :Organization / :Concept."),
652
+ forceRewrite: z
653
+ .boolean()
654
+ .optional()
655
+ .describe("Bypass the 7-day cooldown that protects an operator-edited compiledTruth from automatic rewriter passes. Set only when the operator explicitly asks for a refresh."),
656
+ }, async ({ nodeId, properties, rewriteCompiledTruth, forceRewrite }) => {
642
657
  if (!accountId)
643
658
  return refuseNoAccount("memory-update");
644
659
  try {
@@ -651,12 +666,30 @@ if (!readOnly) {
651
666
  session: resolveSessionId(),
652
667
  tool: "memory-update",
653
668
  },
669
+ rewriteCompiledTruth,
670
+ forceRewrite,
654
671
  });
672
+ const rewriterLine = (() => {
673
+ if (!result.rewriter)
674
+ return "";
675
+ if (result.rewriter.kind === "ok") {
676
+ return `\nCompiled-truth rewritten: ${result.rewriter.charsBefore} → ${result.rewriter.charsAfter} chars.`;
677
+ }
678
+ if (result.rewriter.kind === "refused") {
679
+ return result.rewriter.reason === "operator-edit-cooldown"
680
+ ? `\nRewriter refused: operator-edit cooldown (${result.rewriter.daysRemaining} day(s) remaining; pass forceRewrite=true to override).`
681
+ : `\nRewriter refused: no :TimelineEvent rows linked to this node.`;
682
+ }
683
+ if (result.rewriter.kind === "too-long") {
684
+ return `\nRewriter output exceeded ${result.rewriter.attemptedLen} chars after one retry; compiledTruth unchanged.`;
685
+ }
686
+ return `\nRewriter LLM call failed (cause=${result.rewriter.cause}); compiledTruth unchanged.`;
687
+ })();
655
688
  return {
656
689
  content: [
657
690
  {
658
691
  type: "text",
659
- text: `Node updated: [${result.labels.join(", ")}] (ID: ${result.nodeId})`,
692
+ text: `Node updated: [${result.labels.join(", ")}] (ID: ${result.nodeId})${rewriterLine}`,
660
693
  },
661
694
  ],
662
695
  };
@@ -1954,6 +1987,82 @@ server.tool("image-fetch", [
1954
1987
  ],
1955
1988
  };
1956
1989
  });
1990
+ // ===================================================================
1991
+ // Typed-edge auto-extraction pass (Task 305)
1992
+ // ===================================================================
1993
+ //
1994
+ // Schema-bounded session-end pass that reads prose-bearing nodes the
1995
+ // operator's account wrote since `sinceIso` and asks Haiku for typed-edge
1996
+ // proposals against `TYPED_EDGE_ALLOWLIST`. Owned by `database-operator`
1997
+ // (admin Task-spawns it at the retrospective turn); NOT in
1998
+ // `ADMIN_CORE_TOOLS`. Backfill is via the CLI under `scripts/backfill-typed-edges.ts`,
1999
+ // bypassing this tool.
2000
+ server.tool("memory-typed-edge-pass", "Run the typed-edge auto-extraction pass over prose-bearing nodes this account wrote since sinceIso. Reads Message/Page/Meeting/Email/Idea/Note/Post/Report nodes, batches them, asks Haiku for typed-edge proposals against the closed allowlist (ATTENDED, WORKS_AT, INVESTED_IN, FOUNDED, ADVISES, MENTIONS, AUTHORED, ATTACHED_TO, REFERENCES), validates each proposal inline, and MERGEs accepted edges with createdBy provenance. Returns the counters (nodes, proposed, accepted, rejected, failed, ms) for the caller to hand back to admin's session-retrospective-mark-complete.", {
2001
+ sinceIso: z.string().describe("ISO timestamp lower bound. Prose nodes with updatedAt >= sinceIso are processed."),
2002
+ conversationId: z.string().optional().describe("Conversation id stamped onto the createdBy provenance of MERGEd edges. Defaults to CONVERSATION_ID env if absent."),
2003
+ }, async (args) => {
2004
+ if (!accountId)
2005
+ return refuseNoAccount("memory-typed-edge-pass");
2006
+ const dbSession = getSession();
2007
+ try {
2008
+ const result = await memoryTypedEdgePass(args, dbSession, accountId);
2009
+ return {
2010
+ content: [{
2011
+ type: "text",
2012
+ text: JSON.stringify(result),
2013
+ }],
2014
+ };
2015
+ }
2016
+ catch (err) {
2017
+ return {
2018
+ content: [{
2019
+ type: "text",
2020
+ text: `Typed-edge pass failed: ${err instanceof Error ? err.message : String(err)}`,
2021
+ }],
2022
+ isError: true,
2023
+ };
2024
+ }
2025
+ finally {
2026
+ await dbSession.close();
2027
+ }
2028
+ });
2029
+ // ===================================================================
2030
+ // Session-retrospective skip-rate (Task 305)
2031
+ // ===================================================================
2032
+ //
2033
+ // Visibility tool the admin agent calls at session start. Returns the ratio
2034
+ // of recent sessions for this account that ended WITHOUT calling
2035
+ // `session-retrospective-mark-complete` — those sessions skipped the
2036
+ // typed-edge pass, learnings pass, and SOUL.md pass. Admin surfaces a
2037
+ // one-line note to the operator when the rate is non-zero.
2038
+ server.tool("session-retrospective-skip-rate", "Return the ratio of recent sessions for this account that closed without firing the session-retrospective. Skipped retrospectives mean the typed-edge pass, learnings pass, and SOUL.md updates are deferred to the next /end. Use at session start to surface the cost to the operator when non-zero.", {
2039
+ windowSize: z.number().int().positive().optional().describe("Number of most-recent sessions to inspect. Defaults to 10, capped at 100."),
2040
+ }, async (args) => {
2041
+ if (!accountId)
2042
+ return refuseNoAccount("session-retrospective-skip-rate");
2043
+ const dbSession = getSession();
2044
+ try {
2045
+ const result = await sessionRetrospectiveSkipRate(args, dbSession, accountId);
2046
+ return {
2047
+ content: [{
2048
+ type: "text",
2049
+ text: JSON.stringify(result),
2050
+ }],
2051
+ };
2052
+ }
2053
+ catch (err) {
2054
+ return {
2055
+ content: [{
2056
+ type: "text",
2057
+ text: `Skip-rate query failed: ${err instanceof Error ? err.message : String(err)}`,
2058
+ }],
2059
+ isError: true,
2060
+ };
2061
+ }
2062
+ finally {
2063
+ await dbSession.close();
2064
+ }
2065
+ });
1957
2066
  // Cleanup on exit
1958
2067
  process.on("SIGINT", async () => {
1959
2068
  liveSchemaRuntime.cache.stop();