Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,10 @@ from agents.mcp import MCPServerStdio

async with MCPServerStdio(
name="cortex",
params={"command": "uvx", "args": ["--from", "hypermnesia-mcp[sqlite]", "hypermnesia-mcp"]},
params={
"command": "uvx",
"args": ["--from", "hypermnesia-mcp[sqlite]", "hypermnesia-mcp"],
},
) as server:
agent = Agent(name="Assistant", mcp_servers=[server])
```
Expand Down
11 changes: 7 additions & 4 deletions docs/papers/research-post-context-assembly.md
Original file line number Diff line number Diff line change
Expand Up @@ -1227,10 +1227,13 @@ BEAM paper. See commit `5348f74`.
the harness verifies FlashRank by reranking a synthetic pair:

```python
result = flashrank.rerank([
{"content": "The cat sat on the mat", "score": 0.0},
{"content": "Dogs are loyal pets", "score": 0.0},
], query="What did the cat do?")
result = flashrank.rerank(
[
{"content": "The cat sat on the mat", "score": 0.0},
{"content": "Dogs are loyal pets", "score": 0.0},
],
query="What did the cat do?",
)
assert result[0]["score"] > 0, "FlashRank model loading failed"
```

Expand Down
10 changes: 7 additions & 3 deletions docs/program/phase-0.4.5-backfill-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,12 @@ Intended shape for `mcp_server/handlers/consolidation/reconcile.py`:
```python
def run_reconcile_cycle(store) -> dict:
from mcp_server.core.entity_reconciliation import (
build_reconciliation_sql, build_count_eligible_sql,
reconcile_leak_ratio, exceeds_leak_threshold,
build_reconciliation_sql,
build_count_eligible_sql,
reconcile_leak_ratio,
exceeds_leak_threshold,
)

