howhard 2.0.0__tar.gz → 2.2.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 (99) hide show
  1. {howhard-2.0.0 → howhard-2.2.0}/.antigravity-plugin/plugin.json +1 -1
  2. {howhard-2.0.0 → howhard-2.2.0}/.claude-plugin/plugin.json +1 -1
  3. {howhard-2.0.0 → howhard-2.2.0}/CHANGELOG.md +25 -0
  4. howhard-2.2.0/PKG-INFO +116 -0
  5. howhard-2.2.0/README.md +90 -0
  6. howhard-2.2.0/docs/concurrency.md +124 -0
  7. howhard-2.2.0/docs/configuration.md +190 -0
  8. {howhard-2.0.0 → howhard-2.2.0}/docs/index.md +5 -1
  9. howhard-2.2.0/docs/quickstart.md +147 -0
  10. {howhard-2.0.0 → howhard-2.2.0}/docs/reference.md +14 -4
  11. {howhard-2.0.0 → howhard-2.2.0}/docs/retrieval.md +2 -0
  12. {howhard-2.0.0 → howhard-2.2.0}/docs/semantic-memory.md +16 -2
  13. {howhard-2.0.0 → howhard-2.2.0}/docs/skills.md +13 -2
  14. {howhard-2.0.0 → howhard-2.2.0}/plugin.json +1 -1
  15. {howhard-2.0.0 → howhard-2.2.0}/skills/howhard/SKILL.md +5 -0
  16. {howhard-2.0.0 → howhard-2.2.0}/skills/howhard/references/workflow.md +18 -0
  17. {howhard-2.0.0 → howhard-2.2.0}/src/howhard/__init__.py +4 -2
  18. {howhard-2.0.0 → howhard-2.2.0}/src/howhard/cli.py +22 -5
  19. {howhard-2.0.0 → howhard-2.2.0}/src/howhard/config.py +12 -1
  20. {howhard-2.0.0 → howhard-2.2.0}/src/howhard/decisions.py +6 -1
  21. {howhard-2.0.0 → howhard-2.2.0}/src/howhard/engine.py +64 -27
  22. {howhard-2.0.0 → howhard-2.2.0}/src/howhard/memory.py +54 -15
  23. {howhard-2.0.0 → howhard-2.2.0}/src/howhard/native.py +13 -1
  24. {howhard-2.0.0 → howhard-2.2.0}/src/howhard/retrieval.py +66 -39
  25. {howhard-2.0.0 → howhard-2.2.0}/src/howhard/semantic.py +6 -4
  26. {howhard-2.0.0 → howhard-2.2.0}/src/howhard/state.py +14 -17
  27. {howhard-2.0.0 → howhard-2.2.0}/src/howhard/storage.py +49 -13
  28. howhard-2.2.0/src/howhard/writes.py +186 -0
  29. howhard-2.2.0/src/howhard.egg-info/PKG-INFO +116 -0
  30. {howhard-2.0.0 → howhard-2.2.0}/src/howhard.egg-info/SOURCES.txt +5 -1
  31. howhard-2.2.0/tests/test_configured_candidates.py +176 -0
  32. howhard-2.2.0/tests/test_write_queue.py +458 -0
  33. howhard-2.0.0/PKG-INFO +0 -201
  34. howhard-2.0.0/README.md +0 -175
  35. howhard-2.0.0/docs/configuration.md +0 -110
  36. howhard-2.0.0/docs/quickstart.md +0 -156
  37. howhard-2.0.0/src/howhard.egg-info/PKG-INFO +0 -201
  38. {howhard-2.0.0 → howhard-2.2.0}/.agents/plugins/marketplace.json +0 -0
  39. {howhard-2.0.0 → howhard-2.2.0}/.claude-plugin/marketplace.json +0 -0
  40. {howhard-2.0.0 → howhard-2.2.0}/.readthedocs.yaml +0 -0
  41. {howhard-2.0.0 → howhard-2.2.0}/AGENTS.md +0 -0
  42. {howhard-2.0.0 → howhard-2.2.0}/MANIFEST.in +0 -0
  43. {howhard-2.0.0 → howhard-2.2.0}/benchmarks/__init__.py +0 -0
  44. {howhard-2.0.0 → howhard-2.2.0}/benchmarks/bench_rule_retrieval.py +0 -0
  45. {howhard-2.0.0 → howhard-2.2.0}/benchmarks/rule_cases.json +0 -0
  46. {howhard-2.0.0 → howhard-2.2.0}/benchmarks/rule_retrieval.py +0 -0
  47. {howhard-2.0.0 → howhard-2.2.0}/docs/changelog.md +0 -0
  48. {howhard-2.0.0 → howhard-2.2.0}/docs/conf.py +0 -0
  49. {howhard-2.0.0 → howhard-2.2.0}/docs/context.md +0 -0
  50. {howhard-2.0.0 → howhard-2.2.0}/docs/contributing.md +0 -0
  51. {howhard-2.0.0 → howhard-2.2.0}/docs/evaluation.md +0 -0
  52. {howhard-2.0.0 → howhard-2.2.0}/docs/releasing.md +0 -0
  53. {howhard-2.0.0 → howhard-2.2.0}/docs/requirements.txt +0 -0
  54. {howhard-2.0.0 → howhard-2.2.0}/docs/rule-benchmark.md +0 -0
  55. {howhard-2.0.0 → howhard-2.2.0}/docs/session_handoff_format.md +0 -0
  56. {howhard-2.0.0 → howhard-2.2.0}/docs/upgrading-1.0.md +0 -0
  57. {howhard-2.0.0 → howhard-2.2.0}/docs/upgrading-2.0.md +0 -0
  58. {howhard-2.0.0 → howhard-2.2.0}/pyproject.toml +0 -0
  59. {howhard-2.0.0 → howhard-2.2.0}/scripts/check +0 -0
  60. {howhard-2.0.0 → howhard-2.2.0}/scripts/check-plugins.py +0 -0
  61. {howhard-2.0.0 → howhard-2.2.0}/scripts/check-skills.py +0 -0
  62. {howhard-2.0.0 → howhard-2.2.0}/scripts/verify-wheel.py +0 -0
  63. {howhard-2.0.0 → howhard-2.2.0}/setup.cfg +0 -0
  64. {howhard-2.0.0 → howhard-2.2.0}/skills/attribute-failure/SKILL.md +0 -0
  65. {howhard-2.0.0 → howhard-2.2.0}/skills/howhard/references/accounting.md +0 -0
  66. {howhard-2.0.0 → howhard-2.2.0}/skills/howhard/references/hosts.md +0 -0
  67. {howhard-2.0.0 → howhard-2.2.0}/src/howhard/__main__.py +0 -0
  68. {howhard-2.0.0 → howhard-2.2.0}/src/howhard/accounting.py +0 -0
  69. {howhard-2.0.0 → howhard-2.2.0}/src/howhard/context.py +0 -0
  70. {howhard-2.0.0 → howhard-2.2.0}/src/howhard/data/context.toml +0 -0
  71. {howhard-2.0.0 → howhard-2.2.0}/src/howhard/data/default_config.toml +0 -0
  72. {howhard-2.0.0 → howhard-2.2.0}/src/howhard/data/semantic.toml +0 -0
  73. {howhard-2.0.0 → howhard-2.2.0}/src/howhard/files.py +0 -0
  74. {howhard-2.0.0 → howhard-2.2.0}/src/howhard/llm.py +0 -0
  75. {howhard-2.0.0 → howhard-2.2.0}/src/howhard/report.py +0 -0
  76. {howhard-2.0.0 → howhard-2.2.0}/src/howhard/selector.py +0 -0
  77. {howhard-2.0.0 → howhard-2.2.0}/src/howhard/validation.py +0 -0
  78. {howhard-2.0.0 → howhard-2.2.0}/src/howhard.egg-info/dependency_links.txt +0 -0
  79. {howhard-2.0.0 → howhard-2.2.0}/src/howhard.egg-info/entry_points.txt +0 -0
  80. {howhard-2.0.0 → howhard-2.2.0}/src/howhard.egg-info/requires.txt +0 -0
  81. {howhard-2.0.0 → howhard-2.2.0}/src/howhard.egg-info/top_level.txt +0 -0
  82. {howhard-2.0.0 → howhard-2.2.0}/tests/conftest.py +0 -0
  83. {howhard-2.0.0 → howhard-2.2.0}/tests/test_cli.py +0 -0
  84. {howhard-2.0.0 → howhard-2.2.0}/tests/test_context.py +0 -0
  85. {howhard-2.0.0 → howhard-2.2.0}/tests/test_current_contract.py +0 -0
  86. {howhard-2.0.0 → howhard-2.2.0}/tests/test_execution_accounting.py +0 -0
  87. {howhard-2.0.0 → howhard-2.2.0}/tests/test_fast_reranking.py +0 -0
  88. {howhard-2.0.0 → howhard-2.2.0}/tests/test_measurement_corrections.py +0 -0
  89. {howhard-2.0.0 → howhard-2.2.0}/tests/test_memory.py +0 -0
  90. {howhard-2.0.0 → howhard-2.2.0}/tests/test_native_startup.py +0 -0
  91. {howhard-2.0.0 → howhard-2.2.0}/tests/test_portable_core.py +0 -0
  92. {howhard-2.0.0 → howhard-2.2.0}/tests/test_retrieval.py +0 -0
  93. {howhard-2.0.0 → howhard-2.2.0}/tests/test_retrieval_config.py +0 -0
  94. {howhard-2.0.0 → howhard-2.2.0}/tests/test_rule_benchmark.py +0 -0
  95. {howhard-2.0.0 → howhard-2.2.0}/tests/test_semantic.py +0 -0
  96. {howhard-2.0.0 → howhard-2.2.0}/tests/test_semantic_cli.py +0 -0
  97. {howhard-2.0.0 → howhard-2.2.0}/tests/test_semantic_only.py +0 -0
  98. {howhard-2.0.0 → howhard-2.2.0}/tests/test_skill_workflow.py +0 -0
  99. {howhard-2.0.0 → howhard-2.2.0}/tests/test_storage.py +0 -0
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://antigravity.google/schemas/v1/plugin.json",
3
3
  "name": "howhard",
4
4
  "displayName": "howhard",
5
- "version": "2.0.0",
5
+ "version": "2.2.0",
6
6
  "description": "Recommend model and reasoning effort from task context, then learn from actual feedback through writable semantic memory.",
7
7
  "author": {"name": "howhard contributors"},
8
8
  "repository": "https://github.com/xu-hao/howhard"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "howhard",
3
- "version": "2.0.0",
3
+ "version": "2.2.0",
4
4
  "description": "Recommend model and reasoning effort from task context, then learn from actual feedback through writable semantic memory.",
5
5
  "author": {"name": "howhard contributors"},
6
6
  "repository": "https://github.com/xu-hao/howhard"
@@ -2,6 +2,31 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 2.2.0 — 2026-11-08
6
+
7
+ - Coordinate concurrent writes inside howhard with per-store FIFO admission, finite
8
+ waits, cancellation, automatic crash release and `writes --json` queue inspection.
9
+ CLI `--write-timeout` and Python cancellation/error types expose contention without
10
+ requiring agent-channel writer windows or a separate coordinator.
11
+ - Admit requests, receipts, evidence, usage amendments, memory and cache publication
12
+ through the same store queue. Keep model calls and embedding outside write turns,
13
+ let readers bypass waiting writers, and preserve independent store concurrency.
14
+ - Recheck evidence, memory revisions and learning events after admission. Preserve
15
+ append-only evidence and matching stable-ID retries; refuse stale forecasts and
16
+ conflicting patches. Unrelated historical model admission leaves disjoint inventories
17
+ usable. Document concurrency boundaries and update native skill guidance.
18
+
19
+ ## 2.1.0 — 2026-11-08
20
+
21
+ - Accept explicitly named `[inventories]` in `howhard.toml`, selected through Python
22
+ `inventory="NAME"` or CLI `--inventory NAME`. Saved lists never override the native
23
+ agent's supplied inventory automatically. Document external-router integration,
24
+ distinct provider route identities and shared project learning across providers
25
+ while retaining observed model/control attribution.
26
+
27
+ - Update the quickstart to install the published PyPI backend and explain the current
28
+ plugin, real-task, feedback and memory workflow without release-history setup notes.
29
+
5
30
  ## 2.0.0 — 2026-11-07
