Skip to content

feat: complete v0.1.0 implementation — CLI, examples, docs, data files#6

Merged
dgenio merged 16 commits into
mainfrom
feat/complete-v0.1-implementation
Mar 2, 2026
Merged

feat: complete v0.1.0 implementation — CLI, examples, docs, data files#6
dgenio merged 16 commits into
mainfrom
feat/complete-v0.1-implementation

Conversation

@dgenio
Copy link
Copy Markdown
Owner

@dgenio dgenio commented Mar 2, 2026

Summary

Completes all remaining gaps identified in the v0.1 audit, bringing contextweaver to a fully functional v0.1.0 release.

What changed

CLI (__main__.py)

  • All 7 subcommands now have real implementations: demo, build, route, print-tree, init, ingest, replay
  • demo runs a full end-to-end demonstration of both engines
  • ingest applies the context firewall to large tool results (>2000 chars)
  • replay re-builds context from a saved session with configurable phase/budget

Data files

  • examples/data/mcp_session.jsonl — 12-event MCP session with a tool_result >2000 chars (triggers firewall)
  • examples/data/a2a_session.jsonl — 10-event A2A session with multi-agent handoffs (Orchestrator → Data → Report agents)

Examples

  • mcp_adapter_demo.py — rewritten to use real MCP adapters, session loading, firewall integration
  • a2a_adapter_demo.py — rewritten to use real A2A adapters, multi-agent session, projected context
  • before_after.pyshowpiece: side-by-side comparison showing 70% token reduction (WITHOUT vs WITH contextweaver)

Tests

  • test_cli.py — subprocess tests for all 7 CLI commands with temp files, firewall trigger test, replay tests
  • conftest.py — 7 new fixtures: store_bundle, sample_context_items (9 items, all ItemKinds, parent_id pair, dedup pair), sample_selectable_items (30 items, 6 namespaces), large_catalog (80 items), sample_graph, context_manager, populated_manager

Documentation

  • architecture.md — package layout, pipeline stages, design principles
  • concepts.md — ContextItem, phases, firewall, ChoiceGraph, episodic memory
  • integration_mcp.md — adapter functions, JSONL format, end-to-end example
  • integration_a2a.md — adapter functions, multi-agent sessions
  • README.md — full content with installation, quick start, routing, CLI, examples

Root files

  • Version bumped to 0.1.0 in pyproject.toml and __init__.py
  • CHANGELOG.md updated with 0.1.0 entry
  • Makefile ci target now includes example and demo
  • CI workflow updated to run examples and demo

Validation

  • ✅ 397 tests pass (pytest -q)
  • ✅ mypy clean (mypy src/)
  • ✅ ruff clean (ruff check + ruff format)
  • ✅ All 6 examples run successfully
  • ✅ All 7 CLI commands work
  • before_after.py shows 70% token reduction

- Full CLI: all 7 subcommands (demo, build, route, print-tree, init, ingest, replay) with real handlers
- JSONL data files: mcp_session.jsonl (12 events, firewall trigger), a2a_session.jsonl (10 events, multi-agent)
- Examples: mcp_adapter_demo.py, a2a_adapter_demo.py rewritten with real adapters; before_after.py showpiece (70% token reduction)
- Tests: test_cli.py with subprocess tests for all 7 commands; conftest.py with 7 new fixtures (store_bundle, sample_context_items, sample_selectable_items, large_catalog, sample_graph, context_manager, populated_manager)
- Docs: architecture.md, concepts.md, integration_mcp.md, integration_a2a.md filled out
- README.md: full content with installation, quick start, routing, CLI, examples, development
- Root files: version 0.1.0, CHANGELOG.md, Makefile ci target, CI workflow with examples+demo
- All 397 tests pass, mypy clean, ruff clean, all examples run
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR completes the v0.1.0 release work for contextweaver, expanding the CLI into a fully functional entrypoint, adding end-to-end examples + sample session data, and filling out the documentation to describe the library’s architecture and integrations.

Changes:

  • Implemented real handlers for all 7 CLI subcommands and added subprocess-based CLI tests.
  • Added MCP/A2A integration examples and sample JSONL session data.
  • Expanded documentation (architecture/concepts/integrations) and bumped version to 0.1.0, updating CI to run examples + demo.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
