Skip to content
This repository was archived by the owner on Apr 8, 2026. It is now read-only.

phillipclapham/flowscript-agents

Repository files navigation

FlowScript

flowscript-agents

Python SDK for FlowScript reasoning memory

MCP server, nine framework adapters, typed reasoning queries, hash-chained audit trail.

PyPI Tests Python License: MIT


Evolution note: The architecture explored here — transport-layer interception, consolidation engine, anti-inbreeding defense, hash-chained audit trail, temporal graduation — directly informed anneal-memory, a two-layer memory system for AI agents that delivers these concepts as a zero-dependency MCP server. This repo is maintained as a reference implementation.


What This Is

flowscript-agents is the Python SDK for FlowScript reasoning memory. It provides:

  • 20 MCP tools for reasoning memory in Claude Code, Cursor, and other MCP-compatible editors
  • Nine framework adapters (LangGraph, CrewAI, Google ADK, OpenAI Agents, Pydantic AI, smolagents, LlamaIndex, Haystack, CAMEL-AI)
  • Six typed reasoning querieswhy(), tensions(), blocked(), alternatives(), whatIf(), counterfactual() — graph traversals, not text search
  • Consolidation engine — typed operations (ADD/UPDATE/RELATE/RESOLVE/NONE) where contradictions become queryable tensions instead of silent deletions
  • Hash-chained audit trail — SHA-256 linked, append-only, crash-safe, framework attribution, SIEM callbacks
  • SDK wrapper — transport-layer interception for OpenAI/Anthropic clients (agent never knows)

717 tests. Published on PyPI. MIT licensed.


Six Reasoning Queries

These are graph traversals — sub-millisecond, deterministic, no LLM calls.

Query Returns Ask when
query_why(node_id) Causal chain backward from any decision "Why did we choose this?"
query_tensions() Tradeoffs with named axes "What tradeoffs are we navigating?"
query_blocked() Blockers + downstream impact "What's stuck and what does it affect?"
query_alternatives(node_id) Options considered + outcome "What else did we consider?"
query_what_if(node_id) Forward impact analysis "What breaks if we change this?"
query_counterfactual(node_id) What would need to change "What would it take to reverse this?"

No vector store can answer these. Embedding similarity tells you what looks like your query. These queries tell you what caused, blocked, traded off against, and follows from your agent's decisions.


When Memories Contradict

Most memory systems handle contradictions by deleting. Mem0's consolidation uses ADD/UPDATE/DELETE — when facts contradict, the old one is replaced.

FlowScript doesn't delete. It relates.

When consolidation detects a contradiction, it creates a tension with a named axis. Both perspectives survive. The disagreement itself becomes queryable knowledge. This approach satisfies AGM belief revision postulates — the formal framework proving deletion is mathematically irrational for a reasoning agent.


Framework Adapters

Each adapter implements your framework's native memory interface. You don't learn a new API — you get reasoning queries on top of the one you already use.

Framework Adapter Install
LangGraph FlowScriptStoreBaseStore pip install flowscript-agents[langgraph]
CrewAI FlowScriptStorageStorageBackend pip install flowscript-agents[crewai]
Google ADK FlowScriptMemoryServiceBaseMemoryService pip install flowscript-agents[google-adk]
OpenAI Agents FlowScriptSessionSession pip install flowscript-agents[openai-agents]
Pydantic AI FlowScriptDeps → Deps + tools pip install flowscript-agents[pydantic-ai]
smolagents FlowScriptMemory → Tool protocol pip install flowscript-agents[smolagents]
LlamaIndex FlowScriptMemoryBlockBaseMemoryBlock pip install flowscript-agents[llamaindex]
Haystack FlowScriptMemoryStoreMemoryStore pip install flowscript-agents[haystack]
CAMEL-AI FlowScriptCamelMemoryAgentMemory pip install flowscript-agents[camel-ai]

All adapters expose .memory for direct query access and support with blocks for automatic session lifecycle.


What Evolved into anneal-memory

flowscript-agents explored anneal-memory delivers
Consolidation engine (ADD/UPDATE/RELATE/RESOLVE) Compression-as-cognition through session wraps
Anti-inbreeding defense (citation validation) Graduation gate + principle demotion
Hash-chained audit trail Tamper-evident compliance layer
Transport-layer SDK wrapper Compliance proxy vision (MCP interception)
9-marker FlowScript subset for compression Same subset, zero-dependency MCP
Temporal graduation (current → developing → proven → foundation) Citation-validated graduation with immune system
Continuity file compression Two-layer memory: episodes compress into identity

anneal-memory delivers these concepts without requiring notation learning, API key configuration, or framework-specific adapters. Zero dependencies. Install and go.

anneal-memory on GitHub | anneal-memory on PyPI


Documentation


Related


Built by Phill Clapham · Clapham Digital LLC

About

Reasoning memory for AI agents — drop-in for LangGraph, CrewAI, Google ADK, OpenAI Agents + 5 more. Vector stores remember what. FlowScript remembers why. 20-tool MCP server, auto-extraction, hash-chained audit trail.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages