Skip to content

Merge final-refactor: full framework refactor with MemoryAgent v2, research agents, 53 agents verified#6

Merged
pr1m8 merged 55 commits into
mainfrom
final-refactor
Apr 7, 2026
Merged

Merge final-refactor: full framework refactor with MemoryAgent v2, research agents, 53 agents verified#6
pr1m8 merged 55 commits into
mainfrom
final-refactor

Conversation

@pr1m8

@pr1m8 pr1m8 commented Apr 7, 2026

Copy link
Copy Markdown
Owner

Summary

Major framework refactor completing the final-refactor branch work. Depends on submodule PRs:

  • haive-core#4
  • haive-agents#3
  • haive-games#1

Key Achievements

MemoryAgent v2 — Full memory pipeline

  • 4 memory tools (save/search/KG)
  • Auto-context pre-hook
  • KG extraction post-hook (LLM → triples)
  • Auto-summarization post-hook
  • Neo4j integration with Cypher queries
  • PostgresStore support for production

Research Agents — Multi-agent composition

  • ResearchAgent (3-stage Perplexity-style)
  • DeepResearchAgent (5-stage with shared store)
  • Tavily search + in-session RAG

Base Agent Fixes (unblocks everything)

  • LLMState default when tools present
  • Engines injected into invoke_input
  • tool_node serialization fix
  • MultiAgent passes engines to children

53/53 Agents Verified

  • Foundation (6), Conversation (6), Planning (3), Reasoning (6)
  • RAG (22 variants), Document modifiers (7)
  • Memory, Research agents

Infrastructure

  • docker-compose.yml with PostgreSQL (pgvector) + Neo4j (APOC)
  • Rich trace utility (haive.agents.utils.trace.run_traced)
  • 23 game demos all importing cleanly

Documentation

New Guides (project_docs/guides/agent/)

  • AGENT_DESIGN_PATTERNS.md — BaseGraph, state schemas, agent types, anti-patterns
  • MULTIAGENT_STATE_DESIGN.md — complex state for multi-agent systems
  • CUSTOM_NODES_AND_GRAPHS.md — custom nodes, graph patterns, sub-graphs
  • MEMORY_AGENT_GUIDE.md — memory + KG + Neo4j integration
  • STATE_SCHEMA_NOTES.md — state flow research and bug fixes
  • AGENT_STATUS_VERIFIED.md — comprehensive status table

CLAUDE.md Rewrite

  • v4 (1495 lines, stale) → v5 (536 lines, clean)
  • Added: coding standards, Pydantic patterns, testing rules, git protocol
  • Added: memory management, store config, KG extraction
  • Added: agent status survey

Architecture Docs

  • project_docs/active/architecture/state_schema_engine_gap.md
  • Package-level CLAUDE.md for haive-games

Demos Added

  • demos/agents/50_research_agent.py — Perplexity-style
  • demos/agents/51_deep_research.py — 5-stage deep research
  • demos/agents/memory_agent_e2e.py — Memory + KG + Neo4j

Test Plan

  • MemoryAgent e2e with real LLM (save → recall → KG)
  • ReactAgent + tools (calculator)
  • MultiAgent sequential + parallel
  • 53/53 agents import
  • 23/23 game demos import
  • Research agents e2e
  • PyPI packaging (next)
  • ReadTheDocs build (next)

Next Steps After Merge

  1. Version bump (0.x.x → 1.0.0)
  2. PyPI packaging
  3. ReadTheDocs build
  4. CI/CD setup

🤖 Generated with Claude Code

pr1m8 and others added 30 commits April 2, 2026 17:44
- langgraph.json with 45 graphs (27 agents + 18 games)
- .env.example with LangSmith/provider config
- Consolidated publish.yml (3-phase dependency-ordered PyPI publishing)
- Updated .readthedocs.yaml for subpackage install order
- 18 new individual game demos (demos/games/28-45)
- Interactive Play tab in games UI
- Updated submodule refs (haive-core, haive-agents, haive-games)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… remain)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
haive-agents (550 .py files, all clean):
- 21/21 top-level modules import
- 27/27 LangGraph graphs compile
- 0 dead imports, 0 unused files
- Deleted: ltm/, structured/, document/, supervisor/state/ dupes
- Fixed 7+ __init__.py files importing from deleted examples

