Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>pull/1/head
| @@ -49,6 +49,25 @@ The Swagger UI at http://localhost:8801/api/docs lists every generated API spec | |||||
| - **ErrorController**: 404 page | - **ErrorController**: 404 page | ||||
| - **DocsController**: Swagger UI at `/api/docs` | - **DocsController**: Swagger UI at `/api/docs` | ||||
| ## Agent memory platform (status) | |||||
| Implements [Universal-Agent-Memory-Specification.md](Universal-Agent-Memory-Specification.md) on top of this starter. API base `/api/v1`, spec in `public/api/memory-v1.openapi.json` (Swagger at `/api/docs`). Auth is `Authorization: Bearer <key>`; the tenant comes from the key. A caller without permission on a namespace gets 404. | |||||
| **Done** | |||||
| - Phase 1: tenants, principals, hashed API keys, namespaces, grants (read/write/delete/verify/admin); memories with revisions, correction (If-Match), retire/forget, idempotency keys, duplicate detection, audit events; sessions with checkpoints; health. | |||||
| - Phase 2: Markdown/text ingestion with chunking and source locators (`core/lib.Search.asp`), documents/chunks/jobs, lexical search over chunks (FTS5), `POST /recall` over memories, verification (`POST /memories/:id/verifications`), `content_trust` labelling. | |||||
| **Tooling** | |||||
| - `scripts\provision.cmd` (tenant, principal, key, namespace, grant, revoke, list, purge); see AGENTS.md section 1. Quote permission lists in PowerShell: `'"read,write"'`. | |||||
| - `scripts\export-memories.ps1` / `scripts/export-memories.sh`: dump every readable memory (set `AMK_KEY`). | |||||
| - Tests (container must be running): `bash tests/phase1-api.sh` (71 checks), `bash tests/phase2-api.sh` (45 checks). Both create and purge their own tenants. | |||||
| **Next (not started)** | |||||
| 1. Context assembly (`/context`): budgeted, deduplicated, trust-labelled bundle for an agent. | |||||
| 2. Embeddings and hybrid retrieval (needs a decision on the embedding provider). | |||||
| 3. Experiences, candidates and review; feedback (AC-18). | |||||
| 4. Import/export API, and management endpoints for namespaces, principals and grants (today only via `provision.cmd`). | |||||
| ## Configuration | ## Configuration | ||||
| - `public/web.config`: `ConnectionString` (`sqlite:/opt/axonasp/site/db/app.sqlite`), environment and UI settings. | - `public/web.config`: `ConnectionString` (`sqlite:/opt/axonasp/site/db/app.sqlite`), environment and UI settings. | ||||
| @@ -0,0 +1,37 @@ | |||||
| <# | |||||
| Fetch every memory the API key can read (follows next_cursor) and write them as one JSON array to stdout. | |||||
| $env:AMK_KEY = "amk_..." | |||||
| scripts\export-memories.ps1 > memories.json | |||||
| scripts\export-memories.ps1 -Query "status=active&type=semantic" -Full | Out-File memories.json -Encoding utf8 | |||||
| -Full adds the full content of each memory (one GET /memories/:id per item). Base URL: -Base or $env:BASE. | |||||
| #> | |||||
| param( | |||||
| [string]$Query = "", | |||||
| [switch]$Full, | |||||
| [string]$Base = $(if ($env:BASE) { $env:BASE } else { "http://localhost:8801/api/v1" }), | |||||
| [string]$Key = 'amk_734bbd0bd49099ac928a179fbe9ba1c025e796ab93203d4abd9631c2e0517099' | |||||
| ) | |||||
| $ErrorActionPreference = "Stop" | |||||
| if (-not $Key) { throw "Set `$env:AMK_KEY (or pass -Key) to an API key." } | |||||
| $headers = @{ Authorization = "Bearer $Key" } | |||||
| $all = New-Object System.Collections.Generic.List[object] | |||||
| $cursor = $null | |||||
| do { | |||||
| $q = "limit=100" | |||||
| if ($Query) { $q += "&$Query" } | |||||
| if ($cursor) { $q += "&cursor=" + [uri]::EscapeDataString($cursor) } | |||||
| $page = Invoke-RestMethod -Uri "$Base/memories?$q" -Headers $headers | |||||
| foreach ($m in $page.data) { $all.Add($m) } | |||||
| $cursor = $page.next_cursor | |||||
| } while ($cursor) | |||||
| if ($Full) { | |||||
| $detailed = foreach ($m in $all) { | |||||
| $d = Invoke-RestMethod -Uri "$Base/memories/$($m.id)" -Headers $headers | |||||
| if ($d.data) { $d.data } else { $d } | |||||
| } | |||||
| $all = New-Object System.Collections.Generic.List[object] | |||||
| foreach ($d in $detailed) { $all.Add($d) } | |||||
| } | |||||
| ConvertTo-Json -InputObject ([object[]]$all.ToArray()) -Depth 20 | |||||
| @@ -0,0 +1,29 @@ | |||||
| #!/usr/bin/env bash | |||||
| # Fetch every memory the API key can read (follows next_cursor) and print them as one JSON array. | |||||
| # AMK_KEY=amk_... bash scripts/export-memories.sh [extra query, e.g. "status=active&type=semantic"] > memories.json | |||||
| # Env: AMK_KEY (required), BASE (default http://localhost:8801/api/v1), FULL=1 to include the full content per memory | |||||
| # (a GET /memories/:id per item; the list endpoint returns summaries only if it does not include content). | |||||
| set -eu | |||||
| BASE=${BASE:-http://localhost:8801/api/v1} | |||||
| : "${AMK_KEY:amk_734bbd0bd49099ac928a179fbe9ba1c025e796ab93203d4abd9631c2e0517099}" | |||||
| EXTRA=${1:-} | |||||
| cursor="" | |||||
| python -I - "$BASE" "$AMK_KEY" "$EXTRA" "${FULL:-0}" <<'PY' | |||||
| import sys, json, urllib.request, urllib.parse | |||||
| base, key, extra, full = sys.argv[1:5] | |||||
| def get(path): | |||||
| req = urllib.request.Request(base + path, headers={"Authorization": "Bearer " + key}) | |||||
| with urllib.request.urlopen(req) as r: | |||||
| return json.load(r) | |||||
| out, cursor = [], None | |||||
| while True: | |||||
| q = "limit=100" + ("&" + extra if extra else "") + ("&cursor=" + urllib.parse.quote(cursor) if cursor else "") | |||||
| page = get("/memories?" + q) | |||||
| out.extend(page["data"]) | |||||
| cursor = page.get("next_cursor") | |||||
| if not cursor: | |||||
| break | |||||
| if full == "1": | |||||
| out = [get("/memories/" + m["id"]).get("data", m) for m in out] | |||||
| json.dump(out, sys.stdout, indent=2, ensure_ascii=False) | |||||
| PY | |||||
Powered by TurnKey Linux.