nextloop 0.4.0rc1__tar.gz → 0.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. {nextloop-0.4.0rc1/src/nextloop.egg-info → nextloop-0.5.0}/PKG-INFO +63 -18
  2. {nextloop-0.4.0rc1 → nextloop-0.5.0}/README.md +61 -17
  3. {nextloop-0.4.0rc1 → nextloop-0.5.0}/docs/adr/0003-python-and-centralized-contracts.md +1 -1
  4. nextloop-0.5.0/docs/adr/0005-pending-input.md +32 -0
  5. nextloop-0.5.0/docs/architecture/development-plan.md +71 -0
  6. nextloop-0.5.0/docs/architecture/discussion-roadmap.md +50 -0
  7. nextloop-0.5.0/docs/architecture/feature-worklist.md +34 -0
  8. {nextloop-0.4.0rc1 → nextloop-0.5.0}/docs/architecture/requirements.md +4 -4
  9. {nextloop-0.4.0rc1 → nextloop-0.5.0}/docs/design/agent-loop.md +38 -28
  10. nextloop-0.5.0/docs/design/architecture.md +69 -0
  11. {nextloop-0.4.0rc1 → nextloop-0.5.0}/docs/design/harness.md +54 -1
  12. {nextloop-0.4.0rc1 → nextloop-0.5.0}/docs/design/loop-interface.md +16 -8
  13. nextloop-0.5.0/docs/design/verification-matrix.md +91 -0
  14. nextloop-0.5.0/docs/research/2026-11-10-nextloop-optimization-review.md +197 -0
  15. {nextloop-0.4.0rc1 → nextloop-0.5.0}/pyproject.toml +2 -1
  16. {nextloop-0.4.0rc1 → nextloop-0.5.0}/src/nextloop/__init__.py +16 -0
  17. {nextloop-0.4.0rc1 → nextloop-0.5.0}/src/nextloop/adapters/anthropic.py +74 -9
  18. {nextloop-0.4.0rc1 → nextloop-0.5.0}/src/nextloop/adapters/memory.py +25 -15
  19. {nextloop-0.4.0rc1 → nextloop-0.5.0}/src/nextloop/adapters/observing.py +49 -3
  20. {nextloop-0.4.0rc1 → nextloop-0.5.0}/src/nextloop/adapters/openai.py +66 -9
  21. {nextloop-0.4.0rc1 → nextloop-0.5.0}/src/nextloop/adapters/sqlite.py +15 -1
  22. {nextloop-0.4.0rc1 → nextloop-0.5.0}/src/nextloop/contracts.py +59 -1
  23. {nextloop-0.4.0rc1 → nextloop-0.5.0}/src/nextloop/driver.py +193 -9
  24. {nextloop-0.4.0rc1 → nextloop-0.5.0}/src/nextloop/events/outcome.py +92 -2
  25. nextloop-0.5.0/src/nextloop/events/pending.py +25 -0
  26. {nextloop-0.4.0rc1 → nextloop-0.5.0}/src/nextloop/events/project.py +13 -0
  27. {nextloop-0.4.0rc1 → nextloop-0.5.0}/src/nextloop/events/repair.py +9 -4
  28. {nextloop-0.4.0rc1 → nextloop-0.5.0}/src/nextloop/execute/batch.py +21 -3
  29. nextloop-0.5.0/src/nextloop/execute/cancellation.py +29 -0
  30. nextloop-0.5.0/src/nextloop/execute/cleanup.py +22 -0
  31. {nextloop-0.4.0rc1 → nextloop-0.5.0}/src/nextloop/execute/composite.py +9 -3
  32. nextloop-0.5.0/src/nextloop/execute/mcp.py +207 -0
  33. {nextloop-0.4.0rc1 → nextloop-0.5.0}/src/nextloop/execute/model.py +64 -32
  34. nextloop-0.5.0/src/nextloop/execute/preview.py +207 -0
  35. nextloop-0.5.0/src/nextloop/execute/result_read.py +99 -0
  36. nextloop-0.5.0/src/nextloop/execute/stdio.py +219 -0
  37. nextloop-0.4.0rc1/src/nextloop/execute/stdio.py → nextloop-0.5.0/src/nextloop/execute/stdio_transport.py +90 -208
  38. {nextloop-0.4.0rc1 → nextloop-0.5.0}/src/nextloop/execute/tools.py +7 -20
  39. {nextloop-0.4.0rc1 → nextloop-0.5.0}/src/nextloop/harness.py +118 -51
  40. {nextloop-0.4.0rc1 → nextloop-0.5.0}/src/nextloop/loop.py +49 -1
  41. nextloop-0.5.0/src/nextloop/testing.py +308 -0
  42. {nextloop-0.4.0rc1 → nextloop-0.5.0/src/nextloop.egg-info}/PKG-INFO +63 -18
  43. {nextloop-0.4.0rc1 → nextloop-0.5.0}/src/nextloop.egg-info/SOURCES.txt +29 -0
  44. nextloop-0.5.0/tests/test_budgets.py +228 -0
  45. {nextloop-0.4.0rc1 → nextloop-0.5.0}/tests/test_cli.py +1 -1
  46. nextloop-0.5.0/tests/test_complexity_regressions.py +56 -0
  47. nextloop-0.5.0/tests/test_correctness_regressions.py +174 -0
  48. nextloop-0.5.0/tests/test_fault_injection.py +131 -0
  49. nextloop-0.5.0/tests/test_fault_matrix.py +247 -0
  50. {nextloop-0.4.0rc1 → nextloop-0.5.0}/tests/test_harness.py +1 -1
  51. nextloop-0.5.0/tests/test_harness_injection.py +87 -0
  52. nextloop-0.5.0/tests/test_import_contract.py +203 -0
  53. nextloop-0.5.0/tests/test_mcp.py +169 -0
  54. nextloop-0.5.0/tests/test_mcp_hardening.py +84 -0
  55. nextloop-0.5.0/tests/test_observability_close_deadline.py +53 -0
  56. nextloop-0.5.0/tests/test_pending_inputs.py +290 -0
  57. nextloop-0.5.0/tests/test_preview.py +178 -0
  58. nextloop-0.5.0/tests/test_projection_parity.py +17 -0
  59. nextloop-0.5.0/tests/test_provider_terminal.py +105 -0
  60. nextloop-0.5.0/tests/test_result_budget_regressions.py +51 -0
  61. nextloop-0.5.0/tests/test_result_policies.py +168 -0
  62. nextloop-0.5.0/tests/test_review_regressions.py +205 -0
  63. {nextloop-0.4.0rc1 → nextloop-0.5.0}/tests/test_skills.py +1 -1
  64. nextloop-0.5.0/tests/test_store_contract.py +81 -0
  65. nextloop-0.5.0/tests/test_surface_snapshot.py +70 -0
  66. nextloop-0.4.0rc1/docs/architecture/development-plan.md +0 -47
  67. nextloop-0.4.0rc1/docs/architecture/discussion-roadmap.md +0 -53
  68. nextloop-0.4.0rc1/docs/architecture/feature-worklist.md +0 -30
  69. nextloop-0.4.0rc1/docs/design/verification-matrix.md +0 -93
  70. nextloop-0.4.0rc1/src/nextloop/execute/cleanup.py +0 -17
  71. {nextloop-0.4.0rc1 → nextloop-0.5.0}/LICENSE +0 -0
  72. {nextloop-0.4.0rc1 → nextloop-0.5.0}/MANIFEST.in +0 -0
  73. {nextloop-0.4.0rc1 → nextloop-0.5.0}/docs/adr/0001-embeddable-agent-loop.md +0 -0
  74. {nextloop-0.4.0rc1 → nextloop-0.5.0}/docs/adr/0002-dsh-aligned-agent-loop.md +0 -0
  75. {nextloop-0.4.0rc1 → nextloop-0.5.0}/docs/architecture/agent-loop-capability-review.md +0 -0
  76. {nextloop-0.4.0rc1 → nextloop-0.5.0}/docs/design/context-builder.md +0 -0
  77. {nextloop-0.4.0rc1 → nextloop-0.5.0}/docs/design/react-protocol.md +0 -0
  78. {nextloop-0.4.0rc1 → nextloop-0.5.0}/docs/design/skills.md +0 -0
  79. {nextloop-0.4.0rc1 → nextloop-0.5.0}/docs/research/2026-11-02-dsh-primary-sources.md +0 -0
  80. {nextloop-0.4.0rc1 → nextloop-0.5.0}/docs/research/2026-11-02-loop-evidence-notes.md +0 -0
  81. {nextloop-0.4.0rc1 → nextloop-0.5.0}/docs/research/2026-11-03-hermes-turn-control.md +0 -0
  82. {nextloop-0.4.0rc1 → nextloop-0.5.0}/docs/research/2026-11-03-tool-batch-failures.md +0 -0
  83. {nextloop-0.4.0rc1 → nextloop-0.5.0}/docs/research/2026-11-03-tool-call-validation.md +0 -0
  84. {nextloop-0.4.0rc1 → nextloop-0.5.0}/docs/research/2026-11-03-yomi-turn-control.md +0 -0
  85. {nextloop-0.4.0rc1 → nextloop-0.5.0}/docs/research/2026-11-06-open-source-agent-loops.md +0 -0
  86. {nextloop-0.4.0rc1 → nextloop-0.5.0}/docs/research/2026-11-06-react-tool-event-recovery.md +0 -0
  87. {nextloop-0.4.0rc1 → nextloop-0.5.0}/examples/basic.py +0 -0
  88. {nextloop-0.4.0rc1 → nextloop-0.5.0}/examples/harness-skills/echo/SKILL.md +0 -0
  89. {nextloop-0.4.0rc1 → nextloop-0.5.0}/examples/harness.toml +0 -0
  90. {nextloop-0.4.0rc1 → nextloop-0.5.0}/examples/live_smoke.py +0 -0
  91. {nextloop-0.4.0rc1 → nextloop-0.5.0}/examples/python_tools.py +0 -0
  92. {nextloop-0.4.0rc1 → nextloop-0.5.0}/examples/skills/coding/SKILL.md +0 -0
  93. {nextloop-0.4.0rc1 → nextloop-0.5.0}/examples/skills_demo.py +0 -0
  94. {nextloop-0.4.0rc1 → nextloop-0.5.0}/examples/workers/cpp_worker.cpp +0 -0
  95. {nextloop-0.4.0rc1 → nextloop-0.5.0}/examples/workers/python_worker.py +0 -0
  96. {nextloop-0.4.0rc1 → nextloop-0.5.0}/examples/workers/rust_worker.rs +0 -0
  97. {nextloop-0.4.0rc1 → nextloop-0.5.0}/setup.cfg +0 -0
  98. {nextloop-0.4.0rc1 → nextloop-0.5.0}/src/nextloop/adapters/__init__.py +0 -0
  99. {nextloop-0.4.0rc1 → nextloop-0.5.0}/src/nextloop/adapters/_sse.py +0 -0
  100. {nextloop-0.4.0rc1 → nextloop-0.5.0}/src/nextloop/cli.py +0 -0
  101. {nextloop-0.4.0rc1 → nextloop-0.5.0}/src/nextloop/events/__init__.py +0 -0
  102. {nextloop-0.4.0rc1 → nextloop-0.5.0}/src/nextloop/events/response.py +0 -0
  103. {nextloop-0.4.0rc1 → nextloop-0.5.0}/src/nextloop/events/trace.py +0 -0
  104. {nextloop-0.4.0rc1 → nextloop-0.5.0}/src/nextloop/execute/__init__.py +0 -0
  105. {nextloop-0.4.0rc1 → nextloop-0.5.0}/src/nextloop/py.typed +0 -0
  106. {nextloop-0.4.0rc1 → nextloop-0.5.0}/src/nextloop/skills.py +0 -0
  107. {nextloop-0.4.0rc1 → nextloop-0.5.0}/src/nextloop.egg-info/dependency_links.txt +0 -0
  108. {nextloop-0.4.0rc1 → nextloop-0.5.0}/src/nextloop.egg-info/entry_points.txt +0 -0
  109. {nextloop-0.4.0rc1 → nextloop-0.5.0}/src/nextloop.egg-info/requires.txt +0 -0
  110. {nextloop-0.4.0rc1 → nextloop-0.5.0}/src/nextloop.egg-info/top_level.txt +0 -0
  111. {nextloop-0.4.0rc1 → nextloop-0.5.0}/tests/test_aggregate_close.py +0 -0
  112. {nextloop-0.4.0rc1 → nextloop-0.5.0}/tests/test_events.py +0 -0
  113. {nextloop-0.4.0rc1 → nextloop-0.5.0}/tests/test_failures.py +0 -0
  114. {nextloop-0.4.0rc1 → nextloop-0.5.0}/tests/test_loop.py +0 -0
  115. {nextloop-0.4.0rc1 → nextloop-0.5.0}/tests/test_observability.py +0 -0
  116. {nextloop-0.4.0rc1 → nextloop-0.5.0}/tests/test_providers.py +0 -0
  117. {nextloop-0.4.0rc1 → nextloop-0.5.0}/tests/test_stdio.py +0 -0
  118. {nextloop-0.4.0rc1 → nextloop-0.5.0}/tests/test_stdio_cleanup.py +0 -0
  119. {nextloop-0.4.0rc1 → nextloop-0.5.0}/tests/test_stdio_frames.py +0 -0
  120. {nextloop-0.4.0rc1 → nextloop-0.5.0}/tests/test_stdio_safety.py +0 -0
  121. {nextloop-0.4.0rc1 → nextloop-0.5.0}/tests/test_stores.py +0 -0
  122. {nextloop-0.4.0rc1 → nextloop-0.5.0}/tests/test_worker_conformance.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nextloop
3
- Version: 0.4.0rc1
3
+ Version: 0.5.0
4
4
  Summary: An embeddable AgentLoop with explicit event, tool, recovery, and delivery semantics
5
5
  Author-email: 12bitsD <bis12@163.com>
6
6
  License-Expression: MIT
@@ -10,6 +10,7 @@ Classifier: Programming Language :: Python :: 3
10
10
  Classifier: Programming Language :: Python :: 3.11
11
11
  Classifier: Programming Language :: Python :: 3.12
12
12
  Classifier: Programming Language :: Python :: 3.13
13
+ Classifier: Programming Language :: Python :: 3.14
13
14
  Classifier: Typing :: Typed
14
15
  Requires-Python: >=3.11
15
16
  Description-Content-Type: text/markdown
@@ -30,16 +31,16 @@ Dynamic: license-file
30
31
 
31
32
  **Small core. Serious runtime semantics.**
32
33
 
33
- nextloop is an embeddable Python AgentLoop for developers who want to build their own agent runtime — not inherit a heavyweight framework. Deterministic ReAct execution, append-only history, explicit crash recovery, typed Tools, and committed-event observability, all in a package you can actually read.
34
+ nextloop is an embeddable Python AgentLoop for developers who want to build their own agent runtime — not inherit a heavyweight framework. Deterministic scheduling and state folding, append-only history, explicit crash recovery, typed Tools, and committed-event observability, all in a package you can actually read.
34
35
 
35
36
  **Your agent, your rules. No magic, no black box.**
36
37
 
37
- Current version: **0.4.0rc1**.
38
+ Current version: **0.5.0**.
38
39
 
39
40
  ## Install
40
41
 
41
42
  ```bash
42
- python -m pip install nextloop==0.4.0rc1
43
+ python -m pip install nextloop==0.5.0
43
44
  ```
44
45
 
45
46
  For local development:
@@ -53,26 +54,32 @@ uv pip install --python .venv/bin/python -e '.[dev]'
53
54
 
54
55
  - **Execution you can reason about.** DSH-aligned Session/Turn/Step/attempt coordinates, writer fencing, and append-only Trajectory instead of implicit runner state.
55
56
  - **Crash recovery without blind replay.** Resource locks, uncertain outcomes, crash closers, and delivery-only recovery tell you what is known, what is unknown, and what must not run twice.
56
- - **Tools without framework lock-in.** Register Python functions directly, or run persistent Rust and C++ workers over stdio JSON-RPC. Schema validation, parallel calls, and exclusive barriers are built in.
57
+ - **Tools without framework lock-in.** Register Python functions directly, connect MCP stdio servers, or run persistent Rust and C++ workers over stdio JSON-RPC. Schema validation, parallel calls, and exclusive barriers are built in.
57
58
  - **Observability from committed facts.** Structured Model/Tool/Turn traces, asynchronous Exporters, and Session history. No second execution path and no telemetry-driven control flow.
58
- - **Small, explicit integration.** Assemble Providers, Stores, Tools, and Skills with `harness.toml`, or keep everything in Python. OpenAI-compatible and Anthropic Providers are included.
59
+ - **Small, explicit integration.** Assemble Providers, Stores, Tools, and Skills with `harness.toml`, or inject your own adapters in Python. OpenAI-compatible and Anthropic Providers are included.
60
+ - **Bounded execution and context.** Optional Step, Provider-attempt, Tool, token, and deadline budgets. Large Tool Results use explicit preview/page/full policies with durable read-back.
61
+ - **Transient previews, authoritative results.** Optional OpenAI/Anthropic deltas with bounded queues and snapshot recovery. Previews never enter the EventStore, execute partial Tool Calls, or replace committed Delivery.
59
62
 
60
63
  It is a library, not an HTTP service, product bot, Router, EventBus, or multi-agent framework. **The Loop stays in your application; the decisions stay with you.**
61
64
 
62
65
  ## Under the hood
63
66
 
64
- - DSH-aligned Session/Turn/Step execution with 4D integer coordinates and writer fencing.
65
- - Append-only Trajectory and O(Δ) `surface_op` watermark projection.
66
- - In-memory `Inbox` serialization for steer and final commitment.
67
+ - Session/Turn/Step execution with 4D integer coordinates and writer fencing.
68
+ - Append-only Trajectory with `surface_op` watermark semantics and Turn-private surface snapshots.
69
+ - Log-derived Pending Input and in-memory inbox signaling for steer and final commitment.
67
70
  - Whole-batch Tool Schema validation, bounded parallel calls, and exclusive failure barriers.
68
71
  - Closed five-variant `ToolOutcome`: `Completed`, `Skipped`, `Cancelled`, `UncertainSettled`, `UncertainHanging`.
69
72
  - Bounded Provider retries, protocol correction, WorkingContext, Compaction, and cancellation.
70
73
  - SQLite and in-memory EventStores, crash closers, and delivery-only recovery.
71
74
  - OpenAI-compatible and Anthropic streaming Provider adapters.
72
75
  - Directory-based `SkillRegistry` for progressive, on-demand `SKILL.md` loading with dependency and version validation.
73
- - Strict `harness.toml` assembly, Python `module:register`, and persistent Python/Rust/C++ stdio workers.
76
+ - Strict `harness.toml` assembly, Python adapter injection, `module:register`, and persistent Python/Rust/C++ stdio workers.
77
+ - MCP stdio lifecycle, paginated catalogs, request-scoped cancellation, and no replay after crashes.
78
+ - Optional Step, model-call, Tool-call, token, and Turn-deadline budgets with structured terminal reasons.
79
+ - Turn-private surface snapshots and `PREVIEW` / `PAGED` / `FULL` Tool Result policies with `read_tool_result`.
80
+ - Optional transient `PreviewSink`, legacy-Provider snapshots, bounded queues, and RESET recovery.
74
81
  - Offline `nextloop` CLI for configuration, worker, Tool, and Skill diagnostics.
75
- - Committed-event observability with Model/Tool/Turn DTOs, asynchronous Exporters, and Session history.
82
+ - Committed-event observability with Model/Tool/Turn DTOs, asynchronous Exporters, optional Exporter lifecycle, and Session history.
76
83
 
77
84
  ## Public API
78
85
 
@@ -81,12 +88,40 @@ AgentLoop.run(TurnContext) -> TurnOutcome
81
88
  AgentLoop.steer(session_id, content, *, input_id=None) -> bool
82
89
  AgentLoop.cancel(session_id, cause="user_stop") -> bool
83
90
  AgentLoop.recover(session_id, store, delivery) -> RecoveryOutcome
91
+ AgentLoop.pending_inputs(session_id, store) -> tuple[PendingInput, ...]
84
92
  ```
85
93
 
86
- The only four Adapter protocols are `EventStore`, `ModelProvider`, `ToolRuntime`, and `DeliveryOwner`. Context projection and Compaction are built in and configured through `LoopConfig`.
94
+ Core adapter seams are `EventStore`, `ModelProvider`, `ToolRuntime`, and `DeliveryOwner`. Additional extension points include `PreviewSink`, Exporters, Skills, and stdio/MCP workers. Context projection and Compaction are built in and configured through `LoopConfig`.
95
+
96
+ ## Guarantees and non-guarantees
97
+
98
+ | Area | Guarantee | Not a guarantee |
99
+ |---|---|---|
100
+ | Accepted input | Accepted inputs are projected from the log by `input_id` and can be queried with `AgentLoop.pending_inputs`. Explicit IDs are non-empty; identical retries deduplicate, conflicting content is rejected without consuming the original. | Automatic deduplication when callers retry with a different or missing ID. |
101
+ | Delivery | Delivery is at least once; DeliveryOwner must deduplicate by stable `final_message_id`. | Exactly-once delivery or delivery without an idempotent owner. |
102
+ | Tool execution | The library never automatically replays an already dispatched Tool. | No duplicate external effect when a model reissues a call or a Tool is not idempotent. |
103
+ | Resource locks | Unresolved uncertain results block later calls sharing declared resources. | Global idempotency across different resources or Tools without resource declarations. |
104
+ | Recovery | Recovery writes crash closers; the caller starts a new Turn with projected prior messages and Pending Input. | In-place replay of the interrupted Turn or automatic execution of uncertain calls. |
105
+ | Preview | Preview is transient and cannot execute partial Tool arguments. | Preview as a durable EventStore fact or a substitute for committed Delivery. |
106
+ | Observability | Committed Events are authoritative and can be replayed for history. | The current in-memory Exporter queue as a durable outbox. |
107
+ | MCP | stdio lifecycle, paginated static catalogs, and uncertain crash handling. | Remote MCP, OAuth, dynamic `listChanged`, or non-text content mapping. |
87
108
 
88
109
  `Harness.load("harness.toml")` assembles those adapters without changing the Loop. Use `await harness.check()` for offline validation and `await harness.run("input")` for a model-backed Turn. See [Harness and extension interface](docs/design/harness.md) for the strict TOML schema, stdio protocol, lifecycle rules, and CLI.
89
110
 
111
+ Adapters can also be injected directly; caller-owned dependencies are not closed by Harness:
112
+
113
+ ```python
114
+ harness = Harness.load(
115
+ "harness.toml",
116
+ provider=my_provider,
117
+ store=my_store,
118
+ delivery=my_delivery,
119
+ tools=my_runtime,
120
+ )
121
+ ```
122
+
123
+ Use `ToolSpec(result_mode=ToolResultMode.PREVIEW | PAGED | FULL)` to control model-visible Tool output. `read_tool_result` retrieves committed full results by `event_id` and UTF-8 byte range. Use `TurnContext(preview=my_sink)` for transient Provider previews; committed Turn results still come only from `AgentLoop.run()` and the EventStore.
124
+
90
125
  ```bash
91
126
  nextloop check examples/harness.toml
92
127
  nextloop tools call python_worker__echo '{"text":"hello"}' examples/harness.toml
@@ -168,32 +203,41 @@ src/nextloop/
168
203
  events/ # pure projection, response/outcome folds, crash repair
169
204
  execute/ # model retries, Tool registration, batch scheduling
170
205
  adapters/ # SQLite, memory, OpenAI, Anthropic
206
+ testing.py # Store conformance and deterministic fault injection
171
207
  ```
172
208
 
173
209
  `events/` performs no I/O. `execute/` owns side effects and classified failures. `driver.py` only composes them.
174
210
 
175
211
  ## Verification
176
212
 
177
- The release-candidate checks cover:
213
+ The release checks cover:
178
214
 
179
215
  - text, Tool, multi-Step, mixed, empty, truncated, and malformed responses;
180
216
  - whole-batch rejection and parallel/exclusive scheduling with deterministic gates;
181
217
  - steer/final ordering, cancellation, WorkingContext, and Compaction;
182
218
  - protocol exhaustion, exact-byte retry, and partial-output failure;
219
+ - every append point on Memory and SQLite, before and after commit, with recovery and no-replay assertions;
220
+ - Tool/Delivery side-effect failures, writer takeover, late results, parallel partial completion, and repeated recovery;
221
+ - public Store conformance plus deliberately broken Store rejection;
183
222
  - resource-lock recovery, conflict prevention, and explicit release;
184
223
  - real subprocess exits during Tool execution and final delivery, followed by SQLite recovery;
185
224
  - recorded OpenAI and Anthropic SSE streams;
186
225
  - 12 live Kimi scenarios across both protocols, real Tool usage, parallel execution, recovery, steer, cancellation, Compaction, and WorkingContext;
187
- - `ruff`, `mypy`, wheel/sdist builds, `twine check`, and clean wheel installation.
226
+ - live DeepSeek text + Preview + usage and real Tool Call + Delivery smoke;
227
+ - a 10,505-event benchmark with cross-Store, incremental, and required-content parity;
228
+ - 299 offline tests, `ruff`, `mypy`, wheel/sdist builds, `twine check`, and clean wheel installation.
188
229
 
189
230
  Current limits:
190
231
 
191
232
  - nika integration is separate acceptance work.
192
- - Concurrent writers across multiple processes fail closed; they are not coordinated.
193
- - Large-asset lifecycle, backup, and GC are not part of this release candidate.
233
+ - Concurrent writers across multiple processes fail closed; they are not coordinated by time-based leases.
234
+ - Large-asset lifecycle, backup, and GC are not part of this release.
235
+ - Official OpenAI and Anthropic API acceptance remains a 1.0 hard gate; recorded streams and DeepSeek do not substitute for it.
194
236
 
195
237
  ## Documents
196
238
 
239
+ - [Architecture and import contract](docs/design/architecture.md)
240
+ - [Domain glossary](CONTEXT.md)
197
241
  - [AgentLoop design](docs/design/agent-loop.md)
198
242
  - [Public interface](docs/design/loop-interface.md)
199
243
  - [Harness and extension interface](docs/design/harness.md)
@@ -201,11 +245,12 @@ Current limits:
201
245
  - [Directory-based SkillRegistry](docs/design/skills.md)
202
246
  - [Verification matrix](docs/design/verification-matrix.md)
203
247
  - [Development plan](docs/architecture/development-plan.md)
248
+ - [Contributing](CONTRIBUTING.md) and [Security](SECURITY.md)
204
249
  - [Changelog](CHANGELOG.md)
205
- - [ADR-0002](docs/adr/0002-dsh-aligned-agent-loop.md) and [ADR-0003](docs/adr/0003-python-and-centralized-contracts.md)
250
+ - [ADR-0002](docs/adr/0002-dsh-aligned-agent-loop.md), [ADR-0003](docs/adr/0003-python-and-centralized-contracts.md), and [ADR-0005 Pending Input](docs/adr/0005-pending-input.md)
206
251
 
207
252
  ## Release
208
253
 
209
- CI covers Python 3.11, 3.12, and 3.13. A `v*` tag runs the release workflow, which verifies the package, publishes wheel and sdist to PyPI through Trusted Publishing, and creates a GitHub Release.
254
+ CI covers Python 3.11, 3.12, 3.13, and 3.14. A `v*` tag runs the release workflow, which verifies the package and benchmark, publishes wheel and sdist to PyPI through Trusted Publishing, and creates a GitHub Release.
210
255
 
211
256
  This is a public repository. Do not commit credentials, private trajectories, internal endpoints, or personal data.
@@ -2,16 +2,16 @@
2
2
 
3
3
  **Small core. Serious runtime semantics.**
4
4
 
5
- nextloop is an embeddable Python AgentLoop for developers who want to build their own agent runtime — not inherit a heavyweight framework. Deterministic ReAct execution, append-only history, explicit crash recovery, typed Tools, and committed-event observability, all in a package you can actually read.
5
+ nextloop is an embeddable Python AgentLoop for developers who want to build their own agent runtime — not inherit a heavyweight framework. Deterministic scheduling and state folding, append-only history, explicit crash recovery, typed Tools, and committed-event observability, all in a package you can actually read.
6
6
 
7
7
  **Your agent, your rules. No magic, no black box.**
8
8
 
9
- Current version: **0.4.0rc1**.
9
+ Current version: **0.5.0**.
10
10
 
11
11
  ## Install
12
12
 
13
13
  ```bash
14
- python -m pip install nextloop==0.4.0rc1
14
+ python -m pip install nextloop==0.5.0
15
15
  ```
16
16
 
17
17
  For local development:
@@ -25,26 +25,32 @@ uv pip install --python .venv/bin/python -e '.[dev]'
25
25
 
26
26
  - **Execution you can reason about.** DSH-aligned Session/Turn/Step/attempt coordinates, writer fencing, and append-only Trajectory instead of implicit runner state.
27
27
  - **Crash recovery without blind replay.** Resource locks, uncertain outcomes, crash closers, and delivery-only recovery tell you what is known, what is unknown, and what must not run twice.
28
- - **Tools without framework lock-in.** Register Python functions directly, or run persistent Rust and C++ workers over stdio JSON-RPC. Schema validation, parallel calls, and exclusive barriers are built in.
28
+ - **Tools without framework lock-in.** Register Python functions directly, connect MCP stdio servers, or run persistent Rust and C++ workers over stdio JSON-RPC. Schema validation, parallel calls, and exclusive barriers are built in.
29
29
  - **Observability from committed facts.** Structured Model/Tool/Turn traces, asynchronous Exporters, and Session history. No second execution path and no telemetry-driven control flow.
30
- - **Small, explicit integration.** Assemble Providers, Stores, Tools, and Skills with `harness.toml`, or keep everything in Python. OpenAI-compatible and Anthropic Providers are included.
30
+ - **Small, explicit integration.** Assemble Providers, Stores, Tools, and Skills with `harness.toml`, or inject your own adapters in Python. OpenAI-compatible and Anthropic Providers are included.
31
+ - **Bounded execution and context.** Optional Step, Provider-attempt, Tool, token, and deadline budgets. Large Tool Results use explicit preview/page/full policies with durable read-back.
32
+ - **Transient previews, authoritative results.** Optional OpenAI/Anthropic deltas with bounded queues and snapshot recovery. Previews never enter the EventStore, execute partial Tool Calls, or replace committed Delivery.
31
33
 
32
34
  It is a library, not an HTTP service, product bot, Router, EventBus, or multi-agent framework. **The Loop stays in your application; the decisions stay with you.**
33
35
 
34
36
  ## Under the hood
35
37
 
36
- - DSH-aligned Session/Turn/Step execution with 4D integer coordinates and writer fencing.
37
- - Append-only Trajectory and O(Δ) `surface_op` watermark projection.
38
- - In-memory `Inbox` serialization for steer and final commitment.
38
+ - Session/Turn/Step execution with 4D integer coordinates and writer fencing.
39
+ - Append-only Trajectory with `surface_op` watermark semantics and Turn-private surface snapshots.
40
+ - Log-derived Pending Input and in-memory inbox signaling for steer and final commitment.
39
41
  - Whole-batch Tool Schema validation, bounded parallel calls, and exclusive failure barriers.
40
42
  - Closed five-variant `ToolOutcome`: `Completed`, `Skipped`, `Cancelled`, `UncertainSettled`, `UncertainHanging`.
41
43
  - Bounded Provider retries, protocol correction, WorkingContext, Compaction, and cancellation.
42
44
  - SQLite and in-memory EventStores, crash closers, and delivery-only recovery.
43
45
  - OpenAI-compatible and Anthropic streaming Provider adapters.
44
46
  - Directory-based `SkillRegistry` for progressive, on-demand `SKILL.md` loading with dependency and version validation.
45
- - Strict `harness.toml` assembly, Python `module:register`, and persistent Python/Rust/C++ stdio workers.
47
+ - Strict `harness.toml` assembly, Python adapter injection, `module:register`, and persistent Python/Rust/C++ stdio workers.
48
+ - MCP stdio lifecycle, paginated catalogs, request-scoped cancellation, and no replay after crashes.
49
+ - Optional Step, model-call, Tool-call, token, and Turn-deadline budgets with structured terminal reasons.
50
+ - Turn-private surface snapshots and `PREVIEW` / `PAGED` / `FULL` Tool Result policies with `read_tool_result`.
51
+ - Optional transient `PreviewSink`, legacy-Provider snapshots, bounded queues, and RESET recovery.
46
52
  - Offline `nextloop` CLI for configuration, worker, Tool, and Skill diagnostics.
47
- - Committed-event observability with Model/Tool/Turn DTOs, asynchronous Exporters, and Session history.
53
+ - Committed-event observability with Model/Tool/Turn DTOs, asynchronous Exporters, optional Exporter lifecycle, and Session history.
48
54
 
49
55
  ## Public API
50
56
 
@@ -53,12 +59,40 @@ AgentLoop.run(TurnContext) -> TurnOutcome
53
59
  AgentLoop.steer(session_id, content, *, input_id=None) -> bool
54
60
  AgentLoop.cancel(session_id, cause="user_stop") -> bool
55
61
  AgentLoop.recover(session_id, store, delivery) -> RecoveryOutcome
62
+ AgentLoop.pending_inputs(session_id, store) -> tuple[PendingInput, ...]
56
63
  ```
57
64
 
58
- The only four Adapter protocols are `EventStore`, `ModelProvider`, `ToolRuntime`, and `DeliveryOwner`. Context projection and Compaction are built in and configured through `LoopConfig`.
65
+ Core adapter seams are `EventStore`, `ModelProvider`, `ToolRuntime`, and `DeliveryOwner`. Additional extension points include `PreviewSink`, Exporters, Skills, and stdio/MCP workers. Context projection and Compaction are built in and configured through `LoopConfig`.
66
+
67
+ ## Guarantees and non-guarantees
68
+
69
+ | Area | Guarantee | Not a guarantee |
70
+ |---|---|---|
71
+ | Accepted input | Accepted inputs are projected from the log by `input_id` and can be queried with `AgentLoop.pending_inputs`. Explicit IDs are non-empty; identical retries deduplicate, conflicting content is rejected without consuming the original. | Automatic deduplication when callers retry with a different or missing ID. |
72
+ | Delivery | Delivery is at least once; DeliveryOwner must deduplicate by stable `final_message_id`. | Exactly-once delivery or delivery without an idempotent owner. |
73
+ | Tool execution | The library never automatically replays an already dispatched Tool. | No duplicate external effect when a model reissues a call or a Tool is not idempotent. |
74
+ | Resource locks | Unresolved uncertain results block later calls sharing declared resources. | Global idempotency across different resources or Tools without resource declarations. |
75
+ | Recovery | Recovery writes crash closers; the caller starts a new Turn with projected prior messages and Pending Input. | In-place replay of the interrupted Turn or automatic execution of uncertain calls. |
76
+ | Preview | Preview is transient and cannot execute partial Tool arguments. | Preview as a durable EventStore fact or a substitute for committed Delivery. |
77
+ | Observability | Committed Events are authoritative and can be replayed for history. | The current in-memory Exporter queue as a durable outbox. |
78
+ | MCP | stdio lifecycle, paginated static catalogs, and uncertain crash handling. | Remote MCP, OAuth, dynamic `listChanged`, or non-text content mapping. |
59
79
 
60
80
  `Harness.load("harness.toml")` assembles those adapters without changing the Loop. Use `await harness.check()` for offline validation and `await harness.run("input")` for a model-backed Turn. See [Harness and extension interface](docs/design/harness.md) for the strict TOML schema, stdio protocol, lifecycle rules, and CLI.
61
81
 
82
+ Adapters can also be injected directly; caller-owned dependencies are not closed by Harness:
83
+
84
+ ```python
85
+ harness = Harness.load(
86
+ "harness.toml",
87
+ provider=my_provider,
88
+ store=my_store,
89
+ delivery=my_delivery,
90
+ tools=my_runtime,
91
+ )
92
+ ```
93
+
94
+ Use `ToolSpec(result_mode=ToolResultMode.PREVIEW | PAGED | FULL)` to control model-visible Tool output. `read_tool_result` retrieves committed full results by `event_id` and UTF-8 byte range. Use `TurnContext(preview=my_sink)` for transient Provider previews; committed Turn results still come only from `AgentLoop.run()` and the EventStore.
95
+
62
96
  ```bash
63
97
  nextloop check examples/harness.toml
64
98
  nextloop tools call python_worker__echo '{"text":"hello"}' examples/harness.toml
@@ -140,32 +174,41 @@ src/nextloop/
140
174
  events/ # pure projection, response/outcome folds, crash repair
141
175
  execute/ # model retries, Tool registration, batch scheduling
142
176
  adapters/ # SQLite, memory, OpenAI, Anthropic
177
+ testing.py # Store conformance and deterministic fault injection
143
178
  ```
144
179
 
145
180
  `events/` performs no I/O. `execute/` owns side effects and classified failures. `driver.py` only composes them.
146
181
 
147
182
  ## Verification
148
183
 
149
- The release-candidate checks cover:
184
+ The release checks cover:
150
185
 
151
186
  - text, Tool, multi-Step, mixed, empty, truncated, and malformed responses;
152
187
  - whole-batch rejection and parallel/exclusive scheduling with deterministic gates;
153
188
  - steer/final ordering, cancellation, WorkingContext, and Compaction;
154
189
  - protocol exhaustion, exact-byte retry, and partial-output failure;
190
+ - every append point on Memory and SQLite, before and after commit, with recovery and no-replay assertions;
191
+ - Tool/Delivery side-effect failures, writer takeover, late results, parallel partial completion, and repeated recovery;
192
+ - public Store conformance plus deliberately broken Store rejection;
155
193
  - resource-lock recovery, conflict prevention, and explicit release;
156
194
  - real subprocess exits during Tool execution and final delivery, followed by SQLite recovery;
157
195
  - recorded OpenAI and Anthropic SSE streams;
158
196
  - 12 live Kimi scenarios across both protocols, real Tool usage, parallel execution, recovery, steer, cancellation, Compaction, and WorkingContext;
159
- - `ruff`, `mypy`, wheel/sdist builds, `twine check`, and clean wheel installation.
197
+ - live DeepSeek text + Preview + usage and real Tool Call + Delivery smoke;
198
+ - a 10,505-event benchmark with cross-Store, incremental, and required-content parity;
199
+ - 299 offline tests, `ruff`, `mypy`, wheel/sdist builds, `twine check`, and clean wheel installation.
160
200
 
161
201
  Current limits:
162
202
 
163
203
  - nika integration is separate acceptance work.
164
- - Concurrent writers across multiple processes fail closed; they are not coordinated.
165
- - Large-asset lifecycle, backup, and GC are not part of this release candidate.
204
+ - Concurrent writers across multiple processes fail closed; they are not coordinated by time-based leases.
205
+ - Large-asset lifecycle, backup, and GC are not part of this release.
206
+ - Official OpenAI and Anthropic API acceptance remains a 1.0 hard gate; recorded streams and DeepSeek do not substitute for it.
166
207
 
167
208
  ## Documents
168
209
 
210
+ - [Architecture and import contract](docs/design/architecture.md)
211
+ - [Domain glossary](CONTEXT.md)
169
212
  - [AgentLoop design](docs/design/agent-loop.md)
170
213
  - [Public interface](docs/design/loop-interface.md)
171
214
  - [Harness and extension interface](docs/design/harness.md)
@@ -173,11 +216,12 @@ Current limits:
173
216
  - [Directory-based SkillRegistry](docs/design/skills.md)
174
217
  - [Verification matrix](docs/design/verification-matrix.md)
175
218
  - [Development plan](docs/architecture/development-plan.md)
219
+ - [Contributing](CONTRIBUTING.md) and [Security](SECURITY.md)
176
220
  - [Changelog](CHANGELOG.md)
177
- - [ADR-0002](docs/adr/0002-dsh-aligned-agent-loop.md) and [ADR-0003](docs/adr/0003-python-and-centralized-contracts.md)
221
+ - [ADR-0002](docs/adr/0002-dsh-aligned-agent-loop.md), [ADR-0003](docs/adr/0003-python-and-centralized-contracts.md), and [ADR-0005 Pending Input](docs/adr/0005-pending-input.md)
178
222
 
179
223
  ## Release
180
224
 
181
- CI covers Python 3.11, 3.12, and 3.13. A `v*` tag runs the release workflow, which verifies the package, publishes wheel and sdist to PyPI through Trusted Publishing, and creates a GitHub Release.
225
+ CI covers Python 3.11, 3.12, 3.13, and 3.14. A `v*` tag runs the release workflow, which verifies the package and benchmark, publishes wheel and sdist to PyPI through Trusted Publishing, and creates a GitHub Release.
182
226
 
183
227
  This is a public repository. Do not commit credentials, private trajectories, internal endpoints, or personal data.
@@ -8,7 +8,7 @@
8
8
 
9
9
  ### Language and dependencies
10
10
 
11
- - Python 3.11+ with native `asyncio`; CI covers 3.11, 3.12, and 3.13.
11
+ - Python 3.11+ with native `asyncio`; CI covers 3.11, 3.12, 3.13, and 3.14.
12
12
  - Standard-library `dataclasses`, `typing`, and `sqlite3`.
13
13
  - `httpx` for Provider HTTP/SSE and `jsonschema` for Tool argument validation.
14
14
  - `pytest` and `pytest-asyncio` for tests; `ruff` and `mypy` for static checks.
@@ -0,0 +1,32 @@
1
+ # ADR-0005: Pending Input as a pure log projection
2
+
3
+ Status: accepted
4
+
5
+ ## Context
6
+
7
+ `steer()` persists INPUT_ACCEPTED before writing the in-memory actor inbox. INPUT_ACCEPTED alone is not part of the model-visible projection. A crash can therefore acknowledge an input that the model never sees. Rebuilding this state in `recover()` would create another writer and another crash window.
8
+
9
+ ## Decision
10
+
11
+ The event log is the sole source of truth. The actor inbox is only a wake-up signal.
12
+
13
+ - Scan INPUT_ACCEPTED and USER_MESSAGE in seq order and match them by `input_id`.
14
+ - Accepted inputs without a corresponding USER_MESSAGE are Pending Input.
15
+ - Compute Pending Input at the start of each Turn. Recovery never writes the actor inbox.
16
+ - A new Turn commits recovered Pending as USER_MESSAGE at its first Step boundary. This consumption fact is required; injecting Pending only into a Provider request would leave it pending forever.
17
+ - Pending historical inputs appear before the new Turn's initial_input. Inputs accepted during approval suspension appear only after the corresponding Tool results.
18
+ - Inputs from cancelled or budget-terminated Turns carry into the next Turn by default.
19
+ - Active execution also uses the log's consumption state, so an input present in both the log and actor inbox is injected once.
20
+ - Pending is queryable with `input_id`, original seq, original Turn, and content. No cleanup event is introduced in this version.
21
+ - `recover()` may be called repeatedly without duplicating Pending. A crash between recover and run has the same projection.
22
+
23
+ `input_id` is the idempotency boundary. A caller retrying initial input or steer must supply the same `input_id`, or query Pending before retrying. An absent or automatically generated ID does not provide cross-crash deduplication. Explicit IDs must be non-empty. The same ID with identical content is a no-op retry; the same ID with different content is rejected before a new INPUT_ACCEPTED is committed, so the original Pending content is preserved.
24
+
25
+ No cleanup event is introduced. Pending remains visible until the caller consumes it or the protocol later defines an explicit discard fact.
26
+
27
+ ## Consequences
28
+
29
+ - Accepted inputs are not silently lost after process crashes.
30
+ - No second recovery writer or in-memory Pending copy can diverge from the log.
31
+ - Callers that blindly retry with a new ID may intentionally receive duplicate content; this is not deduplicated.
32
+ - Compaction and approval pairing must preserve Pending ordering and must not split a Tool Intent from its result.
@@ -0,0 +1,71 @@
1
+ # nextloop development and verification plan
2
+
3
+ Current stage: **0.5.0 implementation and release verification**. `0.5.0rc2` is published; later milestones are not claimed as implemented.
4
+
5
+ ## Delivery order
6
+
7
+ ```text
8
+ 0.5.0rc2: Pending Input recovery and guarantee documentation
9
+ → 0.5.0: fault matrix, Store conformance, 10k benchmark, Python 3.14, import contract
10
+ → 0.6: upcasting, operation_id, approval/resume, Compaction source ranges
11
+ → 0.7: opt-in owner leases and persistent Pending behavior
12
+ → 0.8: caller-driven durable Outbox and OTel ID mapping
13
+ → 0.9: reentrant whole-Session deletion and tombstones
14
+ → 1.0: all hard gates and official OpenAI/Anthropic acceptance
15
+ ```
16
+
17
+ Each stage requires an independent Standards / Spec / Risk review, complete regression gates, and a separate release. A design or ADR is not accepted evidence until its fault scenarios pass.
18
+
19
+ ## 0.5.0 — falsification and frozen integration paths
20
+
21
+ - `nextloop.testing` provides Store, ToolRuntime, and DeliveryOwner fault injection, including after-side-effect and after-commit failures.
22
+ - The standard Tool + steer + final scenario traverses every append point on Memory and SQLite, before and after commit, and verifies seq, Pending, resource locks, Delivery, and no Tool replay.
23
+ - Explicit scenarios cover writer takeover before dispatch, late Tool results, parallel partial completion, Compaction, and repeated recovery.
24
+ - `check_event_store()` accepts both built-in Stores and rejects unchecked writers, duplicate event IDs, and incorrect Surface implementations.
25
+ - A 10,505-event benchmark checks Memory/SQLite Conversation Projection parity and incremental/whole-history Trace parity while reporting timings.
26
+ - CI covers Python 3.11, 3.12, 3.13, and 3.14.
27
+ - Existing root re-exports and core/extras module paths are frozen without a physical package split.
28
+
29
+ See [Architecture and import contract](../design/architecture.md), [Verification matrix](../design/verification-matrix.md), and [CONTRIBUTING](../../CONTRIBUTING.md).
30
+
31
+ ## 0.6 — explicit operation and approval semantics
32
+
33
+ - Versioned, read-only Event upcasting with real historical fixtures and fail-fast unknown versions.
34
+ - `operation_id` is created and persisted with Tool Intent; new model intent receives a new ID.
35
+ - `ToolEffect = READ_ONLY | IDEMPOTENT | NON_IDEMPOTENT`, defaulting to NON_IDEMPOTENT. Default Tool-name locking applies only to unresolved uncertain outcomes and is an explicit breaking change.
36
+ - Explicit same-ID reconciliation is allowed only for READ_ONLY and IDEMPOTENT operations. It creates a Reconciliation Result notification, never a second Tool Result at the original coordinate.
37
+ - Approval distinguishes Tool Intent from dispatch, binds canonical arguments and policy versions, and uses conditional append. Approval precedes side effects; resume uses original IDs and arguments in a new Turn.
38
+ - Compaction records source seq ranges and cannot split a Tool Intent from its result.
39
+
40
+ ## 0.7 — opt-in writer leases
41
+
42
+ - `owner_id` remains optional; existing `attach_writer` behavior stays unchanged when leases are not configured.
43
+ - Same-owner restart can take over immediately. Different owners wait for expiry or explicit forced takeover.
44
+ - Store time determines expiry; heartbeat renewal is independent. Every actual dispatch retains a writer/lease check.
45
+ - SQLite promises same-host multi-process behavior only. Late results from stale writers are discarded and remain uncertain.
46
+ - Existing `steer() -> bool` remains compatible; `steer_result()` adds explicit rejection reasons.
47
+
48
+ ## 0.8 — durable, caller-driven Outbox
49
+
50
+ - Export state and cursors live outside the Event log and do not consume writer epochs.
51
+ - `export_pending(session_id=None)` is caller-driven and can enumerate Sessions with unexported closed Turns without starting recovery.
52
+ - Watermarks advance only after durable Export acknowledgement. Bounded retries record auditable gaps rather than blocking forever or pretending success.
53
+ - Trace replay uses stable OTel 128-bit trace IDs and 64-bit span IDs. No OTel Exporter implementation is included in this milestone.
54
+
55
+ ## 0.9 — whole-Session deletion
56
+
57
+ - Deletion first commits a deleting tombstone and fences writers, then deletes primary and derived local state. Interrupted deletion is reentrant.
58
+ - A Session-ID-only tombstone prevents recreation. Event-level erasure and external blob reference counting are excluded.
59
+ - SQLite verification scans DB, WAL, SHM, and rollback-journal bytes with synthetic canaries. Third-party exports and user backups are not covered.
60
+
61
+ ## 1.0 hard gates
62
+
63
+ - All Store, ToolRuntime, DeliveryOwner, negative-conformance, takeover, and recovery scenarios pass.
64
+ - The 10k benchmark and parity checks pass.
65
+ - Python 3.14 CI passes.
66
+ - Official OpenAI and Anthropic API acceptance passes. Missing official credentials blocks 1.0; DeepSeek is not a substitute.
67
+ - Documentation, ADRs, migration notes, guarantee tables, and actual behavior agree.
68
+
69
+ ## Explicit non-goals through 1.0
70
+
71
+ No streaming `async for` API, OTel Exporter implementation, remote MCP/OAuth, additional Providers, `@tool` decorator, agent-as-Tool framework, Postgres implementation, physical core/extras split, automatic replay, in-place same-Turn resume, event-level erasure, or external blob lifecycle.
@@ -0,0 +1,50 @@
1
+ # nextloop discussion and delivery roadmap
2
+
3
+ Purpose: preserve the accepted direction and remaining decision boundaries without duplicating nika's product roadmap.
4
+
5
+ Current entry: **0.5.0 falsification and integration-contract closure**. The executable implementation plan is [development-plan.md](development-plan.md).
6
+
7
+ ## Fixed guardrails
8
+
9
+ - One embeddable Loop, not a service or multi-agent framework.
10
+ - Append-only Trajectory is authoritative; Conversation and Traces are derived.
11
+ - Whole-batch validation precedes every Tool side effect.
12
+ - TOOL_CALL precedes dispatch, and a writer check follows that commit immediately before execution.
13
+ - Unknown effects stop new dispatch and are never automatically replayed.
14
+ - Every exit has one finalization path; committed finals recover by Delivery only.
15
+ - Pending Input is derived from the Event log; in-memory inboxes do not become a second authority.
16
+ - Provider connection configuration stays outside Trajectory.
17
+ - No Feishu, Wiki, concrete product Tools, or Proactive product policy in nextloop.
18
+
19
+ ## Topic closure
20
+
21
+ | Topic | Accepted direction | Current state |
22
+ |---|---|---|
23
+ | Execution and ReAct | Turn/Step driver, bounded correction, ordered steer, common finalization | Implemented; normal and terminal behavior covered |
24
+ | Model and Context | Frozen in-memory requests, external Provider configuration, append-only projection, Compaction | Implemented; recorded Adapter contracts and separately identified live smoke |
25
+ | Tool contracts | Admission, parallel/exclusive scheduling, ordered Observations, explicit uncertainty | Implemented; full append and side-effect fault scenarios covered |
26
+ | Durable state | Atomic conditional append, idempotency, writer fencing, crash closers | Implemented for single-process fencing; timed leases remain 0.7 |
27
+ | Pending Input | Log projection by `input_id` and Step-boundary consumption | Implemented; cross-process steering reasons remain 0.7 |
28
+ | Observability | Committed-event Trace projection with failure isolation | Implemented; persistent Outbox remains 0.8 |
29
+ | Schema evolution | Read-only upcasting and versioned real fixtures | 0.6, not currently claimed |
30
+ | Operation identity and approval | Persistent `operation_id`, effect declarations, approved new-Turn resume | 0.6, not currently claimed |
31
+ | Retention | Reentrant whole-Session deletion with tombstones | 0.9, not currently claimed |
32
+ | Consumer integration | Public versioned Adapters; nika is a consumer, not a dependency | Separate acceptance |
33
+ | Release | Python 3.11–3.14, frozen imports, fault matrix, benchmark, official API gates | 0.5 verifies engineering; official OpenAI/Anthropic acceptance blocks 1.0 |
34
+
35
+ ## Decision order
36
+
37
+ 1. Falsify current guarantees before freezing them.
38
+ 2. Add operation identity and approval before changing writer ownership.
39
+ 3. Add leases before promising coordinated multi-process behavior.
40
+ 4. Add persistent export acknowledgement before calling Traces durable.
41
+ 5. Add tombstones before promising deletion.
42
+ 6. Require official Provider evidence before 1.0.
43
+
44
+ The [verification matrix](../design/verification-matrix.md) is the executable checklist. Documentation alone never marks a requirement implemented.
45
+
46
+ ## Integration links
47
+
48
+ - [nika](https://github.com/12bitsD/nika) independently owns personal-agent behavior, Feishu, AgentWiki, Skills, Prompts, deployment, and Proactive behavior.
49
+ - [ADR-0002](../adr/0002-dsh-aligned-agent-loop.md) records the DSH-aligned decision and deltas.
50
+ - [Open-source evaluation](../research/2026-11-06-open-source-agent-loops.md) preserves the earlier candidate comparison.
@@ -0,0 +1,34 @@
1
+ # nextloop feature worklist
2
+
3
+ Purpose: distinguish implemented capabilities from remaining work. Executable evidence is owned by the [verification matrix](../design/verification-matrix.md).
4
+
5
+ ## Implemented in the current 0.5 line
6
+
7
+ | Feature | Implementation | Evidence |
8
+ |---|---|---|
9
+ | Turn/Step driver | 4D coordinates, append-only Events, thin orchestration | Text, Tool, multi-Step, cancellation, final-order, and budget tests |
10
+ | Response protocol | Bounded correction, terminal failures, exact-byte retry | Empty, truncated, malformed, exhaustion, retry, and partial-output tests |
11
+ | Tool scheduling | Whole-batch Schema validation, bounded parallel calls, exclusive barriers | Zero-side-effect rejection, concurrency gates, ordering, and truncation tests |
12
+ | Recovery | Crash closers, explicit uncertainty, resource locks, delivery-only retry | Every-append fault matrix, real process exits, takeover, late-result, and repeated-recovery tests |
13
+ | Pending Input | Log projection by `input_id`, query API, Step-boundary consumption | Accepted/not-consumed windows, duplicate recovery, retry, cancellation, and next-Turn tests |
14
+ | Context | Append-only projection, WorkingContext, Compaction, result preview/page/full | Projection parity, compaction, UTF-8 paging, read-back, and capacity tests |
15
+ | EventStore | Memory and SQLite, atomic conditional append, idempotency, writer checks | Public conformance plus deliberately broken Store rejection |
16
+ | Providers | OpenAI-compatible and Anthropic streaming adapters | Recorded protocol streams plus separately identified live-provider smoke |
17
+ | Observability | Model/Tool/Turn Trace DTOs, async Exporters, history | Live/history parity, failure isolation, bounded close, and 10k incremental parity |
18
+ | Integrations | Harness, directory Skills, stdio workers, MCP stdio | Offline diagnostics, subprocess conformance, lifecycle, and clean-wheel examples |
19
+ | Release contract | Frozen root/module re-exports, Python 3.11–3.14 CI | Import snapshot, complete gates, wheel/sdist, and clean-install checks |
20
+
21
+ ## Remaining work
22
+
23
+ | Feature | Target and boundary |
24
+ |---|---|
25
+ | Event upcasting | 0.6; read-only migration with real historical fixtures |
26
+ | operation_id and ToolEffect | 0.6; explicit reconciliation, not automatic replay |
27
+ | Approval and resume | 0.6; original ID/arguments, new-Turn execution |
28
+ | Time-based writer leases | 0.7; opt-in owner identity, heartbeat, expiry, and takeover |
29
+ | Durable Outbox | 0.8; caller-driven export, persistent acknowledgement, auditable gaps |
30
+ | Whole-Session deletion | 0.9; tombstones and local derived-state cleanup |
31
+ | Official OpenAI/Anthropic acceptance | 1.0 hard gate; recorded streams and DeepSeek do not substitute |
32
+ | nika product integration | Separate consumer acceptance; no Feishu/Wiki dependency enters nextloop |
33
+ | Large external-asset lifecycle | Not claimed; current large Tool Results remain in the EventStore |
34
+ | Remote MCP/OAuth and more Providers | Explicitly outside the 1.0 plan |
@@ -17,11 +17,11 @@ This map records reusable execution requirements and verification ownership. No
17
17
  | L11 | Make Tool implementations replaceable behind one contract | [ToolRuntime](../design/loop-interface.md#toolruntime) | **Generic design closed.** Consumer Schemas, resources, cancellation, unknown and assets conformance |
18
18
  | L12 | Keep one append-only event authority and derive Conversation | [Event model](../design/agent-loop.md#8-event-model-and-transaction-groups) | **Design closed.** Field schema, seq, idempotency, lease/fence, transactions and malformed history |
19
19
  | L13 | Recover from every commit window without replaying side effects | [Recovery](../design/agent-loop.md#9-recovery-and-delivery) | **Design closed.** Process-exit matrix, stale leases and persistent resource tests |
20
- | L14 | Preserve large outputs and their references | [Content access](../design/context-builder.md#content-access-and-task-performance) | **Open implementation.** Asset identity, preview, retrieval, retention, backup and GC |
20
+ | L14 | Preserve large outputs and their references | [Content access](../design/context-builder.md#content-access-and-task-performance) | **Partially implemented.** Durable full Tool Results, bounded preview/page projections, and read-back are verified; backup, GC, and external-asset lifecycle remain open |
21
21
  | L15 | Retry delivery without rerunning model or Tools | [DeliveryOwner](../design/loop-interface.md#deliveryowner) | **Design closed.** `final_message_id`, delivery_unknown, durable handoff and writer-release tests |
22
- | L16 | Prove consumer independence through public Adapters | [Loop interface](../design/loop-interface.md) | **Open.** Fake and nika Adapters pass the same suite with no Feishu/Wiki dependency |
23
- | L18 | Load third-party instruction Skills from directories on demand | [SkillRegistry](../design/skills.md) | **Implemented for 0.2.0rc1.** Metadata discovery, current-body loading, duplicate/dependency/version errors, and `skill_view` tests |
24
- | L17 | Package and release only after protocol verification | [Development plan](development-plan.md), [ADR-0003](../adr/0003-python-and-centralized-contracts.md) | **0.2.0rc1 implemented.** Tests, static checks, wheel/sdist and clean-install verification pass; CI publication and consumer smoke remain separate |
22
+ | L16 | Prove consumer independence through public Adapters | [Loop interface](../design/loop-interface.md) | **Open.** Fake Adapters and public Store conformance are implemented; nika consumer acceptance remains separate |
23
+ | L18 | Load third-party instruction Skills from directories on demand | [SkillRegistry](../design/skills.md) | **Implemented.** Metadata discovery, current-body loading, duplicate/dependency/version errors, and `skill_view` tests |
24
+ | L17 | Package and release only after protocol verification | [Development plan](development-plan.md), [ADR-0003](../adr/0003-python-and-centralized-contracts.md) | **0.5.0 implemented and verified.** The complete fault matrix, benchmark, Python 3.14, import contract, and clean package gates pass; publication and later milestones remain separate |
25
25
 
26
26
  ## Independence rule
27
27