Demos (25 agent + 23 game = 48 total):
- Updated 23_memory.py (removed deleted ltm/memory_reorganized refs)
- Added 46_chain_agent.py, 47_task_analysis.py, 48_discovery.py
- All 48 demos pass

Total cleanup this session: ~200K lines removed across 800+ files

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ROOT CAUSE: state_schema=None passed to StateGraph() which hangs
in LangGraph 0.3.34. One-line fix: `or dict` fallback.

BaseGraph now completes to_langgraph() properly (6.3s import time).
RAG variants still need node output handling fix (LangGraph
RunnableCallable wraps dict returns in Command(goto=None)).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Root cause: BaseGraph.to_langgraph() passed None to StateGraph() which
hangs in LangGraph 0.3.34. One-line fix in haive-core.

All raw StateGraph bypasses reverted:
- MultiAgent uses BaseGraph again
- Games MultiPlayerGameAgent uses DynamicGraph again
- ToT uses DynamicGraph again
- SimpleAgent.compile() falls through to base compile for BaseGraph
- 27/27 graphs compile with proper BaseGraph

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
pr1m8 and others added 25 commits April 6, 2026 17:05
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- MemoryAgent Phase 2: memory tools + KG extraction + auto-summarize
- Fixed base agent schema to use LLMState when tools present
- Fixed tool_node serialization (state.dict() -> direct messages)
- Fixed execution_mixin to inject engines into state
- Fixed MultiAgent to pass engines to child agents
- Added docker-compose.yml with PostgreSQL (pgvector) + Neo4j (APOC)
- Added architecture docs for state schema engine gap

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Neo4j schema + Cypher query integration for memory KG
- E2E demo: memory_agent_e2e.py (store + optional Neo4j)
- Full pipeline: save → extract KG → recall → query

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- AGENT_DESIGN_PATTERNS.md — how to build agents around BaseGraph
- MULTIAGENT_STATE_DESIGN.md — complex state schemas for multi-agent
- CUSTOM_NODES_AND_GRAPHS.md — custom nodes, graph patterns, sub-graphs
- MEMORY_AGENT_GUIDE.md — memory + KG integration guide
- STATE_SCHEMA_NOTES.md — state flow research and bug fixes

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replaced 1495-line bloated CLAUDE.md with clean 127-line version:
- Removed stale V3/V4 references, old examples, duplicate code
- Points to new agent design guides in project_docs/guides/agent/
- Updated imports (SimpleAgent not V3, MultiAgent not V4)
- Updated branch (final-refactor), version (5.0), date (2026-04-06)
- Added state schema quick reference
- Added docker-compose reference
- Added trace utility reference

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Added back essential instructional content:
- Python code style (type hints, early returns, naming)
- Pydantic model patterns (ConfigDict, validators, no __init__)
- Error handling (logging, no silent failures)
- System vs Human message pattern
- Testing standards (NO MOCKS, file organization)
- Git safety protocol (submodule workflow, staging rules)
- File organization (test mirrors, script dirs)
- Docstring standard (Google-style)

411 lines (was 1495 bloated → 204 too lean → 411 with standards)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Added: MemoryAgent usage, store namespaces, store config (Postgres/InMemory),
KG extraction, Neo4j integration, Cypher queries.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
30+ working, ~15 need import fix, 5 need rewrite.
Tracks every agent module with status and fix priority.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Complex Extraction, TNT, ToT, Self-Discover, Storm are older
pattern (haive.core.engine.agent), functional as-is.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- All 62 agents import successfully (55 core + 7 document modifiers)
- Fixed chain/__init__.py and storm/__init__.py missing module imports
- Discovery agent: no circular import (clean)
- MultiAgent: parallel + dynamic add/remove/create verified
- All conversation agents import OK
- Comprehensive status doc: AGENT_STATUS_VERIFIED.md

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- 50_research_agent.py — 3-stage Perplexity-style
- 51_deep_research.py — 5-stage deep research with shared RAG store

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@pr1m8 pr1m8 merged commit d42655b into main Apr 7, 2026
8 of 16 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.

1 participant