tests/test_cli.py Adds subprocess tests covering all CLI subcommands, including ingest/firewall + replay.
tests/conftest.py Adds many reusable fixtures for stores, catalogs/graphs, and a pre-populated ContextManager.
src/contextweaver/main.py Replaces placeholder CLI with full implementations for demo/build/route/print-tree/init/ingest/replay.
src/contextweaver/init.py Bumps package version to 0.1.0.
pyproject.toml Bumps project version to 0.1.0.
examples/mcp_adapter_demo.py Updates MCP example to use real adapter functions and session ingestion.
examples/a2a_adapter_demo.py Updates A2A example to use real adapter functions and session ingestion.
examples/before_after.py Adds a “WITHOUT vs WITH contextweaver” comparison script using ContextManager + budgets.
examples/data/mcp_session.jsonl Adds a sample MCP session with a large tool result to trigger the firewall.
examples/data/a2a_session.jsonl Adds a sample multi-agent A2A session with handoffs.
docs/integration_mcp.md Adds MCP integration documentation and examples.
docs/integration_a2a.md Adds A2A integration documentation and examples.
docs/concepts.md Adds conceptual overview (ContextItem, phases, firewall, ChoiceGraph, etc.).
docs/architecture.md Adds architecture/pipeline documentation and package layout.
README.md Replaces minimal README with installation, quickstart, CLI, examples, and docs links.
Makefile Extends ci target to run examples + demo.
CHANGELOG.md Adds 0.1.0 changelog entry and notes release contents.
.github/workflows/ci.yml Updates CI workflow to run make example and make demo.

Comment thread docs/integration_a2a.md Outdated
Comment thread tests/conftest.py Outdated
Comment thread src/contextweaver/__main__.py Outdated
Comment thread docs/integration_mcp.md Outdated
Comment thread docs/integration_mcp.md Outdated
Comment thread docs/integration_mcp.md Outdated
Comment thread docs/integration_a2a.md Outdated
Comment thread tests/conftest.py Outdated
Comment thread src/contextweaver/__main__.py Outdated
Comment thread src/contextweaver/__main__.py
dgenio added 15 commits March 2, 2026 12:47
…ntegration docs

- Add missing agent_name parameter to section header and code snippet
- Fix envelope.status comment: 'success' -> 'ok' (matches actual mapping)
…manager fixture

- add_fact requires (key, value): use proper key/value pairs
- add_episode requires (episode_id, summary): add episode ID
- Consistent with patterns in __main__.py demo command
…oring

- Add --catalog required arg to 'route' subcommand
- Load items via load_catalog_json instead of reconstructing from graph IDs
- Replace dynamic __import__ with top-level SelectableItem import
- Also clean up local import in _cmd_demo (use top-level import)
- Update CLI tests: _make_graph returns (graph_path, catalog_path)
…ntegration docs

- Add missing tool_name parameter to section header and code snippet
- Fix envelope.status comment: 'success' -> 'ok' (matches actual mapping)
@dgenio dgenio merged commit e49137f into main Mar 2, 2026
3 checks passed
@dgenio dgenio deleted the feat/complete-v0.1-implementation branch March 2, 2026 14:46
dgenio added a commit that referenced this pull request Apr 15, 2026
- Move routing_config to keyword-only position in Router.__init__ to
  preserve positional argument backward compatibility (#1)
- Add two focused tests for routing_config override behavior in
  test_router.py (#2)
- Document policy omission in ProfileConfig.to_dict()/from_dict()
  docstrings with Note: blocks (#3)
- Use ContextBudget()/ScoringConfig() defaults in ProfileConfig.from_dict()
  instead of hardcoded literals to prevent drift (#4)
- Add ConfigError to contextweaver.exceptions; replace bare ValueError in
  ProfileConfig.from_preset(); export ConfigError from __init__; update
  test_config.py to assert ConfigError (#5)
- Fold answer_budget into _ROUTING_PRESETS tuple (6th element) to keep
  all preset data in a single structure (#6)
- Merge duplicate ### Added sections in CHANGELOG.md into one (#7)
dgenio pushed a commit that referenced this pull request May 16, 2026
- benchmark_delta.py: render status-bearing matrix rows as "skipped"
  with the reason text instead of treating zeroed metrics as a real
  regression (Copilot #4). +2 tests.
- benchmark.py: validate --backends against the supported set
  (tfidf, bm25, fuzzy) and exit with argparse-style code 2 on typos
  rather than a ConfigError traceback from Router init (Copilot #5).
  +2 tests.
- sweep_scoring.py: drop the unreachable
  `if default_row is not None and not default_row.is_default: pass`
  branch in render_report() (Copilot #7).
- benchmark.py: emit naive_delta.naive_tokens / cw_tokens as ints
  (counts), matching the NaiveDelta dataclass and avoiding the
  int(float(...)) coercion in renderers (Copilot #8).
- README.md / CHANGELOG.md: matrix and per_namespace live at the
  top of latest.json, not nested under routing (Copilot #2, #3).

Comments #1 (_DELIM_CHARS missing _) and #6 (sweep_scoring.py size)
are non-actionable — #1 is a false positive (underscore is already
present; verified by behavioural test on _foo_) and #6 follows the
existing scripts/ precedent (render_scorecard.py = 526 lines)
acknowledged in the PR description.

make ci: all 6 targets clean. make scorecard-check + make llms-check
also clean.
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.

2 participants