count_sql, params = build_count_eligible_sql()
eligible = store.execute_scalar(count_sql, params)
insert_sql, params = build_reconciliation_sql()
Expand All @@ -268,7 +271,8 @@ def run_reconcile_cycle(store) -> dict:
logger.warning(
"reconcile leak ratio %.3f exceeds threshold %.3f; "
"investigate write path (persist_entities)",
ratio, LEAK_WARNING_THRESHOLD,
ratio,
LEAK_WARNING_THRESHOLD,
)
return {
"reconciled_pairs": reconciled,
Expand Down
12 changes: 7 additions & 5 deletions docs/program/phase-3-a3-migration-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,7 @@ def bump_heat_raw(self, memory_id: int, new_heat_base: float) -> None:
compute decay from the bump time, not the row's previous anchor.
"""
self._execute(
"UPDATE memories SET heat_base = %s, heat_base_set_at = NOW() "
"WHERE id = %s",
"UPDATE memories SET heat_base = %s, heat_base_set_at = NOW() WHERE id = %s",
(max(0.0, min(1.0, new_heat_base)), memory_id),
)
self._conn.commit()
Expand All @@ -314,7 +313,8 @@ calls `bump_heat_raw` per-row (rare — only memify / replay / rating).

**Current**:
```python
"UPDATE memories SET heat = 1.0, is_protected = TRUE, importance = 1.0, "
"UPDATE memories SET heat = 1.0, is_protected = TRUE, importance = 1.0,"

"tags = %s::jsonb, content = %s, is_global = %s WHERE id = %s"
```

Expand All @@ -324,7 +324,8 @@ rows ignore decay in `effective_heat()` and always return
`LEAST(1.0, heat_base * factor) = 1.0` at `factor = 1.0`.

```python
"UPDATE memories SET heat_base = 1.0, heat_base_set_at = NOW(), "
"UPDATE memories SET heat_base = 1.0, heat_base_set_at = NOW(),"

"is_protected = TRUE, no_decay = TRUE, importance = 1.0, "
"tags = %s::jsonb, content = %s, is_global = %s WHERE id = %s"
```
Expand Down Expand Up @@ -392,7 +393,8 @@ SQLite path keeps the column but recomputes `effective_heat` in Python
(shared `mcp_server/core/effective_heat.py`, a pure function).

```python
"UPDATE memories SET heat_base = ?, heat_base_set_at = CURRENT_TIMESTAMP "
"UPDATE memories SET heat_base = ?, heat_base_set_at = CURRENT_TIMESTAMP"

"WHERE id = ?"
```

Expand Down
13 changes: 7 additions & 6 deletions docs/program/phase-5-pool-admission-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Today:
```python
async def handler(args: dict) -> dict:
store = _get_store()
return store.do_sync_work(args) # blocks event loop
return store.do_sync_work(args) # blocks event loop
```

Post-Phase 5:
Expand All @@ -102,14 +102,15 @@ Each tool declares a concurrency budget. The MCP server registers a

```python
_ADMISSION: dict[str, asyncio.Semaphore] = {
"recall": asyncio.Semaphore(8),
"remember": asyncio.Semaphore(4),
"consolidate": asyncio.Semaphore(1), # one at a time
"seed_project": asyncio.Semaphore(1),
"wiki_pipeline": asyncio.Semaphore(1),
"recall": asyncio.Semaphore(8),
"remember": asyncio.Semaphore(4),
"consolidate": asyncio.Semaphore(1), # one at a time
"seed_project": asyncio.Semaphore(1),
"wiki_pipeline": asyncio.Semaphore(1),
# default: Semaphore(4) for interactive, Semaphore(1) for batch
}


async def admit(tool_name: str, coro):
sem = _ADMISSION.get(tool_name, _default_for_class(tool_name))
async with sem:
Expand Down
3 changes: 3 additions & 0 deletions docs/provenance/pyright-remediation-plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,10 @@ authors.
Fails if any rule in --blocking has a current count > baseline count.
Reports all rules showing count deltas.
"""

import json, sys, argparse


def main():
p = argparse.ArgumentParser()
p.add_argument("current")
Expand Down Expand Up @@ -368,6 +370,7 @@ authors.
sys.exit(1)
print("\nPASS: no regressions in blocking rules")


if __name__ == "__main__":
main()
```
Expand Down
5 changes: 4 additions & 1 deletion docs/testing-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,13 @@ Async functions are tested via `asyncio.get_event_loop().run_until_complete()`:
def _run(coro):
return asyncio.get_event_loop().run_until_complete(coro)


class TestMcpRouter:
def test_returns_server_info(self):
router = create_router(mock_registry)
response = _run(router({"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {}}))
response = _run(
router({"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {}})
)
parsed = json.loads(response)
assert parsed["result"]["serverInfo"]["name"] == "methodology-agent"
```
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ dev = [
# to dependencies: a lint job that drags in pyright pays for it in cold-start
# time and in supply-chain surface).
lint = [
"ruff==0.15.20",
"ruff==0.16.0",
]
typecheck = [
"pyright==1.1.410",
Expand Down
38 changes: 19 additions & 19 deletions requirements/lint.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@
##########################################################################
# This file was autogenerated by uv via the following command:
# uv export --locked --no-emit-project --no-default-groups --format requirements.txt --only-group lint
ruff==0.15.20 \
--hash=sha256:00e188c53e499c3c1637f73c91dcf2fb56d576cab76ce1be50a27c4e80e37078 \
--hash=sha256:01cc00dd58f0df339d0e902219dd53990ea99996a0344e5d9cc8d45d5307e460 \
--hash=sha256:1416eb04349192646b54de98f146c4f59afe37d0decfc02c3cbbf396f3a28566 \
--hash=sha256:2d2374caa2f2c2f9e2b7da0a50802cfb8b79f55a9b5e49379f564544fbf56487 \
--hash=sha256:2f5b2a6d614e8700388806a14996c40fab2c47b819ef57d790a34878858ed9ca \
--hash=sha256:309809086c2acb67624950a3c8133e80f32d0d3e27106c0cd60ff26657c9f24b \
--hash=sha256:3413bb3c3d2ca6a8208f1f4809cd2dca3c6de6d0b491c0e70847672bde6e6efd \
--hash=sha256:5b9c0c367ad8e5d0d5b5b8537864c469a0a0e55417aadfbeca41fa61333be9f4 \
--hash=sha256:9ebd1fd9b9c95fc0bd7b2761aebec1f030013d2e193a2901b224af68fe47251b \
--hash=sha256:a1ed17b65293e0c2f22fc387bc13198a5de94bf4429589b0ff6946b0feaf21a3 \
--hash=sha256:a525c81c70fb0380344dd1d8745d8cc1c890b7fc94a58d5a07bd8eb9557b8415 \
--hash=sha256:b6df3b1e4610432f0386dba04d853b5f08cbbc903410c6fcc02f620f05aff53c \
--hash=sha256:bd7ec42b3bb3da066488db093308a69c4ac5ee6d2af333a86ba6e2eb2e7dd44b \
--hash=sha256:c5b16cdd67ca108185cd36dce98c576350c03b1660a751de725fb049193a0632 \
--hash=sha256:e1a36ad0eb77fba9aabfb69ede54de6f376d04ac18ebea022847046d340a8267 \
--hash=sha256:e89f198a1ea6ef0d727c1cf16088bc91a6cb0ab947dedc966715691647186eae \
--hash=sha256:ed65ef510e43a137207e0f01cfcf998aeddb1aeeda5c9d35023e910284d7cf21 \
--hash=sha256:f701305e66b38ea6c91882490eb73459796808e4c6362a1b765255e0cdcd4053
ruff==0.16.0 \
--hash=sha256:0ff4a79ce3ec0172f3241943835de1c4cb4e2dcd07f0f8c2d02603dbbbee4b17 \
--hash=sha256:14296fedcd2705c77ab8235439278bbb38f285cf7da5528b00b3e330c3d4872d \
--hash=sha256:28ea2b7df8ebf7f9da6b7d47b230ab48f387c0a29be3b474c4d0740e197bb9af \
--hash=sha256:33a3dfac8c35f81498dea9181bccc2f4c4bc8f1521a1dd9406e77643e0f0fb09 \
--hash=sha256:3c954b1d580bfa035b41654f7858cc7e71d5fc3ac5b723dd62bd9133830ed522 \
--hash=sha256:429c117f022bf481fabd9d551e7a3952b24c65e6ef44337ea09d90bebef14472 \
--hash=sha256:48044c678e9cb8698246c99b14aaccfa6601dea7379eb48a6f8f73f7a6d86cd0 \
--hash=sha256:4f11a8d11010301d0a398a2fdef67691feca7294da6aef55e2150e8fa2cd520b \
--hash=sha256:6e364e5ed22ed8dc05082fd78e35308618260907ac2d3c1d637b2e682415b6c9 \
--hash=sha256:7aa0959bad8eb8bef50340154fc9b58678dae31fa4293afa38b44b6e552c0213 \
--hash=sha256:7fab76fa065c873f41ff744347c6e77bcc3dfec4bcc754dc26b63d23c0f7f5fb \
--hash=sha256:a5237a0bda500d30d81b8e07a6973a5cbc772864cbf746ae2f4e8a2e01c9f4ed \
--hash=sha256:a9b50c55e263103586b3dcf5f73d479eb8cb5fdb6098fec59a62891dab653717 \
--hash=sha256:d327b8fc113a1d4421a04f3839d3752057c8dd1ee320223a6f3f52d04ada462a \
--hash=sha256:e01c21d10eb1b29f47b7454e1f4056db9a3f0260c646aa88457c610291db9f81 \
--hash=sha256:e460aafd5495ec89efaa6ced2e4a9a581116451e1c88b9d37ef497e0f8e93982 \
--hash=sha256:e5115729eb08c585e5121978ba5d5b60caeae394ce21b9fb5e6cd33a1c6c9b1e \
--hash=sha256:e95c448fca1fb2a18372a9440926c5a6ee789639bb975c72e7ae6d0b04218ab4
Loading