6
31
 
7
32
  This source version prepares the 2.0.0 release. Until the corresponding GitHub release
howhard-2.2.0/PKG-INFO ADDED
@@ -0,0 +1,116 @@
1
+ Metadata-Version: 2.4
2
+ Name: howhard
3
+ Version: 2.2.0
4
+ Summary: Choose an agent's model and reasoning effort, and learn from outcomes.
5
+ Project-URL: Repository, https://github.com/xu-hao/howhard
6
+ Project-URL: Issues, https://github.com/xu-hao/howhard/issues
7
+ Project-URL: Changelog, https://github.com/xu-hao/howhard/blob/main/CHANGELOG.md
8
+ Requires-Python: >=3.11
9
+ Description-Content-Type: text/markdown
10
+ Requires-Dist: numpy>=1.24
11
+ Requires-Dist: fastembed==0.9.1
12
+ Requires-Dist: usearch<3,>=2.21
13
+ Provides-Extra: test
14
+ Requires-Dist: pytest>=8; extra == "test"
15
+ Requires-Dist: build; extra == "test"
16
+ Requires-Dist: pytest-probability==0.3.0; extra == "test"
17
+ Provides-Extra: docs
18
+ Requires-Dist: sphinx>=8; extra == "docs"
19
+ Requires-Dist: myst-parser>=4; extra == "docs"
20
+ Requires-Dist: furo; extra == "docs"
21
+ Provides-Extra: bench
22
+ Requires-Dist: pytest-probability==0.3.0; extra == "bench"
23
+ Requires-Dist: fastembed==0.9.1; extra == "bench"
24
+ Provides-Extra: qwen
25
+ Requires-Dist: sentence-transformers<7,>=5.4; extra == "qwen"
26
+
27
+ # howhard
28
+
29
+ *How hard should the agent think?*
30
+
31
+ [Read the documentation](https://howhard.readthedocs.io/en/latest/).
32
+
33
+ `howhard` chooses the model and reasoning effort for a task delegated to an AI
34
+ agent. An LLM reads the actual task, current project and writable semantic memory,
35
+ forecasting clean completion, caught failures, escaped failures, tokens and time for
36
+ each candidate. Recorded outcomes update the predictive support for memories.
37
+
38
+ Selection balances worker cost, expected failure cost and waiting time. Its risk cap
39
+ uses a weighted envelope of LLM forecasts; these estimates are not a calibrated
40
+ failure guarantee. Without a usable LLM forecast, routing stops explicitly.
41
+
42
+ ## Quickstart
43
+
44
+ You need Python 3.11+, a POSIX shell, Git and a current Codex, Claude Code or
45
+ Antigravity client with native plugin support.
46
+
47
+ Install the Python backend from [PyPI](https://pypi.org/project/howhard/2.1.0/) in your
48
+ project directory:
49
+
50
+ ```sh
51
+ python3 -m venv .venv-howhard
52
+ . .venv-howhard/bin/activate
53
+ python -m pip install "howhard==2.1.0"
54
+ howhard --version
55
+ ```
56
+
57
+ Expect `howhard 2.1.0`. Keep the environment active and start your agent from the same
58
+ shell so it can find `howhard`. An existing GUI session may need the absolute path to
59
+ `.venv-howhard/bin/howhard` in your project.
60
+
61
+ Install the native plugin for your host:
62
+
63
+ ```sh
64
+ # Codex
65
+ codex plugin marketplace add xu-hao/howhard
66
+ codex plugin add howhard@howhard
67
+ ```
68
+
69
+ ```sh
70
+ # Claude Code
71
+ claude plugin marketplace add xu-hao/howhard
72
+ claude plugin install howhard@howhard
73
+ ```
74
+
75
+ ```sh
76
+ # Antigravity
77
+ agy plugin install https://github.com/xu-hao/howhard
78
+ agy plugin list
79
+ ```
80
+
81
+ The plugin supplies the `howhard` routing and learning skill and the `attribute-failure`
82
+ investigation skill. Backend and plugin updates are separate; the
83
+ [native installation guide](docs/skills.md) covers scopes and lifecycle commands.
84
+
85
+ Ask your coordinating agent to use howhard on a real, authorized task before starting
86
+ a worker:
87
+
88
+ > Use howhard to choose the model and reasoning effort for this task. Obtain an
89
+ > independent baseline, consult memory, execute with supported host controls, then
90
+ > record the actual outcome and measured usage and update memory.
91
+
92
+ Invoke the skill explicitly with `$howhard` or `/skills` in Codex,
93
+ `/howhard:howhard` in Claude Code, or `/howhard` in Antigravity. To require it before
94
+ delegation, add the [coordinating-agent instruction](docs/skills.md#require-howhard-before-delegation)
95
+ to your project instructions. Plugin installation alone does not enforce worker launches.
96
+
97
+ The [complete quickstart](docs/quickstart.md) walks through decision fields, feedback,
98
+ usage and memory learning. The host must support the chosen controls and a fresh context
99
+ for the independent baseline; otherwise routing is unavailable. Unknown usage and prices
100
+ stay unknown. Record actual executions rather than invented outcomes.
101
+
102
+ Inspect local state and observed-action summaries with:
103
+
104
+ ```sh
105
+ howhard paths --json
106
+ howhard memory list --json
107
+ howhard report --json
108
+ ```
109
+
110
+ The [model and storage contracts](docs/reference.md), [semantic-memory guide](docs/semantic-memory.md)
111
+ and [context contract](docs/context.md) describe the CLI/API and evidence boundaries.
112
+ Evaluate routing quality with [genuine project work](docs/evaluation.md).
113
+ External routing applications can [configure explicitly selected inventories](docs/configuration.md#inventories-for-external-routers)
114
+ and use the Python or calling-agent interfaces to select models and share learning
115
+ across providers in the same project store.
116
+ Contributors use [isolated worktrees and the documentation-only exemption](docs/contributing.md).
@@ -0,0 +1,90 @@
1
+ # howhard
2
+
3
+ *How hard should the agent think?*
4
+
5
+ [Read the documentation](https://howhard.readthedocs.io/en/latest/).
6
+
7
+ `howhard` chooses the model and reasoning effort for a task delegated to an AI
8
+ agent. An LLM reads the actual task, current project and writable semantic memory,
9
+ forecasting clean completion, caught failures, escaped failures, tokens and time for
10
+ each candidate. Recorded outcomes update the predictive support for memories.
11
+
12
+ Selection balances worker cost, expected failure cost and waiting time. Its risk cap
13
+ uses a weighted envelope of LLM forecasts; these estimates are not a calibrated
14
+ failure guarantee. Without a usable LLM forecast, routing stops explicitly.
15
+
16
+ ## Quickstart
17
+
18
+ You need Python 3.11+, a POSIX shell, Git and a current Codex, Claude Code or
19
+ Antigravity client with native plugin support.
20
+
21
+ Install the Python backend from [PyPI](https://pypi.org/project/howhard/2.1.0/) in your
22
+ project directory:
23
+
24
+ ```sh
25
+ python3 -m venv .venv-howhard
26
+ . .venv-howhard/bin/activate
27
+ python -m pip install "howhard==2.1.0"
28
+ howhard --version
29
+ ```
30
+
31
+ Expect `howhard 2.1.0`. Keep the environment active and start your agent from the same
32
+ shell so it can find `howhard`. An existing GUI session may need the absolute path to
33
+ `.venv-howhard/bin/howhard` in your project.
34
+
35
+ Install the native plugin for your host:
36
+
37
+ ```sh
38
+ # Codex
39
+ codex plugin marketplace add xu-hao/howhard
40
+ codex plugin add howhard@howhard
41
+ ```
42
+
43
+ ```sh
44
+ # Claude Code
45
+ claude plugin marketplace add xu-hao/howhard
46
+ claude plugin install howhard@howhard
47
+ ```
48
+
49
+ ```sh
50
+ # Antigravity
51
+ agy plugin install https://github.com/xu-hao/howhard
52
+ agy plugin list
53
+ ```
54
+
55
+ The plugin supplies the `howhard` routing and learning skill and the `attribute-failure`
56
+ investigation skill. Backend and plugin updates are separate; the
57
+ [native installation guide](docs/skills.md) covers scopes and lifecycle commands.
58
+
59
+ Ask your coordinating agent to use howhard on a real, authorized task before starting
60
+ a worker:
61
+
62
+ > Use howhard to choose the model and reasoning effort for this task. Obtain an
63
+ > independent baseline, consult memory, execute with supported host controls, then
64
+ > record the actual outcome and measured usage and update memory.
65
+
66
+ Invoke the skill explicitly with `$howhard` or `/skills` in Codex,
67
+ `/howhard:howhard` in Claude Code, or `/howhard` in Antigravity. To require it before
68
+ delegation, add the [coordinating-agent instruction](docs/skills.md#require-howhard-before-delegation)
69
+ to your project instructions. Plugin installation alone does not enforce worker launches.
70
+
71
+ The [complete quickstart](docs/quickstart.md) walks through decision fields, feedback,
72
+ usage and memory learning. The host must support the chosen controls and a fresh context
73
+ for the independent baseline; otherwise routing is unavailable. Unknown usage and prices
74
+ stay unknown. Record actual executions rather than invented outcomes.
75
+
76
+ Inspect local state and observed-action summaries with:
77
+
78
+ ```sh
79
+ howhard paths --json
80
+ howhard memory list --json
81
+ howhard report --json
82
+ ```
83
+
84
+ The [model and storage contracts](docs/reference.md), [semantic-memory guide](docs/semantic-memory.md)
85
+ and [context contract](docs/context.md) describe the CLI/API and evidence boundaries.
86
+ Evaluate routing quality with [genuine project work](docs/evaluation.md).
87
+ External routing applications can [configure explicitly selected inventories](docs/configuration.md#inventories-for-external-routers)
88
+ and use the Python or calling-agent interfaces to select models and share learning
89
+ across providers in the same project store.
90
+ Contributors use [isolated worktrees and the documentation-only exemption](docs/contributing.md).
@@ -0,0 +1,124 @@
1
+ # Concurrent CLI and API clients
2
+
3
+ Normal clients submit normal operations. Howhard owns write admission, waiting and
4
+ release inside the backend; agents need no acquire/release messages, writer windows,
5
+ scratch ledger, external broker or daemon. Fresh Git worktrees use the same repository
6
+ store automatically. Independently selected stores have independent queues.
7
+
8
+ ## Admission boundaries
9
+
10
+ Each store has a FIFO queue in `write-queue/`, protected during registration by
11
+ `write-queue.lock`. A client holds an OS advisory lock on its ticket while waiting and
12
+ writing. Registration under the short queue guard defines order: no later registered
13
+ writer overtakes a live earlier ticket. Arrival at the guard itself has no ordering
14
+ guarantee. Nested mutations within an admitted operation share that turn. A sequence
15
+ number may restart after the queue empties; the random ticket suffix distinguishes requests.
16
+
17
+ | Operation | Serialized boundary |
18
+ | --- | --- |
19
+ | First use | Validate evidence, establish project/store identity; initialize memory schema when needed |
20
+ | Native inventories | Validate and merge historical identity metadata |
21
+ | `context` / `retrieve` | Publish the immutable request artifact after checking evidence and memory again |
22
+ | `decide` / `pick` | Commit the receipt after checking its forecast inputs again; audit events have separate turns |
23
+ | `observe` / amendments | Read current evidence, validate IDs, provenance and corrections, then append/fsync |
24
+ | `usage attach` | Collect the owned source outside admission; validate and append the correction inside admission |
25
+ | Memory operations / learning | Recheck current evidence, event key, expected revision/version, then commit the SQLite transaction |
26
+ | Retrieval / inference caches | Serialize howhard-owned SQLite cache transactions and atomic response-cache publication |
27
+ | `flush` | Validate, append/fsync, then truncate/fsync under one turn |
28
+
29
+ The queue does not reserve a whole workflow. External LLM forecasts, local embedding,
30
+ graph construction, reranking, source collection, worker execution, review and gate
31
+ waits happen outside the write turn. Retrieval cache publication is separate from its
32
+ expensive computation. Pretrained model loading/downloads belong to the inference
33
+ libraries, outside store admission. A caller-selected receipt export is an ordinary
34
+ output file, outside backend state coordination.
35
+
36
+ Admitted mutations also hold `storage.lock` and the existing journal advisory lock.
37
+ This keeps JSONL snapshots consistent, including clients selecting different journals
38
+ inside one store. Evidence readers bypass the FIFO queue and take shared data locks;
39
+ they wait only for an active mutation, with the same bounded waiting policy. Memory
40
+ reads use SQLite snapshots without schema writes after initialization. First-use
41
+ schema initialization is a write. `writes` inspects tickets without joining the queue,
42
+ creating a store, or waiting for data locks.
43
+
44
+ The independent project identity lock is held only while claiming a new store/anchor,
45
+ not across every operation. Existing independent stores of the same project therefore
46
+ do not serialize their work through that anchor. Identity is checked before admission
47
+ and again after waiting. Use the same updated backend for concurrent clients; FIFO
48
+ admission applies to clients using this protocol. POSIX advisory locks and a local
49
+ filesystem shared by the participating processes are required. This is not a
50
+ cross-machine queue or a lease with a forced expiry during a mutation.
51
+
52
+ ## Waiting, cancellation and failures
53
+
54
+ Every admission has a finite deadline: 30 seconds by default. The deadline covers queue
55
+ registration, time behind other writers, and acquisition of data/identity locks. A
56
+ multi-step call can have several admissions; this is not a whole-call time limit or a
57
+ transaction across the entire call. An admitted mutation is not forcibly interrupted
58
+ when its admission deadline passes. Ordinary clients never need manual lock ownership.
59
+
60
+ ```sh
61
+ howhard writes --json
62
+ howhard observe task actual-model high clean --native --id actual-execution \
63
+ --write-timeout 10 --json
64
+ ```
65
+
66
+ `writes` returns the resolved store, ordering policy and live entries, each with a
67
+ ticket, PID, operation, enqueue timestamp, waiting seconds, position and state (`head`
68
+ or `waiting`). The head may still be acquiring a data lock; it does not imply a mutation
69
+ has begun. Status is a nonblocking, observational snapshot, not a claim protocol.
70
+ PIDs are diagnostic metadata; ownership and crash recovery use locks, never PID reuse
71
+ heuristics. Wait age uses wall-clock time for display; deadlines use a monotonic clock.
72
+
73
+ `--write-timeout` is available on store commands. On exhaustion, the client withdraws
74
+ its ticket and returns `WriteTimeout`; CLI exit status is 2. With `--json`, admission
75
+ errors are JSON on stderr under `error`, with `code`, `message`, `store`, `operation`
76
+ and `ticket`. Codes are `write_timeout`, `write_cancelled` and
77
+ `write_dependency_failed`. Ctrl-C withdraws the ticket and exits 130. Killing a client
78
+ releases its kernel locks; the next writer skips/removes abandoned tickets. A stopped
79
+ but living client still owns its ticket; other clients terminate at their own deadlines.
80
+ Filesystem/lock errors and SQLite dependency failures have a typed terminal outcome
81
+ without an automatic retry loop. An out-of-protocol SQLite writer can cause an immediate
82
+ dependency failure rather than extending the queue deadline.
83
+
84
+ ```python
85
+ from threading import Event
86
+ from howhard import Engine, WriteTimeout, WriteCancelled, WriteDependencyError
87
+
88
+ cancel = Event()
89
+ engine = Engine(write_timeout=10, write_cancel=cancel.is_set)
90
+ print(engine.write_status())
91
+ # Another thread may call cancel.set() while this client waits.
92
+ try:
93
+ engine.memory.add("Observed lesson", "A provisional lesson from actual work")
94
+ except (WriteTimeout, WriteCancelled, WriteDependencyError):
95
+ pass # Reconcile durable state and retry through the normal API when appropriate.
96
+ ```
97
+
98
+ Cancellation is checked while acquiring admission and data locks. A callback is not a
99
+ rollback request for an already executing mutation. API `KeyboardInterrupt` unwinds the
100
+ same cleanup. A process crash during a SQLite transaction rolls it back; existing JSONL
101
+ crash/flush recovery rules still apply. Queueing does not make a multi-file flush atomic.
102
+
103
+ ## Revalidation and retries
104
+
105
+ For example, an observation and a memory update from two worktrees register in one
106
+ store queue. The memory update waits its turn, then checks the expected revision
107
+ against current memory. A stale revision still returns the existing actionable
108
+ conflict; howhard never silently rebases a patch. Learning also checks the effective
109
+ evidence event after admission. A prepared request remains bound to its worktree,
110
+ actual candidate inventory, evidence and memory revision. Evidence or memory changes
111
+ during forecasting, retrieval or a queue wait require a new request. Adding an unrelated
112
+ historical model identity alone does not invalidate a disjoint inventory.
113
+
114
+ A timeout does not execute later in the background. Resubmit a normal call if needed;
115
+ no manual queue cleanup is required. Reuse the same stable observation/attachment ID
116
+ and identical inputs. Matching retries return the original row; conflicting retries
117
+ are refused. Refresh and regenerate stale decisions or writer patches instead of
118
+ resubmitting them unchanged. Keep retries bounded and report repeated failures.
119
+
120
+ Earlier steps may already be durable when a later admission fails. In particular,
121
+ an observed outcome survives failed usage collection or learning. Inspect
122
+ `evidence ID --raw` after ambiguous feedback and retry the same ID, rather than
123
+ minting another original execution. Append-only evidence, immutable receipts and
124
+ transactional memory revisions retain their existing contracts.
@@ -0,0 +1,190 @@
1
+ # Optional advanced configuration
2
+
3
+ The default workflow requires no file. `howhard.toml` in the current directory is loaded
4
+ when present; `--config PATH` chooses another file. Paths are relative to that file.
5
+ An explicit config must state `on_cap_unmet`; other settings overlay packaged defaults.
6
+ Unknown keys are refused. This reference is for integrators, not a user setup checklist.
7
+
8
+ (external-router-inventories)=
9
+ ## Inventories for external routers
10
+
11
+ Native agent use remains the ordinary workflow: the installed skill inspects the host's
12
+ live delegation tools and exposed settings and supplies its available model/control
13
+ list through `--candidates FILE`. The backend does not detect the native agent or
14
+ enumerate its inventory. Missing model/control capabilities are reported as unavailable.
15
+ Saved configuration never replaces the host-supplied list automatically.
16
+
17
+ A separate routing application can use howhard for selection and learning while owning
18
+ provider access and execution. Save explicitly named inventories in `howhard.toml`:
19
+
20
+ ```toml
21
+ on_cap_unmet = "flag-review"
22
+
23
+ [inventories]
24
+ router = [
25
+ { model = "provider-a/model-x", effort = "high" },
26
+ { model = "provider-b/model-y", effort = "low" },
27
+ ]
28
+ ```
29
+
30
+ These are illustrative identities, not claims about any provider's model catalog or
31
+ controls. Use stable IDs that distinguish the routes your application executes. A
32
+ provider-qualified `model` ID keeps the same model name on different provider routes
33
+ separate; howhard treats it as an opaque identity and returns it unchanged. The router
34
+ owns its mapping to provider requests. Every candidate needs an exact, enforceable
35
+ effort/control identity. No access or control values are inferred from a name.
36
+
37
+ Select a saved list explicitly with Python `inventory="router"` or CLI
38
+ `--inventory router`. Python `pick`, `summary` and `prepare`, and CLI `pick`, `summary`
39
+ and `context` support this selector. For example:
40
+
41
+ ```sh
42
+ howhard context specified-implementation --inventory router --text "Repair transaction ordering" --json
43
+ ```
44
+
45
+ When availability changes, pass Python `native_candidates=[...]` or CLI
46
+ `--candidates FILE` instead. Supplied lists and named inventories are mutually exclusive;
47
+ there is no union or fallback between them. An empty list or unknown inventory name is
48
+ an error. Without an explicit list or inventory selector, the backend refuses selection
49
+ even when saved lists exist. The same 1–32-cell validation and optional pricing fields
50
+ apply to both sources; invalid configured lists fail before creating state. The
51
+ `[models]` registry describes identities and evidence weights, not availability.
52
+ Previously observed models never become candidates merely because they are in history.
53
+
54
+ An application with a stateless forecast adapter can use the Python API directly:
55
+
56
+ ```python
57
+ from howhard import Engine
58
+
59
+ # forecast_adapter and router are supplied by your application.
60
+ engine = Engine("howhard.toml", llm=forecast_adapter)
61
+ decision = engine.pick("specified-implementation", task_text, inventory="router")
62
+ selected = decision["chosen"]
63
+ result = router.execute(model=selected["model"], effort=selected["effort"], task=task_text)
64
+ engine.observe_decision(decision["decision_id"], result.outcome,
65
+ id=result.execution_id, tokens=result.tokens,
66
+ seconds=result.seconds, cost_usd=result.cost_usd)
67
+ ```
68
+
69
+ The adapter implements `identity` and `complete(request) -> dict` for independent
70
+ baseline forecasts, memory-conditioned forecasts and memory updates. Its inference
71
+ provider is separate from the execution providers in the candidate list. The router
72
+ must honor review requirements and verify that the selected identity/control actually
73
+ ran before attaching receipt feedback. Outcomes use `clean`, `loud` or `silent`; usage
74
+ fields stay `None` unless measured. With the adapter supplied, observation also invokes
75
+ the memory writer. Alternatively, use the
76
+ {ref}`calling-agent protocol <calling-agent-provider-interfaces>` to supply forecasts and
77
+ writer responses explicitly without a native plugin.
78
+
79
+ All providers' runs and lessons in the same project store can inform later selections,
80
+ including selections where the source model is unavailable. Each actual result stays
81
+ bound to its executed model/control; predictions for unrun options are not observations.
82
+ Use consistent configuration/state paths across callers and inspect `howhard paths --json`
83
+ to confirm the store. Separate project stores are not automatically synchronized.
84
+ Configured-list changes require a new engine/config load; prepared decisions retain
85
+ their frozen inventory, and pending requests reject changed configuration.
86
+
87
+ (fixed-retrieval-configuration)=
88
+ ## Fixed retrieval configuration
89
+
90
+ Select the reranker in user/application-owned `howhard.toml`:
91
+
92
+ ```toml
93
+ on_cap_unmet = "flag-review"
94
+
95
+ [retrieval]
96
+ reranker = "fast"
97
+ ```
98
+
99
+ `fast` is the default MiniLM-L4 INT8 ONNX cross-encoder, using two CPU threads and
100
+ batches of 16 with a 512-token combined window. Set `reranker = "qwen"` to choose
101
+ the slower instruction-aware Qwen3-Reranker-0.6B instead; install `howhard[qwen]`
102
+ for that backend. Configured Qwen defaults to two CPU threads, batches of four and
103
+ an 8,192-token window. These are explicit fixed choices: there is no automatic
104
+ upgrade or fallback, and agent retrieval messages cannot supply a tier, model or
105
+ configuration override. The packaged skill instructs agents to keep this policy fixed.
106
+
107
+ Both profiles accept `threads` (1–256) and `batch_size` (1–1,024). To replace the
108
+ pretrained model, supply **both** `model` and its full 40-character immutable `revision`.
109
+ For example, a user can select another compatible ONNX artifact:
110
+
111
+ ```toml
112
+ [retrieval]
113
+ reranker = "fast"
114
+ model = "Xenova/ms-marco-MiniLM-L-6-v2"
115
+ revision = "a09144355adeed5f58c8ed011d209bf8ee5a1fec"
116
+ model_file = "onnx/model_quantized.onnx"
117
+ threads = 2
118
+ batch_size = 16
119
+ ```
120
+
121
+ `model_file` is fast-backend-only and must be a relative `.onnx` artifact path inside
122
+ the model snapshot. Qwen instead accepts `instruction`, `device` and `max_length`
123
+ (1–32,768). Unsupported backend/option combinations, unknown keys, invalid numbers and
124
+ unpinned model overrides are rejected before state is created. Selecting Qwen does not
125
+ load weights or invoke a provider while parsing configuration; if its optional runtime
126
+ is missing when inference is needed, the error is explicit.
127
+
128
+ The same configuration applies to initial context, `memory search`, and evidence
129
+ search. Prepared requests are bound to configuration; changing policy requires a new
130
+ request. An application-supplied `Engine(retrieval=pipeline)` still takes precedence
131
+ over file-based construction. See [retrieval stages](retrieval.md) for replacing
132
+ components through Python.
133
+
134
+ ## Routing policy and storage
135
+
136
+ ```toml
137
+ on_cap_unmet = "flag-review" # or lowest-bound
138
+ project = "local"
139
+ journal = ".howhard/pending.jsonl"
140
+
141
+ [[logs]]
142
+ path = ".howhard/outcomes.jsonl"
143
+ project = "local"
144
+
145
+ [task_types]
146
+ my-task = "standard"
147
+
148
+ [classes.standard]
149
+ C_loud = 50.0
150
+ C_silent = 1000.0
151
+ lambda_per_hour = 25.0
152
+ epsilon = 0.10
153
+ # explore_within = 0.20
154
+ ```
155
+
156
+ An explicit config requires `--risk` when picking an unknown task. Known taxonomy types
157
+ can be reassigned with `task_types`. Packaged classes are critical, contract, standard, docs
158
+ and routine; explicit projects may define additional classes. The first log belongs to the current project and is the flush destination;
159
+ additional logs can name other projects.
160
+
161
+ Known model mappings can be overlaid by `[models."concrete-id"]`:
162
+
163
+ ```toml
164
+ [models.claude-opus-5-5]
165
+ family = "opus"
166
+ efforts = ["low", "medium", "high", "xhigh", "max"]
167
+ weight = 1.0
168
+ ```
169
+
170
+ An explicit mapping labels the model's protocol cells and supplies its evidence weight;
171
+ it does not inherit learned family effects. Omitted evidence weight means 1.0. Unknown
172
+ native identities need no configuration and receive distinct opaque identity labels.
173
+ Every `pick`, `summary` and `context` request uses an explicit inventory through
174
+ `--candidates FILE` (Python: `native_candidates`) or an explicitly selected saved list
175
+ with `--inventory NAME` (Python: `inventory`). Registry entries do not activate candidates. Supply known worker prices as
176
+ optional `usd_per_mtok` in that inventory;
177
+ unknown prices remain omitted/null. Family selection flags, model default efforts,
178
+ component API prices and token-mix configuration are not accepted.
179
+
180
+ Statistical priors, imported priors, cache paths and transfer tuning are no longer
181
+ accepted. `--journal` remains available for an integration path override. Provider
182
+ selection has no mode switch: Python accepts an adapter, and standalone inference uses
183
+ `HOWHARD_LLM_COMMAND` or an authenticated Claude CLI. Calling-agent commands do not
184
+ resolve a provider.
185
+
186
+ Native host use does not require this configuration. The skill supplies discovered
187
+ model/control cells through `--candidates`, and the backend owns their minimal historical
188
+ metadata. Native price omission means unknown. `--state-dir` redirects standard `.howhard/` data paths while honoring custom
189
+ configured paths, and keeps current project capture separate. Explicit configuration
190
+ without that override retains its existing data locations and policies.
@@ -3,6 +3,8 @@
3
3
  - [Quickstart](quickstart.md) — install, choose, record an outcome and learn, with no setup.
4
4
  - [Model and storage contracts](reference.md) — LLM forecasts, cost/risk selection, strict rows,
5
5
  reproducibility and storage.
6
+ - [Concurrent clients](concurrency.md) — backend-owned FIFO write admission, bounded waits,
7
+ cancellation, queue status and safe retries across worktrees.
6
8
  - [Task text and changing project context](context.md) — original task/project text, immutable
7
9
  snapshots and decision receipts.
8
10
  - [LLM reasoning and writable semantic memory](semantic-memory.md) — reader/writer
@@ -15,7 +17,8 @@
15
17
  with pytest-probability, separate from field routing-quality evidence.
16
18
  - [Real-project evaluation](evaluation.md) — chronological field trials and genuine
17
19
  observed outcomes, with implementation fixtures kept separate.
18
- - [Advanced configuration](configuration.md) — optional registry, policies and data locations.
20
+ - [Advanced configuration](configuration.md) — external-router candidate lists, optional
21
+ registry, policies and data locations.
19
22
  - [Upgrading to 2.0](upgrading-2.0.md) — portable execution accounting and explicit money bases.
20
23
  - [Upgrading to 1.0](upgrading-1.0.md) — breaking interfaces, backend/skill updates and
21
24
  preserved historical state.
@@ -29,6 +32,7 @@
29
32
 
30
33
  quickstart
31
34
  reference
35
+ concurrency
32
36
  context
33
37
  semantic-memory
34
38
  retrieval