Skip to content

Release: dev → main (wagl v0.2.0)#21

Merged
GoZumie merged 42 commits intomainfrom
dev
Mar 2, 2026
Merged

Release: dev → main (wagl v0.2.0)#21
GoZumie merged 42 commits intomainfrom
dev

Conversation

@GoZumie
Copy link
Member

@GoZumie GoZumie commented Mar 2, 2026

Release v0.2.0

Merges all recall quality phases (5–9) plus vec0.so static linking fix (v0.1.1) into main.

See the phase4-recall-quality PR for the detailed changelog.

PR Review by Greptile

Greptile Summary

This release (v0.2.0) merges phases 5–9 of the recall quality initiative plus the critical sqlite-vec static linking fix from v0.1.1.

Major additions:

  • Static sqlite-vec linking — Eliminates external .so dependency via sqlite3_auto_extension with OnceLock for thread-safe one-time registration
  • Memory graph (Phase 5) — Adds edges, pathways (derived_from), connections (related_to), link/neighbors commands, and document reconstruction
  • Intent awareness (Phase 6.5) — Term/alias mappings for canonical concepts with org/person context; enables intent-aware recall expansion
  • People & trust (Phase 5.5) — -5 to +5 trust scoring with lock capability and adjustment tracking
  • Observability (Phase 6)stats, gc, decay, audit-quality commands; salience decay with configurable half-life
  • Canonical memory (Phase 4/7)canon commands (get/set/list), recall context packs, reconcile for quality checks, sleep reflection, morning briefs
  • HTTP server (Phase 9.1) — Axum-based REST API with multi-agent namespace isolation (agent:<id> tags)
  • WebSocket streaming (Phase 9.3) — Real-time memory event broadcasts to subscribers
  • Transcript ingestion (Phase 8) — Imports OpenClaw sessions with regex-based credential redaction, size policy, and idempotent deduplication

Documentation:

  • New: MEMORY_DOCTRINE.md, CANONICALS.md, WORKFLOWS.md, OPENCLAW_INTEGRATION.md
  • Updated: sqlite-vec.md (reflects static linking), README.md (acknowledges sqlite-vec)

All changes are well-structured, include proper error handling, and maintain backward compatibility. The static linking fix significantly improves deployment ergonomics.

Confidence Score: 5/5

  • This release is safe to merge with no critical issues identified
  • All code is well-structured with proper error handling, thread safety (OnceLock), credential redaction, idempotent operations, and comprehensive documentation. The static linking fix eliminates a deployment pain point. The feature additions follow consistent patterns and maintain backward compatibility.
  • No files require special attention

Important Files Changed

Filename Overview
crates/db/src/vector_ext.rs Replaces dynamic .so loading with static linking via sqlite3_auto_extension; uses OnceLock for thread-safe one-time registration
crates/server/src/lib.rs New HTTP server with Axum providing REST API + WebSocket streaming for memory events; includes multi-agent namespace isolation
crates/db/src/lib.rs Adds memory graph (edges), intent tracking, people/trust management, stats/observability APIs; splits schema init into smaller batches for better error diagnosis
crates/cli/src/main.rs Adds 11 new commands (canon, recall, reconcile, audit-quality, sleep, trust, link, neighbors, intent, serve, ingest, reconstruct, decay, morning, gc, stats) implementing phases 5-9
crates/cli/src/ingest_cmd.rs New transcript importer with regex-based redaction (secrets, tokens, credentials), size policy enforcement, and idempotent deduplication
crates/core/src/types.rs Adds MemoryEdge, IntentItem, and MemoryHint (compact 51-byte binary format) types for graph and intent features
README.md Documents static linking of sqlite-vec (no external .so required) and adds acknowledgements section
docs/sqlite-vec.md Updated to reflect static linking approach; removes manual build instructions and .so path configuration
crates/db/Cargo.toml Adds sqlite-vec (v0.1.7-alpha.10) and libsql-ffi (v0.5) dependencies for static linking
crates/server/Cargo.toml New server crate with Axum, tower-http CORS, and tokio-stream dependencies

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    CLI[wagl CLI<br/>main.rs]
    Server[HTTP Server<br/>Axum + WebSocket]
    DB[(MemoryDb<br/>libSQL)]
    Vec[sqlite-vec<br/>static linked]
    
    CLI -->|put/query/recall| DB
    CLI -->|wagl serve| Server
    Server -->|REST API| DB
    Server -->|WebSocket events| Agents[External Agents]
    DB -->|vector search| Vec
    
    subgraph "New Phase 5-9 Features"
        Graph[Memory Graph<br/>edges/pathways]
        Intent[Intent System<br/>term mappings]
        Trust[People & Trust<br/>-5 to +5 scale]
        Ingest[Transcript Ingest<br/>redaction + dedupe]
        Canon[Canonical Memory<br/>single source of truth]
    end
    
    DB --> Graph
    DB --> Intent
    DB --> Trust
    CLI -->|wagl ingest| Ingest
    Ingest --> DB
    CLI -->|wagl canon| Canon
    Canon --> DB
    
    style Vec fill:#e1f5ff
    style Server fill:#fff4e1
    style Graph fill:#e8f5e9
    style Intent fill:#e8f5e9
    style Trust fill:#e8f5e9
    style Ingest fill:#e8f5e9
    style Canon fill:#e8f5e9
