feat(api,ui): v15 β analogical reasoning + memory health dock tabs - #42
Merged
Conversation
Backend (api/main.py):
- AnalogicalMemory wired into RestState
- POST /analogy/extract β prose β triples (no-store, pure parse)
- POST /analogy/learn β extract + fold triples into AnalogicalMemory
- POST /analogy/get β attribute query: get(record, attr) β AnalogyResult
- POST /analogy/transfer β A:B::C:? Kanerva (2010) analogical transfer
- GET /analogy/records β list known subject records
Tests (api/test_api.py): 9 new tests for analogy endpoints; 73 total passing
UI (demo/kohaku-live.html):
- New "Analogy" dock tab:
Β· Left: prose textarea β Extract (parse only) / Learn (store) buttons;
animated triple rows (subject Β· .attribute = value Β· confidence%)
Β· Right top: attribute query (record + attr β cleaned-up value with
ranked candidates)
Β· Right bottom: A:B::C:? live-preview equation box, inputs update
the display as you type; Transfer button resolves D and shows
confidence + runner-up candidates
- New "Health" dock tab:
Β· Animated SVG arc gauge (green/amber/rose by score threshold)
Β· 2Γ2 stat grid: total / stale / expired / duplicates
Β· Recommendations list with β bullets
Β· Preview stale / Delete stale buttons with dry-run support
Β· switchTab wired: analogy β analogyRefreshRecords(), health β healthLoad()
wesleyscholl
marked this pull request as ready for review
June 22, 2026 23:21
konjoinfinity
pushed a commit
that referenced
this pull request
Jun 22, 2026
β¦posed modules main (#42) added the analogical-memory feature to the OLD monolithic api/main.py + api/test_api.py, which this branch had decomposed. Resolution: keep the decomposition and port #42's purely-additive changes into the new structure β - 9 analogy pydantic models β api/models.py - RestState.analogy (AnalogicalMemory) β api/_helpers.py (+ conftest reset) - 5 /analogy/* routes β new api/routers/analogy.py (register(app, ctx)), wired in create_app between episodes and agents (original order preserved) - analogy tests β new api/test_analogy_api.py (test_api.py stays deleted) Verified: 0 files >500L repo-wide; api suite 78 passed (only the pre-existing env-only test_health rust-accel assertion fails); ruff check/format clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AnalogicalMemoryinto the REST surfacePOST /analogy/extractβ prose β triples (pure parse, no store)POST /analogy/learnβ extract + fold triples into subject recordsPOST /analogy/getβ attribute query:get(record, attr)β cleaned-up value + confidencePOST /analogy/transferβ A:B::C:? Kanerva (2010) analogical transfer via VSA algebraGET /analogy/recordsβ list known subject record namesTest plan
python -m pytest api/test_api.py -qβ 73 passedruff check api/main.py api/test_api.pyβ clean/liveβ "Analogy" and "Health" tabs visible in dockπ€ Generated with Claude Code
Generated by Claude Code