Real-World Examples
See H2C blocks used in build, test and context-management workflows. The examples show the messages and the state they carry.
Example workflows
Example 1: Weather API Service
Challenge
This example plans a Python weather API with caching and rate limits. The blocks show how an agent can pass the plan to build and test steps.
H2C Solution
[ARCH:PLAN]
id:weather-api|fw:python3.11|lib:[fastapi,httpx,cachetools]
auth:APIKey::env(OPENWEATHER_API_KEY)
struct:[main.py,routers/weather.py,services/weather_service.py]
notes:[cache_TTL_10min,rate-limit_60req-min]
[BUILD:EXEC]
id:m1|target:main.py|desc:setup_fastapi_app
[BUILD:DONE]
id:m1|diff:[main.py~1]|rev:1
[TEST:RUN]
id:test_weather|cmd:pytest tests/test_weather.py
[TEST:PASS]
id:test_weather|pass_count:42
[ORCH:END]
final:complete|est_token:2450
Impact
- All architectural metadata preserved
- Machine-parseable for agent coordination
- Scales to multi-agent workflows
Example 2: TODO Console App
Challenge
This example uses a C# console app and SQLite. Context updates record progress between build steps.
H2C Solution
[ARCH:PLAN]
id:todo-app|fw:dotnet8|db:sqlite|lib:[EFCore,Spectre.Console]
struct:[Program.cs,Models/,Services/,Data/]
[CTX:UPDATE]
~progress:layer=init,status=in_progress
~next:database_setup
~active_files:[Program.cs~1]
[BUILD:EXEC]
id:b1|target:Program.cs|desc:setup_dependency_injection
[CTX:UPDATE]
~progress:layer=database,status=done
~next:crud_implementation
~active_files:[Program.cs~1,Data/TodoContext.cs~1]
[TEST:RUN]
id:t1|cmd:dotnet test TodoServiceTests.cs
[ORCH:END]
final:complete|est_token:1845
Impact
- Clear cycle tracking for debugging
- Persistent state management across sessions
- Cost-effective for long-running applications
Example 3: PRUNE/COMPACT Chain
Challenge
Long workflows can collect stale details. These blocks mark what to keep and what history to summarize or set aside.
H2C Solution
[BUILD:DONE]
id:b1|diff:[src/main.py~1]|rev:5
[BUILD:DONE]
id:b2|diff:[src/utils.py~2]|rev:3
[CTX:PRUNE]
keep:[b1,b2]|pruned:[b1,b2]|reason:consolidate_old_builds
[BUILD:DONE]
id:b3|diff:[src/api.py~1]|rev:1
[CTX:COMPACT]
summary:[layer=3,status=done,files:[src/main.py~5,src/utils.py~3,src/api.py~1]]
keep_active:[src/api.py~1]
pruned_history:msg_2_to_5
[ORCH:END]
final:complete|est_token:7140
Impact
- CTX:PRUNE and CTX:COMPACT keep only active files in scope
- Scales to multi-week workflows
Example 4: Conformance Stress Test
Challenge
This 130-message fixture tests a handshake, build steps, context updates and fix cycles. The repository includes the fixture and a command to run the conformance checks.
Key Findings
- Passes the reference parser, validator, and state machine (
python3 conformance/run.py) - Exercises CTX:NEGOTIATE, PRUNE, COMPACT, FREEZE, and fix cycles in one 130-message chain
- Zero silent drops — malformed or out-of-order blocks raise explicit diagnostics
Try H2C in Your Workflow
These examples are real, validated workflows. The H2C grammar is open-source and works with any LLM.