Loading

Last reviewed commit: e9d8a8b

GoZumie and others added 30 commits March 1, 2026 04:04
Closes #17

Before this change, wagl hard-coded the build-tree path
'third_party/sqlite-vec/linux-x86_64/vec0.so' for loading the sqlite-vec
extension, which always failed for standalone binary installs.

Now resolve_vec_path() searches in priority order:
1. SQLITE_VEC_PATH env var (explicit override — always wins)
2. Next to the wagl binary (<exe-dir>/vec0.so)
3. System lib: /usr/local/lib/vec0.so
4. User lib: ~/.wagl/lib/vec0.so
5. Build-tree fallback (dev environments only)

For standalone installs, copying vec0.so next to the binary or to
/usr/local/lib/ is now sufficient — no env var required.

Also:
- Update docs/sqlite-vec.md to document the search order and install guide
- Add README acknowledgement for sqlite-vec (MIT, by Alex Garcia)
- Add README section on optional vector embeddings setup
Replace runtime .so loading with compile-time static linking via the
sqlite-vec crate (MIT/Apache-2.0). sqlite3_auto_extension() registers
sqlite3_vec_init on every new libsql connection automatically.

Users no longer need to build or ship vec0.so. Configure
WAGL_EMBEDDINGS_BASE_URL and WAGL_EMBEDDINGS_MODEL and wagl handles the rest.

Closes #17

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
P1 — move register_sqlite_vec() before db.connect()
sqlite3_auto_extension only applies to connections opened *after*
registration. The previous order (register after connect) meant the
first connection never got vec0 initialized, causing probe_vec to fail.

P2 — replace Once + mutable result with OnceLock<Result<(), String>>
The Once pattern silently returned Ok(()) on subsequent calls even when
the initial sqlite3_auto_extension failed (the closure doesn't re-run,
so the local result variable was never set to Err). OnceLock stores and
replays the actual outcome of the one-time registration.

docs — correct 'not exercised' to 'not registered'
When embeddings are not configured, register_sqlite_vec() is never
called at all (guarded by embeddings_configured()). The doc previously
implied it was registered but idle.
…n estimation, canon hygiene

4.1: Composite scoring in recall — weighted formula: semantic×0.5 + salience×0.2 + recency×0.15 + EV×0.15.
     Falls back gracefully to text query when embeddings/vec0 unavailable.
4.2: Enhanced why_included annotations with match reason, salience, type, relative date, composite score.
4.3: Token estimation (meta.token_estimate) in recall output.
4.4: Canon duplicate detection — canon list now includes warnings for duplicate canon tags.
4.5: Canon name validation — enforces [a-z][a-z0-9._-]* naming convention on get/set.
…ways, connections

5.1: memory_edges table (source_id, target_id, relation, weight, created_at).
5.2: wagl link command — create edges between memory items.
     Validates both items exist and relation is valid (derived_from, related_to, depends_on, supersedes).
5.3: wagl neighbors command — list connected memories (1-hop) with direction, relation, weight.
5.4: --derived-from on put — auto-creates a derived_from (pathway) edge.
5.5: --connection on put — auto-creates related_to (connection) edges (repeatable).
5.6: Multi-hop traversal — wagl neighbors --depth N with BFS.
     DB methods: put_edge, edges_from, edges_to, neighbors, delete_edge.
6.1: wagl stats — rich statistics: counts by type, avg salience, embedding coverage %,
     oldest/newest items, top N tags, edge count, expertise breakdown, recollection level.
6.2: wagl gc — garbage collection with dry-run by default. Prunes items below salience
     threshold + older than N days. Protects canon items. Cleans up embeddings + edges.
     DB: added delete(), count_by_type(), avg_salience(), date_range(), top_tags(), edge_count().
…command

