Skip to content

Commit 82ebb19

Browse files
committed
feat(etl): add agent-native observable pipelines
Add whole-run and micro-batch async ETL scaffolds with atomic local run state, machine-readable receipts, explicit dry-run semantics, and agent-facing progress. Document the architecture boundaries, examples, import contracts, and failure/cancellation observation behavior. Closes #147.
1 parent 638d16a commit 82ebb19

23 files changed

Lines changed: 3939 additions & 19 deletions

File tree

.agents/skills/quantmind-dev/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: quantmind-dev
3-
description: Contributor workflow for the QuantMind codebase. Covers contributor setup (environment + hooks), filing issues, commit format, pull request format, and component development across quantmind/ modules (knowledge, configs, preprocess, rag, flows, mind, utils) with tests, examples, and verification. Use when setting up as a contributor, filing an issue, committing, opening a PR, or implementing/refactoring QuantMind code.
3+
description: Contributor workflow for the QuantMind codebase. Covers contributor setup (environment + hooks), filing issues, commit format, pull request format, and component development across quantmind/ modules (etl, knowledge, configs, preprocess, rag, flows, mind, utils) with tests, examples, and verification. Use when setting up as a contributor, filing an issue, committing, opening a PR, or implementing/refactoring QuantMind code.
44
---
55

66
# QuantMind Dev

.agents/skills/quantmind-dev/references/develop-components.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,34 @@ apply throughout.
3939

4040
| Module | May import from `quantmind.*` |
4141
|--------|-------------------------------|
42+
| `quantmind/etl/` | nothing (independent leaf) |
4243
| `quantmind/utils/` | nothing (leaf) |
4344
| `quantmind/knowledge/` | nothing (leaf) |
4445
| `quantmind/configs/` | `knowledge` only |
4546
| `quantmind/preprocess/` | `utils` only |
4647
| `quantmind/rag/` | `preprocess` only |
4748
| `quantmind/library/` | `knowledge` only |
4849
| `quantmind/mind/` | `knowledge`, `configs`, `utils` (retrieval is library-free; the `library` edge is reserved for the future collection path, not single-tree `retrieve`) |
49-
| `quantmind/flows/`, `quantmind/magic.py` | apex — may import all of the above |
50+
| `quantmind/flows/`, `quantmind/magic.py` | apex — may import domain layers above, but not the independent `etl` scaffold |
51+
52+
### `quantmind/etl/` — observable whole-run and micro-batch ETL
53+
54+
- Bind exactly three async stage callables to `ETLPipeline` for one whole-run
55+
delivery. Use the parallel `BatchETLPipeline` when an async producer yields
56+
business batches that each pass through transform and load. Never switch
57+
execution shape by inspecting a callable's return value, and never hide batch
58+
loads inside a whole-run transform.
59+
- Use composition rather than an ABC, subclass tree, or inheritance between the
60+
two pipeline classes. Keep batch execution strictly serial unless a later
61+
observation contract explicitly represents simultaneously active stages.
62+
- Keep it independent of every other `quantmind.*` package. Existing flows do
63+
not inherit it; their pure `input → artifact` contract remains unchanged.
64+
- Report only real completed work through `PipelineContext.progress()`. In batch
65+
mode, only a load that returns successfully increments the completed-batch
66+
count; partial-write safety remains the business load's responsibility. The
67+
scaffold owns its local lifecycle snapshots; do not add custom run-state
68+
files, a CLI, heartbeat, scheduler, retry policy, checkpoint/resume, or
69+
workflow engine. See `contexts/design/operations/etl.md`.
5070

5171
### `quantmind/knowledge/` — data standard
5272

@@ -144,10 +164,13 @@ apply throughout.
144164
A public operation is complete only when all of these agree:
145165

146166
1. A stage and name consistent with `contexts/design/operations/naming.md`.
147-
2. Typed input and config models, exported from `quantmind.configs`.
167+
2. Typed input and config models, when the operation has them, exported from
168+
the canonical owning package (`quantmind.configs` for flow configs,
169+
`quantmind.etl` for ETL run contracts, or another explicit owner).
148170
3. One intent-oriented async function, small service class, or document-scoped
149-
handle exported from `quantmind.flows`, with its result contract exported
150-
from the canonical owning layer.
171+
handle exported from its canonical owning package (`quantmind.flows`,
172+
`quantmind.etl`, `quantmind.library`, etc.), with its result contract
173+
exported from the same owning layer.
151174
4. Offline success and failure tests for the public callable, plus a
152175
magic-introspection test when a function follows the `(input, *, cfg)`
153176
convention.

.claude/skills/quantmind-dev/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: quantmind-dev
3-
description: Contributor workflow for the QuantMind codebase. Covers contributor setup (environment + hooks), filing issues, commit format, pull request format, and component development across quantmind/ modules (knowledge, configs, preprocess, rag, flows, mind, utils) with tests, examples, and verification. Use when setting up as a contributor, filing an issue, committing, opening a PR, or implementing/refactoring QuantMind code.
3+
description: Contributor workflow for the QuantMind codebase. Covers contributor setup (environment + hooks), filing issues, commit format, pull request format, and component development across quantmind/ modules (etl, knowledge, configs, preprocess, rag, flows, mind, utils) with tests, examples, and verification. Use when setting up as a contributor, filing an issue, committing, opening a PR, or implementing/refactoring QuantMind code.
44
---
55

66
# QuantMind Dev

.claude/skills/quantmind-dev/references/develop-components.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,34 @@ apply throughout.
3939

4040
| Module | May import from `quantmind.*` |
4141
|--------|-------------------------------|
42+
| `quantmind/etl/` | nothing (independent leaf) |
4243
| `quantmind/utils/` | nothing (leaf) |
4344
| `quantmind/knowledge/` | nothing (leaf) |
4445
| `quantmind/configs/` | `knowledge` only |
4546
| `quantmind/preprocess/` | `utils` only |
4647
| `quantmind/rag/` | `preprocess` only |
4748
| `quantmind/library/` | `knowledge` only |
4849
| `quantmind/mind/` | `knowledge`, `configs`, `utils` (retrieval is library-free; the `library` edge is reserved for the future collection path, not single-tree `retrieve`) |
49-
| `quantmind/flows/`, `quantmind/magic.py` | apex — may import all of the above |
50+
| `quantmind/flows/`, `quantmind/magic.py` | apex — may import domain layers above, but not the independent `etl` scaffold |
51+
52+
### `quantmind/etl/` — observable whole-run and micro-batch ETL
53+
54+
- Bind exactly three async stage callables to `ETLPipeline` for one whole-run
55+
delivery. Use the parallel `BatchETLPipeline` when an async producer yields
56+
business batches that each pass through transform and load. Never switch
57+
execution shape by inspecting a callable's return value, and never hide batch
58+
loads inside a whole-run transform.
59+
- Use composition rather than an ABC, subclass tree, or inheritance between the
60+
two pipeline classes. Keep batch execution strictly serial unless a later
61+
observation contract explicitly represents simultaneously active stages.
62+
- Keep it independent of every other `quantmind.*` package. Existing flows do
63+
not inherit it; their pure `input → artifact` contract remains unchanged.
64+
- Report only real completed work through `PipelineContext.progress()`. In batch
65+
mode, only a load that returns successfully increments the completed-batch
66+
count; partial-write safety remains the business load's responsibility. The
67+
scaffold owns its local lifecycle snapshots; do not add custom run-state
68+
files, a CLI, heartbeat, scheduler, retry policy, checkpoint/resume, or
69+
workflow engine. See `contexts/design/operations/etl.md`.
5070

5171
### `quantmind/knowledge/` — data standard
5272

@@ -144,10 +164,13 @@ apply throughout.
144164
A public operation is complete only when all of these agree:
145165

146166
1. A stage and name consistent with `contexts/design/operations/naming.md`.
147-
2. Typed input and config models, exported from `quantmind.configs`.
167+
2. Typed input and config models, when the operation has them, exported from
168+
the canonical owning package (`quantmind.configs` for flow configs,
169+
`quantmind.etl` for ETL run contracts, or another explicit owner).
148170
3. One intent-oriented async function, small service class, or document-scoped
149-
handle exported from `quantmind.flows`, with its result contract exported
150-
from the canonical owning layer.
171+
handle exported from its canonical owning package (`quantmind.flows`,
172+
`quantmind.etl`, `quantmind.library`, etc.), with its result contract
173+
exported from the same owning layer.
151174
4. Offline success and failure tests for the public callable, plus a
152175
magic-introspection test when a function follows the `(input, *, cfg)`
153176
convention.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,14 @@ docs/superpowers/
2929

3030
# Coverage artifacts (generated by pytest --cov)
3131
.coverage
32+
.coverage.*
3233
htmlcov/
3334
coverage.xml
3435

3536
# macOS
3637
.DS_Store
3738

3839
# Ephemeral local scratch (temp dirs, e2e harness output)
40+
.quant-mind/
3941
temp/
4042
tmp/

AGENTS.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ The canonical, always-current statement lives in
4646

4747
| Module | Role |
4848
|--------|------|
49+
| `quantmind/etl/` | Stdlib-only, observable whole-run and micro-batch `extract → transform → load` authoring scaffolds — independent leaf |
4950
| `quantmind/knowledge/` | Pydantic data standard (`FlattenKnowledge` / `TreeKnowledge` / `GraphKnowledge`) — dependency leaf |
5051
| `quantmind/library/` | Local persistence and semantic retrieval for canonical knowledge — depends only on `knowledge` |
5152
| `quantmind/configs/` | Operation cfg + typed input models or unions (`BaseFlowCfg`, `NewsWindow`, `PaperInput`) — depends only on `knowledge` |
@@ -131,6 +132,13 @@ the user explicitly authorizes it — fix the underlying issue instead.
131132
`BaseKnowledge`. Accept modest redundancy to keep artifacts self-contained.
132133
Half-finished intermediates stay component seams, not public flows. See
133134
`contexts/design/operations/orchestration.md`.
135+
10. **ETL execution stays separate from flows** — use
136+
`quantmind.etl.ETLPipeline` for one whole-run delivery and
137+
`BatchETLPipeline` for repeated business-batch deliveries. Call
138+
`ctx.progress()` in long loops so the next Agent can observe real completed
139+
work; do not write custom run-state files. Both are composition-based
140+
authoring scaffolds, not base classes for `quantmind.flows`. See
141+
`contexts/design/operations/etl.md`.
134142

135143
## Tests and Examples
136144

contexts/CONTEXT_MAP.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ contexts/
2828
│ ├── library/local.md ← LocalKnowledgeLibrary storage and retrieval
2929
│ ├── mind/retrieval.md ← page-preserving structure tree + agentic retrieval
3030
│ ├── operations/
31+
│ │ ├── etl.md ← whole-run vs micro-batch ETL execution and observation
3132
│ │ ├── naming.md ← public operation naming rules
3233
│ │ └── orchestration.md ← pipelines vs components (altitude)
3334
│ ├── preprocess/pdf.md ← page-aware ParsedDocument

contexts/design/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ This directory records QuantMind engineering decisions. Use it to understand whi
2828
| Mind | [Build and retrieve from a page-preserving structure tree](mind/retrieval.md) |
2929
| Operations | [Public operation naming](operations/naming.md) |
3030
| Operations | [Orchestration and construction altitude](operations/orchestration.md) |
31+
| Operations | [Observable whole-run and micro-batch ETL](operations/etl.md) |
3132
| Utils | [Cross-provider structured output](utils/structured_output.md) |
3233
| Utils | [Collect per-run token and timing usage from SDK traces](utils/usage.md) |
3334

0 commit comments

Comments
 (0)