Releases: dgenio/contextweaver
Releases · dgenio/contextweaver
v0.1.3 — Progressive disclosure for tool results
What's new
This release connects the existing progressive disclosure building blocks (ViewSpec, ArtifactStore.drilldown(), ResultEnvelope.views) into a complete agent-facing workflow. Agents can now receive structured view options for tool results and drill down into specific slices incrementally.
Added
ViewRegistryclass incontext/views.py— maps content-type patterns toViewSpecgenerators- Built-in view generators for
application/json,text/csv,text/plain, and binary/image content generate_views()function for auto-generatingViewSpecentries from artifact datadrilldown_tool_spec()helper — generates aSelectableItemexposing drilldown as an agent-callable toolContextManager.drilldown()/drilldown_sync()— agent-facing wrapper forArtifactStore.drilldown()with optional context injectionContextManager.view_registryproperty for accessing/extending the view registry- Auto-generated
ViewSpecentries duringingest_tool_result()(both large and small outputs) - Auto-generated
ViewSpecentries duringapply_firewall()via view registry - Content-type detection heuristics for generic
application/octet-streamartifacts - Small tool outputs now stored in artifact store with
artifact_reffor drilldown support
How it works
ingest_tool_result(data)
→ apply_firewall(data) → artifact_store.put() → ArtifactRef
→ view_registry.generate_views(ref, data) → list[ViewSpec]
→ attach views to ResultEnvelope
→ agent sees: summary + available views
agent calls: drilldown(handle, selector)
→ artifact_store.drilldown() → slice text
→ optionally inject into context as ContextItem
Test coverage
- 32 new view tests + 13 new manager drilldown/auto-view tests
- 480 tests total, all passing
- Full CI green: ruff format, ruff check, mypy, pytest
Closes #17
Full changelog: v0.1.2...v0.1.3
v0.1.2 - Development Workflow Improvements
Added
- Sensitivity enforcement in context pipeline: items at or above
ContextPolicy.sensitivity_floorare dropped or redacted ContextItem.sensitivityfield (default:Sensitivity.public)ContextPolicy.sensitivity_actionfield ("drop"or"redact")MaskRedactionHook— built-in redaction hook replacing text with[REDACTED: {sensitivity}]apply_sensitivity_filter()function incontext/sensitivity.pyregister_redaction_hook()for user-extensible redaction hooksBuildStats.dropped_reasons["sensitivity"]tracks sensitivity-dropped item count.pre-commit-config.yamlwith ruff format, ruff check --fix, and standard file hygiene hooks
Fixed
- Validate
sensitivity_actionto reject unknown values - Use accumulation pattern for
dropped_reasons["sensitivity"] - Adjust
total_candidatesfor sensitivity drops inBuildStats
v0.1.1
[0.1.1] - 2026-03-03
Added
Catalog.hydrate(tool_id)returns aHydrationResultwith full schema, examples, and constraintsHydrationResultdataclass inenvelope.pywithto_dict()/from_dict()ContextManager.build_call_prompt()/build_call_prompt_sync()forPhase.callprompts with schema injectionSelectableItem.examplesandSelectableItem.constraintsfieldsContextManager.ingest_mcp_result()/ingest_mcp_result_sync()for one-call MCP result ingestion with artifact persistence
Changed
- Breaking:
mcp_result_to_envelope()now returns(ResultEnvelope, dict, str)tuple — envelope, extracted binary data, and full untruncated text
v0.1.0
[0.1.0] - 2026-03-03
Added
- Full CLI implementation: all 7 subcommands (demo, build, route, print-tree, init, ingest, replay) with real handlers
- MCP adapter: mcp_tool_to_selectable, mcp_result_to_envelope, load_mcp_session_jsonl
- A2A adapter: a2a_agent_to_selectable, a2a_result_to_envelope, load_a2a_session_jsonl
- Sample JSONL session files: mcp_session.jsonl, a2a_session.jsonl
- before_after.py showpiece: side-by-side token comparison WITHOUT vs WITH contextweaver
- Comprehensive test_cli.py: subprocess tests for all 7 CLI commands
- Expanded conftest.py: store_bundle, sample_context_items, sample_selectable_items, large_catalog, sample_graph, context_manager, populated_manager fixtures
- Documentation: architecture.md, concepts.md, integration_mcp.md, integration_a2a.md
- Full README.md with installation, quick start, routing, CLI, examples, and development sections
Changed
- Version bumped to 0.1.0
- Makefile ci target now includes example and demo
- Example scripts updated: mcp_adapter_demo.py and a2a_adapter_demo.py now use real adapters
v0.0.4 — Adapters, Context Manager expansion & PR fixes
What's New
Adapters
- MCP adapter (
mcp.py): convert MCP tool manifests and JSONL session logs intoSelectableItemlists - A2A adapter (
a2a.py): convert A2A agent cards and JSONL session logs intoSelectableItemlists - Shared JSONL loader (
_common.py): unified_load_session_jsonl()helper used by both adapters
Context Manager
StoreBundleconstructor for pre-wired storesingest()/ingest_sync()/ingest_async()for event log appendsingest_tool_result()with firewall integration for large outputsadd_fact()/add_episode()for episodic and factual memory storesbuild_route_prompt()integrating Router + ChoiceCards + context pipeline- Episodic memory and facts injection into prompt header
budget_tokensoverride for per-call budget control
Bug Fixes
- Budget bypass (blocker): fact/episodic injection is now pre-built and subtracted from the effective budget; overhead recorded in
BuildStats.header_footer_tokens - Firewall media_type: reads
media_typefrom item metadata instead of hardcodingtext/plain - Unbounded fact injection: capped at 64 lines / 2,000 chars (
_MAX_FACT_LINES,_MAX_FACT_CHARS) - Tag deduplication: merged
query_tagsandhintsnow usesorted(set(…)) - JSONL field validation: non-dict rows and field conversion errors wrapped in
CatalogError - Version alignment:
pyproject.tomland__init__.pyboth report0.0.4
Housekeeping
- Removed 57 accidentally committed
tmpclaude-*temp files; added pattern to.gitignore - Moved inline
from typing import Literalto module level in both adapter files - Restored full
Args/Returnsdocstrings onbuild()andbuild_sync() - Clarified
ArtifactRefentries are metadata-only in adapter docstrings
Tests
- 391 tests passing, mypy clean (38 source files), ruff clean
- New tests for adapters, firewall, manager (fact capping, budget accounting, route prompt), envelope
v0.0.3
What's New
Routing Engine (complete implementation)
- Catalog:
generate_sample_catalog,load_catalog_json,load_catalog_dictswith 8 namespace families (83 items) - KeywordLabeler: namespace detection and group summarization
- ChoiceGraph: DAG with cycle detection, validation, save/load JSON, stats
- TreeBuilder: 3 strategies — namespace grouping, Jaccard clustering, alphabetical fallback
- Router: beam search with TF-IDF scoring, confidence gap, backtracking, debug trace
- Cards:
make_choice_cards()with budget/truncation,render_cards_text() - ChoiceCard: extended with kind, namespace, has_schema, score
Refactoring
- Split
graph.pyintograph_node.py(ChoiceNode) andgraph_io.py(save/load) - Topological sort uses
heapqfor O(log n) performance - Deterministic tie-breaking throughout (beam sort, namespace labeler)
Bug Fixes
- Router backtrack threshold: was using
beam_width(2) instead oftop_k(20) from_dictedge leak: cycle-causing edges now discarded before raising- Replaced
assertwith explicitRouteErrorguard in_score_node - Added missing
from __future__ import annotationsto all__init__.py - Removed dead
item_kindsfield fromstats() - TreeBuilder validation guards for
max_childrenandtarget_group_size - Cards: index tie-break in sort,
max_desc_charsclamped to ≥4
Tests
- 105 new routing tests (338 total)
- mypy clean (37 source files), ruff clean
v0.0.2
What's Changed
Added
- RuleBasedSummarizer: concrete summarizer implementation
- StructuredExtractor: structured fact extraction (JSON, tabular, plain text)
- TiktokenEstimator: token counting via tiktoken (optional) with model name support
- EventLog: query(), children(), parent(), count(), tail() methods
- ArtifactStore: exists(), metadata(), drilldown() selectors (head, lines, json_keys, rows)
- EpisodicStore: latest(), delete() methods
- FactStore: list_keys() method
- Protocol declarations for all new EventLog and ArtifactStore methods
- Comprehensive test coverage (255 tests)
Fixed
- Version alignment: pyproject.toml now matches init.py
- License alignment: pyproject.toml now uses Apache-2.0 (matches LICENSE file)
- EventLog.query() defensive copy (was leaking internal list reference)
- _EMAIL_RE regex: removed stray pipe from [A-Z|a-z] character class
- mypy override for optional tiktoken dependency
v0.0.1 Initial Release
What's Changed
- Create complete scaffolding for contextweaver Python library by @Copilot in #1
New Contributors
- @Copilot made their first contribution in #1
Full Changelog: https://github.com/dgenio/contextweaver/commits/v0.0.1