7.1: Support posture — sleep now emits a time-bounded support posture with signals
     (stress detection, positive momentum, commitment overload). Valid for 24h.
7.4: wagl morning — loads canon items + active commitments (7d window) + recent context
     (1d) + token estimate. Replaces 'human re-teaches every session' pattern.
GoZumie and others added 11 commits March 1, 2026 18:54
…on update proposals

6.3: Reconcile improvements — detect items with no tags, orphaned edges, stale canon items (>30d).
6.4: wagl decay — salience decay with configurable half-life and floor. Dry-run by default.
     DB: added update_salience(), conn_ref().
7.2: Canon update proposals in sleep — existing canon items get update suggestions
     when recent stream items overlap topically. Shows current text + relevant items.
5.5.1: People memory type — type 'people' with trust_level (-5 to 5, default 0).
5.5.2: Trust adjustment workflow — wagl trust adjust with reason logging as observations.
       Adjustments are linked to person via memory_edges.
5.5.3: Link people to memories — person:<name> tagging; trust get shows linked observations.
5.5.4: Observation surfacing — observations tagged with person names surface in trust get.
       DB: added update_item() for in-place updates.
Reconcile now flags items tagged type:hypothesis + expires:<date> when the
expiration date has passed. Suggests review/update/delete/extend actions.
…construction (5.7)

- New IntentItem type for term/alias mapping (canonical_term -> alias, per org/person)
- DB table 'intents' with CRUD methods + search
- CLI: wagl intent add/list/search/delete subcommands
- CLI: wagl reconstruct <id> follows derived_from edges and reassembles document
- Status output now includes intent_count
- DB helper methods: intent_aliases_for, intent_canonicals_for (for 6.5.3)
Recall now searches intent aliases to expand query terms. If task text
matches an intent alias or canonical term, related aliases are also
searched, merging additional results into the recall pack.
Expanded terms are included in meta output.
- wagl ingest transcripts: reads OpenClaw session JSONL files
- Redaction pipeline: scrubs bearer tokens, API keys, JWTs, URL creds, SSH keys
- Size policy: truncates turns above configurable threshold (default 2000 chars)
- Dedupe via sessionId+turnIndex key (idempotent)
- Recollection-governed: respects RECOLLECTION level
- Supports --dry-run, --days, --limit, --size-threshold
- New wagl-server crate: axum-based HTTP API wrapping DB layer
- Endpoints: GET/POST /items, GET /items/:id, DELETE /items/:id
- Endpoints: GET /intents, POST /intents, DELETE /intents/:id
- GET /status, GET /health
- CORS permissive, JSON envelope {ok, data}
- wagl serve --bind (default 127.0.0.1:3773)
- MemoryHint: 51-byte compact hint (UUID+score+type+32-byte vector)
- Encode/decode to bytes, JSON serialization, type_code mapping
- Server now holds broadcast channel; put/delete emit MemoryEvents
- GET /ws WebSocket endpoint: agents receive live memory updates
- Handles ping/pong, graceful disconnect, lag notifications
- Phase 9.4: agent namespace via 'agent:<id>' tags
- CLI wagl put --agent <id> injects namespace tag
- CLI wagl query --agent <id> filters to agent namespace
- HTTP API: PUT /items accepts agent_id, GET /items?agent_id= filters
- ingest: track turns_deduped separately from turns_imported
  Previously, re-running the same sessions would count all turns as
  'imported' again. Now deduped turns are counted separately and
  genuinely new turns = 0 on repeat runs.
- ingest: dry-run also shows accurate deduped vs would-import split
- recall: fix intent expansion to match aliases that appear *within*
  the query (not the query within the alias). Loads all intents and
  does substring matching in Rust instead of SQL LIKE '%query%'.
  Previously 'CDS workflow' would not expand to 'clinical decision
  support'; now it correctly does.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@GoZumie GoZumie requested a review from ChrisCompton as a code owner March 2, 2026 01:06
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 18e1669965

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Merge from main introduced duplicate match arms that were already
present earlier in the match block, causing unreachable pattern warnings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e9d8a8b1fa

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@GoZumie
Copy link
Member Author

GoZumie commented Mar 2, 2026

@ChrisCompton ready for your review and merge approval

GoZumie added a commit that referenced this pull request Mar 2, 2026
- UTF-8 safe truncation in apply_size_policy (P1)
- Validate --days is non-negative (P2)
- Fetch larger set before agent_id filter to honour limit correctly (P2)
- Restore /recall and /events HTTP routes lost during rebase (P1)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@GoZumie GoZumie merged commit cbaffb8 into main Mar 2, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants