agentpace 0.12.0__tar.gz → 0.12.2__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 (104) hide show
  1. {agentpace-0.12.0 → agentpace-0.12.2}/CHANGELOG.md +23 -0
  2. {agentpace-0.12.0 → agentpace-0.12.2}/CITATION.cff +1 -1
  3. {agentpace-0.12.0 → agentpace-0.12.2}/PKG-INFO +1 -1
  4. {agentpace-0.12.0 → agentpace-0.12.2}/docs/cli.md +2 -2
  5. {agentpace-0.12.0 → agentpace-0.12.2}/docs/releasing.md +9 -9
  6. {agentpace-0.12.0 → agentpace-0.12.2}/docs/verify-adapter.md +1 -1
  7. {agentpace-0.12.0 → agentpace-0.12.2}/skills/agentpace/references/method.md +1 -1
  8. {agentpace-0.12.0 → agentpace-0.12.2}/src/agentpace/__init__.py +1 -1
  9. {agentpace-0.12.0 → agentpace-0.12.2}/src/agentpace/cli.py +49 -25
  10. {agentpace-0.12.0 → agentpace-0.12.2}/src/agentpace/render.py +12 -5
  11. {agentpace-0.12.0 → agentpace-0.12.2}/src/agentpace/schema.py +11 -3
  12. {agentpace-0.12.0 → agentpace-0.12.2}/src/agentpace/share.py +19 -6
  13. {agentpace-0.12.0 → agentpace-0.12.2}/src/agentpace/turns.py +11 -8
  14. agentpace-0.12.2/tests/test_counts.py +299 -0
  15. {agentpace-0.12.0 → agentpace-0.12.2}/tests/test_labels.py +10 -2
  16. {agentpace-0.12.0 → agentpace-0.12.2}/tests/test_outcomes.py +6 -3
  17. {agentpace-0.12.0 → agentpace-0.12.2}/tests/test_share_validate.py +130 -6
  18. {agentpace-0.12.0 → agentpace-0.12.2}/tests/test_skills.py +2 -0
  19. {agentpace-0.12.0 → agentpace-0.12.2}/tests/test_turns.py +2 -2
  20. {agentpace-0.12.0 → agentpace-0.12.2}/.gitattributes +0 -0
  21. {agentpace-0.12.0 → agentpace-0.12.2}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  22. {agentpace-0.12.0 → agentpace-0.12.2}/.github/ISSUE_TEMPLATE/ingest-found-nothing.yml +0 -0
  23. {agentpace-0.12.0 → agentpace-0.12.2}/.github/ISSUE_TEMPLATE/remove-my-rows.yml +0 -0
  24. {agentpace-0.12.0 → agentpace-0.12.2}/.github/dependabot.yml +0 -0
  25. {agentpace-0.12.0 → agentpace-0.12.2}/.github/pull_request_template.md +0 -0
  26. {agentpace-0.12.0 → agentpace-0.12.2}/.github/workflows/ci.yml +0 -0
  27. {agentpace-0.12.0 → agentpace-0.12.2}/.github/workflows/publish.yml +0 -0
  28. {agentpace-0.12.0 → agentpace-0.12.2}/.github/workflows/validate-data.yml +0 -0
  29. {agentpace-0.12.0 → agentpace-0.12.2}/.gitignore +0 -0
  30. {agentpace-0.12.0 → agentpace-0.12.2}/CODE_OF_CONDUCT.md +0 -0
  31. {agentpace-0.12.0 → agentpace-0.12.2}/CONTRIBUTING.md +0 -0
  32. {agentpace-0.12.0 → agentpace-0.12.2}/LICENSE +0 -0
  33. {agentpace-0.12.0 → agentpace-0.12.2}/README.md +0 -0
  34. {agentpace-0.12.0 → agentpace-0.12.2}/SECURITY.md +0 -0
  35. {agentpace-0.12.0 → agentpace-0.12.2}/data/LICENSE +0 -0
  36. {agentpace-0.12.0 → agentpace-0.12.2}/data/README.md +0 -0
  37. {agentpace-0.12.0 → agentpace-0.12.2}/data/runs/4546788e7930eccd-2026-W40-2026-W45.jsonl +0 -0
  38. {agentpace-0.12.0 → agentpace-0.12.2}/data/runs/4546788e7930eccd-2026-W44-2026-W45.jsonl +0 -0
  39. {agentpace-0.12.0 → agentpace-0.12.2}/docs/.nojekyll +0 -0
  40. {agentpace-0.12.0 → agentpace-0.12.2}/docs/DESIGN.md +0 -0
  41. {agentpace-0.12.0 → agentpace-0.12.2}/docs/assets/backtest-coverage.svg +0 -0
  42. {agentpace-0.12.0 → agentpace-0.12.2}/docs/assets/hero.webp +0 -0
  43. {agentpace-0.12.0 → agentpace-0.12.2}/docs/assets/run-ranges.svg +0 -0
  44. {agentpace-0.12.0 → agentpace-0.12.2}/docs/assets/social-preview.png +0 -0
  45. {agentpace-0.12.0 → agentpace-0.12.2}/docs/backtest.json +0 -0
  46. {agentpace-0.12.0 → agentpace-0.12.2}/docs/backtest.md +0 -0
  47. {agentpace-0.12.0 → agentpace-0.12.2}/docs/index.html +0 -0
  48. {agentpace-0.12.0 → agentpace-0.12.2}/docs/robots.txt +0 -0
  49. {agentpace-0.12.0 → agentpace-0.12.2}/docs/sitemap.xml +0 -0
  50. {agentpace-0.12.0 → agentpace-0.12.2}/examples/plan.json +0 -0
  51. {agentpace-0.12.0 → agentpace-0.12.2}/examples/quote-plan.json +0 -0
  52. {agentpace-0.12.0 → agentpace-0.12.2}/pyproject.toml +0 -0
  53. {agentpace-0.12.0 → agentpace-0.12.2}/schema/run.schema.json +0 -0
  54. {agentpace-0.12.0 → agentpace-0.12.2}/schema/turn.schema.json +0 -0
  55. {agentpace-0.12.0 → agentpace-0.12.2}/skills/agentpace/SKILL.md +0 -0
  56. {agentpace-0.12.0 → agentpace-0.12.2}/skills/agentpace/assets/portable-prompt.md +0 -0
  57. {agentpace-0.12.0 → agentpace-0.12.2}/skills/pace-estimate/SKILL.md +0 -0
  58. {agentpace-0.12.0 → agentpace-0.12.2}/skills/pace-log/SKILL.md +0 -0
  59. {agentpace-0.12.0 → agentpace-0.12.2}/skills/pace-share/SKILL.md +0 -0
  60. {agentpace-0.12.0 → agentpace-0.12.2}/src/agentpace/__main__.py +0 -0
  61. {agentpace-0.12.0 → agentpace-0.12.2}/src/agentpace/adapters/__init__.py +0 -0
  62. {agentpace-0.12.0 → agentpace-0.12.2}/src/agentpace/adapters/base.py +0 -0
  63. {agentpace-0.12.0 → agentpace-0.12.2}/src/agentpace/adapters/claude_code.py +0 -0
  64. {agentpace-0.12.0 → agentpace-0.12.2}/src/agentpace/adapters/cline.py +0 -0
  65. {agentpace-0.12.0 → agentpace-0.12.2}/src/agentpace/adapters/codex.py +0 -0
  66. {agentpace-0.12.0 → agentpace-0.12.2}/src/agentpace/adapters/gemini_cli.py +0 -0
  67. {agentpace-0.12.0 → agentpace-0.12.2}/src/agentpace/adapters/opencode.py +0 -0
  68. {agentpace-0.12.0 → agentpace-0.12.2}/src/agentpace/backtest.py +0 -0
  69. {agentpace-0.12.0 → agentpace-0.12.2}/src/agentpace/cache.py +0 -0
  70. {agentpace-0.12.0 → agentpace-0.12.2}/src/agentpace/charts.py +0 -0
  71. {agentpace-0.12.0 → agentpace-0.12.2}/src/agentpace/claims.py +0 -0
  72. {agentpace-0.12.0 → agentpace-0.12.2}/src/agentpace/classify.py +0 -0
  73. {agentpace-0.12.0 → agentpace-0.12.2}/src/agentpace/estimate.py +0 -0
  74. {agentpace-0.12.0 → agentpace-0.12.2}/src/agentpace/forecasts.py +0 -0
  75. {agentpace-0.12.0 → agentpace-0.12.2}/src/agentpace/ingest.py +0 -0
  76. {agentpace-0.12.0 → agentpace-0.12.2}/src/agentpace/paths.py +0 -0
  77. {agentpace-0.12.0 → agentpace-0.12.2}/src/agentpace/pseudonym.py +0 -0
  78. {agentpace-0.12.0 → agentpace-0.12.2}/src/agentpace/py.typed +0 -0
  79. {agentpace-0.12.0 → agentpace-0.12.2}/src/agentpace/report.py +0 -0
  80. {agentpace-0.12.0 → agentpace-0.12.2}/src/agentpace/site.py +0 -0
  81. {agentpace-0.12.0 → agentpace-0.12.2}/src/agentpace/validate.py +0 -0
  82. {agentpace-0.12.0 → agentpace-0.12.2}/tests/__init__.py +0 -0
  83. {agentpace-0.12.0 → agentpace-0.12.2}/tests/fixtures/__init__.py +0 -0
  84. {agentpace-0.12.0 → agentpace-0.12.2}/tests/fixtures/cline_tasks.py +0 -0
  85. {agentpace-0.12.0 → agentpace-0.12.2}/tests/fixtures/gemini_cli.py +0 -0
  86. {agentpace-0.12.0 → agentpace-0.12.2}/tests/fixtures/opencode.py +0 -0
  87. {agentpace-0.12.0 → agentpace-0.12.2}/tests/synthetic.py +0 -0
  88. {agentpace-0.12.0 → agentpace-0.12.2}/tests/test_backtest.py +0 -0
  89. {agentpace-0.12.0 → agentpace-0.12.2}/tests/test_claims.py +0 -0
  90. {agentpace-0.12.0 → agentpace-0.12.2}/tests/test_classify.py +0 -0
  91. {agentpace-0.12.0 → agentpace-0.12.2}/tests/test_cli.py +0 -0
  92. {agentpace-0.12.0 → agentpace-0.12.2}/tests/test_cline.py +0 -0
  93. {agentpace-0.12.0 → agentpace-0.12.2}/tests/test_codex.py +0 -0
  94. {agentpace-0.12.0 → agentpace-0.12.2}/tests/test_docs.py +0 -0
  95. {agentpace-0.12.0 → agentpace-0.12.2}/tests/test_estimate.py +0 -0
  96. {agentpace-0.12.0 → agentpace-0.12.2}/tests/test_forecasts.py +0 -0
  97. {agentpace-0.12.0 → agentpace-0.12.2}/tests/test_frozen_method.py +0 -0
  98. {agentpace-0.12.0 → agentpace-0.12.2}/tests/test_gemini_cli.py +0 -0
  99. {agentpace-0.12.0 → agentpace-0.12.2}/tests/test_ingest.py +0 -0
  100. {agentpace-0.12.0 → agentpace-0.12.2}/tests/test_opencode.py +0 -0
  101. {agentpace-0.12.0 → agentpace-0.12.2}/tests/test_plan_risk.py +0 -0
  102. {agentpace-0.12.0 → agentpace-0.12.2}/tests/test_review_capacity.py +0 -0
  103. {agentpace-0.12.0 → agentpace-0.12.2}/tests/test_schema.py +0 -0
  104. {agentpace-0.12.0 → agentpace-0.12.2}/tests/test_site.py +0 -0
@@ -4,6 +4,29 @@ This project follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) an
4
4
 
5
5
  ## Unreleased
6
6
 
7
+ ## 0.12.2 - 2026-11-09
8
+
9
+ ### Fixed
10
+
11
+ - A rows file with a line that is not valid JSON, or not a JSON object, is refused with its file name and line number and exit 2, instead of the decoder's message. The message never quotes the line.
12
+ - When the contribution file cannot be replaced because another program holds it open, as Windows does, `share --write` says so, leaves the file as it was and removes its temporary file, instead of a traceback.
13
+
14
+ No published number moved.
15
+
16
+ ## 0.12.1 - 2026-11-09
17
+
18
+ ### Fixed
19
+
20
+ - Count messages agree in number: the CLI's own messages read `1 row`, `1 session` or `1 gap` where they read `1 rows`, through one helper, `render.count`. The published report and the site are generated documents and keep their wording.
21
+ - Corrected the adapter guide's description of `duration_s`, the `completed_without_duration` definition in `docs/cli.md`, and the release runbook's line references, which had gone stale.
22
+
23
+ ### Changed
24
+
25
+ - `docs/cli.md` says that without `--data`, the seed rows and your local rows are estimated together even when they were ingested under different idle caps, and how to keep one cap.
26
+ - The banned-phrase test also scans `docs/releasing.md` and `docs/verify-adapter.md`.
27
+
28
+ No published number moved.
29
+
7
30
  ## 0.12.0 - 2026-11-09
8
31
 
9
32
  ### Changed
@@ -8,7 +8,7 @@ authors:
8
8
  repository-code: https://github.com/mohamedzhioua/agentpace
9
9
  url: https://mohamedzhioua.github.io/agentpace/
10
10
  license: MIT
11
- version: 0.12.0
11
+ version: 0.12.2
12
12
  date-released: 2026-11-09
13
13
  keywords:
14
14
  - coding agents
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: agentpace
3
- Version: 0.12.0
3
+ Version: 0.12.2
4
4
  Summary: Stop estimating agent work in human weeks. agentpace measures how long coding agents actually take: P50/P80/P90 ranges from real Claude Code and Codex runs, the human part stated apart, never derived. Open CC0 dataset, zero-dependency Python CLI, agent skill.
5
5
  Project-URL: Homepage, https://mohamedzhioua.github.io/agentpace/
6
6
  Project-URL: Repository, https://github.com/mohamedzhioua/agentpace
@@ -133,7 +133,7 @@ The session clock counts agent runs and the gaps between them, each gap up to th
133
133
  Human part (review, testing, decisions, waiting between agent turns): not measured. No allowance for it is added to the total above. State it separately; do not derive it from the agent time.
134
134
  ```
135
135
 
136
- The clock note gives the default cap. In rows ingested with a non-default `--idle-cap`, each gap counts up to that cap instead.
136
+ The clock note gives the default cap. In rows ingested with a non-default `--idle-cap`, each gap counts up to that cap instead. Without `--data`, the seed rows, clipped at 900 s, are pooled with your local rows, which were clipped at whatever `--idle-cap` you ingested with; for one consistent cap, pass `--data` with rows ingested under it.
137
137
 
138
138
  With `--quoted`, one line sits directly under the total. It holds the quote verbatim and is never converted into agent time or compared with the range:
139
139
 
@@ -199,7 +199,7 @@ One JSON object. Every duration is in seconds, as a number.
199
199
  | `size_used` | boolean | Whether `--use-size` was given. |
200
200
  | `rows_used` | integer | Completed runs the estimate learned from. |
201
201
  | `rows_excluded` | integer | Runs left out of the fit: those that did not complete (failed or unknown), and completed runs with no duration. |
202
- | `outcomes` | object | Recorded harness outcomes of every row the estimate loaded, after duplicates are dropped, and never per cell: `rows`, `completed`, `failed`, `unknown`, `completed_without_duration` (completed rows with a duration of 0), and `by_harness`, a list sorted by harness name of objects with `harness`, `rows`, `completed`, `failed` and `unknown`. An outcome is how the run ended in its harness, not task acceptance, and `unknown` is not counted as a failure. The counts are shown, never used to change the range. `rows` is `completed` + `failed` + `unknown`, `rows_used` is `completed` - `completed_without_duration`, and `rows_excluded` is `failed` + `unknown` + `completed_without_duration`. |
202
+ | `outcomes` | object | Recorded harness outcomes of every row the estimate loaded, after duplicates are dropped, and never per cell: `rows`, `completed`, `failed`, `unknown`, `completed_without_duration` (completed rows with no positive duration), and `by_harness`, a list sorted by harness name of objects with `harness`, `rows`, `completed`, `failed` and `unknown`. An outcome is how the run ended in its harness, not task acceptance, and `unknown` is not counted as a failure. The counts are shown, never used to change the range. `rows` is `completed` + `failed` + `unknown`, `rows_used` is `completed` - `completed_without_duration`, and `rows_excluded` is `failed` + `unknown` + `completed_without_duration`. |
203
203
  | `draws` | integer | Simulations run. |
204
204
  | `seed` | integer | The random seed. |
205
205
  | `warnings` | list of strings | Thin or unseen cells, ignored sizes, a written risk the estimate did not use, an assumed parallelism. Pass them on. |
@@ -141,14 +141,14 @@ PyPI renders the README as the project description. The three images use absolut
141
141
 
142
142
  The README's other relative links do not resolve on PyPI, because PyPI has no repository to resolve them against. That is accepted: the page links the repository, and these targets are one click away there. As of v0.8.4 they are:
143
143
 
144
- - `LICENSE` (lines 9 and 260) and `data/LICENSE` (lines 10 and 260)
145
- - `examples/plan.json` (line 41) and `examples/quote-plan.json` (line 118; added in v0.9.0, which moved every README line below it down by 33)
146
- - `docs/verify-adapter.md` (lines 84 to 86 and 243)
147
- - `skills/` and `skills/agentpace/assets/portable-prompt.md` (line 103), the portable prompt again (line 114)
148
- - `skills/agentpace/SKILL.md`, `skills/pace-estimate/SKILL.md`, `skills/pace-log/SKILL.md`, `skills/pace-share/SKILL.md` (lines 109 to 112), and `skills/pace-log/SKILL.md` again (line 137)
149
- - `docs/backtest.md` and its anchors `#by-harness` (line 145), `#time-split-week-by-week` (line 173) and `#pooled-for-the-record` (line 186)
150
- - `schema/run.schema.json` (line 193)
151
- - `CONTRIBUTING.md` (line 212)
152
- - `docs/DESIGN.md` (lines 218 and 256) and `src/agentpace/estimate.py` (line 256)
144
+ - `LICENSE` and `data/LICENSE`
145
+ - `examples/plan.json` and `examples/quote-plan.json` (added in v0.9.0)
146
+ - `docs/verify-adapter.md`
147
+ - `skills/` and `skills/agentpace/assets/portable-prompt.md`
148
+ - `skills/agentpace/SKILL.md`, `skills/pace-estimate/SKILL.md`, `skills/pace-log/SKILL.md`, `skills/pace-share/SKILL.md`
149
+ - `docs/backtest.md` and its anchors `#by-harness`, `#time-split-week-by-week` and `#pooled-for-the-record`
150
+ - `schema/run.schema.json`
151
+ - `CONTRIBUTING.md`
152
+ - `docs/DESIGN.md` and `src/agentpace/estimate.py`
153
153
 
154
154
  In-page anchors such as `#install` and `#limitations` depend on how PyPI renders heading ids; that has not been checked.
@@ -36,7 +36,7 @@ Compare the rows with your notes, session by session:
36
36
 
37
37
  - **Rows against turns.** Each run as DESIGN section 3 defines it for the harness (for Gemini CLI and Cline an agent turn, for OpenCode one prompt of yours and the replies to it) should be one row, with none missing and none extra.
38
38
  - **`outcome`** against what happened: the completed turn should be `completed`, and the interrupted and errored turns should be what DESIGN section 3 says for that harness.
39
- - **`duration_s`** against your noted start and end. It is agent active time, with every idle gap over the idle cap (900 s by default) clipped to the cap, and for Cline with approval waits dropped. So it can be shorter than the span you noted, but should not be longer than it, give or take how precisely you noted the times.
39
+ - **`duration_s`** against your noted start and end. It is the run's elapsed time with each idle gap counted up to the idle cap (900 s by default), and for Cline with approval waits dropped. So it can be shorter than the span you noted, but should not be longer than it, give or take how precisely you noted the times.
40
40
  - **`tool_calls`** against your tally and the tool's own log.
41
41
  - **`model`** against the model the harness showed you, after agentpace's normalization to a model family.
42
42
  - **`batch`:** one value per session. A sub-agent's own session or file has its own `batch`, as DESIGN section 3 says for each harness.
@@ -12,6 +12,6 @@ Use this page to answer questions about the method. It is not needed for a routi
12
12
 
13
13
  **What is measured.** Per task, the time an agent ran, with each idle gap inside the run counted up to 900 seconds. Per plan, the session's span on its own clock, built the same way across the gaps between runs.
14
14
 
15
- **The human part.** No allowance for review, testing, decisions or waiting between agent turns is added to the total; because the session clock counts the gaps between runs up to the idle cap, a wait shorter than that sits inside the plan total and a longer one is clipped. Every estimate prints this on its own lines. They read "not measured" unless `agentpace turns` has measured the user's own wait per human turn from their main-session timestamps. That measurement is elapsed time, not effort, and is kept local. No multiplier turns agent time into human time, so none is applied. A human-scale quote such as "three weeks" is shown beside the range as unverified, never converted.
15
+ **The human part.** No allowance for review, testing, decisions or waiting between agent turns is added to the total; because the session clock counts the gaps between runs up to the idle cap, a wait shorter than that sits inside the plan total and a longer one is clipped. Every estimate prints this on its own lines. The human part line reads "not measured" unless `agentpace turns` has measured the user's own wait per human turn from their main-session timestamps. That measurement is elapsed time, not effort, and is kept local. No multiplier turns agent time into human time, so none is applied. A human-scale quote such as "three weeks" is shown beside the range as unverified, never converted.
16
16
 
17
17
  **How far to trust it.** See `docs/backtest.md`. Every number there is regenerated from the published rows by `agentpace backtest`.
@@ -1,3 +1,3 @@
1
1
  """agentpace: real run times for coding agents, as P50/P80/P90 ranges."""
2
2
 
3
- __version__ = "0.12.0"
3
+ __version__ = "0.12.2"
@@ -127,7 +127,8 @@ def cmd_ingest(args: argparse.Namespace) -> int:
127
127
  print(EXPERIMENTAL_NOTE.format(name=adapter.name), file=sys.stderr)
128
128
  for line in report.lines():
129
129
  print(line, file=sys.stderr)
130
- print(f"store now holds: {total} rows", file=sys.stderr)
130
+ # Two spaces: the value lines up with the ingest report's 18-character label column above it.
131
+ print(f"store now holds: {render.count(total, 'row')}", file=sys.stderr)
131
132
  return 0
132
133
 
133
134
 
@@ -155,14 +156,22 @@ def _cached_starts() -> dict[str, float]:
155
156
  return starts
156
157
 
157
158
 
158
- NO_CHRONOLOGY = (
159
- "{count} sessions have no local chronology (no cache entry, or ingested with another idle "
160
- "cap); they are listed by week only. Run agentpace ingest to refresh the cache."
161
- )
162
- CANNOT_TELL_LAST = (
163
- "cannot tell which run is last: {count} sessions have no local chronology. "
164
- "Run agentpace ingest, or give a reference from agentpace runs"
165
- )
159
+ def _no_chronology(count: int) -> str:
160
+ one = count == 1
161
+ return (
162
+ f"{render.count(count, 'session')} {'has' if one else 'have'} no local chronology "
163
+ "(no cache entry, or ingested with another idle cap); "
164
+ f"{'it is' if one else 'they are'} listed by week only. "
165
+ "Run agentpace ingest to refresh the cache."
166
+ )
167
+
168
+
169
+ def _cannot_tell_last(count: int) -> str:
170
+ return (
171
+ f"cannot tell which run is last: {render.count(count, 'session')} "
172
+ f"{'has' if count == 1 else 'have'} no local chronology. "
173
+ "Run agentpace ingest, or give a reference from agentpace runs"
174
+ )
166
175
 
167
176
 
168
177
  def cmd_runs(args: argparse.Namespace) -> int:
@@ -186,7 +195,7 @@ def cmd_runs(args: argparse.Namespace) -> int:
186
195
  )
187
196
  unknown = {row["batch"] for row in listed if row["batch"] not in starts}
188
197
  if unknown:
189
- print(NO_CHRONOLOGY.format(count=len(unknown)), file=sys.stderr)
198
+ print(_no_chronology(len(unknown)), file=sys.stderr)
190
199
  return 0
191
200
 
192
201
 
@@ -199,7 +208,7 @@ def _last_ref(rows: Sequence[schema.Row], starts: dict[str, float]) -> str:
199
208
  known = {row["batch"] for row in rows if row["batch"] in starts}
200
209
  if not known:
201
210
  unknown = {row["batch"] for row in rows}
202
- raise ValueError(CANNOT_TELL_LAST.format(count=len(unknown)))
211
+ raise ValueError(_cannot_tell_last(len(unknown)))
203
212
  chosen = max(known, key=lambda batch: (starts[batch], batch))
204
213
  members = [row for row in rows if row["batch"] == chosen]
205
214
  latest_week = max(row["week"] for row in members)
@@ -207,7 +216,7 @@ def _last_ref(rows: Sequence[schema.Row], starts: dict[str, float]) -> str:
207
216
  row["batch"] for row in rows if row["batch"] not in starts and row["week"] >= latest_week
208
217
  }
209
218
  if rivals:
210
- raise ValueError(CANNOT_TELL_LAST.format(count=len(rivals)))
219
+ raise ValueError(_cannot_tell_last(len(rivals)))
211
220
  return ingest.run_ref(max(members, key=lambda row: row["offset_s"]))
212
221
 
213
222
 
@@ -281,9 +290,12 @@ def _experimental_rows_note(rows: Sequence[schema.Row]) -> str | None:
281
290
  if not harnesses:
282
291
  return None
283
292
  names = ", ".join(sorted(set(harnesses)))
293
+ one = len(harnesses) == 1
284
294
  return (
285
- f"note: {len(harnesses)} of {len(rows)} rows come from experimental adapters ({names}); "
286
- "they take part in this estimate because they are in your local store. "
295
+ f"note: {len(harnesses)} of {render.count(len(rows), 'row')} "
296
+ f"{'comes' if one else 'come'} from experimental adapters ({names}); "
297
+ f"{'it takes' if one else 'they take'} part in this estimate because "
298
+ f"{'it is' if one else 'they are'} in your local store. "
287
299
  "Pass --data to choose the rows."
288
300
  )
289
301
 
@@ -401,7 +413,10 @@ def _local_rows() -> list[schema.Row]:
401
413
  def cmd_score(args: argparse.Namespace) -> int:
402
414
  ledger = forecasts.read(paths.forecasts_file())
403
415
  if ledger.skipped:
404
- print(f"skipped {ledger.skipped} damaged lines in the ledger", file=sys.stderr)
416
+ print(
417
+ f"skipped {render.count(ledger.skipped, 'damaged line')} in the ledger",
418
+ file=sys.stderr,
419
+ )
405
420
  if args.id:
406
421
  return _score_one(args, ledger)
407
422
  if args.session or args.actual:
@@ -439,8 +454,8 @@ def cmd_turns(args: argparse.Namespace) -> int:
439
454
  print("No waits on you were found, so the human part stays not measured.")
440
455
  return 0
441
456
  print(
442
- f"Waiting on you, from your history (local): {summary.gaps} gaps between agent turns "
443
- f"in {summary.sessions} sessions."
457
+ f"Waiting on you, from your history (local): {render.count(summary.gaps, 'gap')} "
458
+ f"between agent turns in {render.count(summary.sessions, 'session')}."
444
459
  )
445
460
  print(
446
461
  f"Per human turn: P50 {render.duration(summary.p50)}, P80 {render.duration(summary.p80)}, "
@@ -495,11 +510,16 @@ def cmd_share(args: argparse.Namespace) -> int:
495
510
  print(share.NOTICE, file=sys.stderr)
496
511
  if dropped:
497
512
  print(
498
- f"{sum(dropped.values())} rows from {len(dropped)} dropped sessions left out.",
513
+ f"{render.count(sum(dropped.values()), 'row')} from "
514
+ f"{render.count(len(dropped), 'dropped session')} left out.",
499
515
  file=sys.stderr,
500
516
  )
501
517
  if skipped:
502
- print(f"{skipped} rows are already published and left out.", file=sys.stderr)
518
+ print(
519
+ f"{render.count(skipped, 'row')} {'is' if skipped == 1 else 'are'} already published "
520
+ "and left out.",
521
+ file=sys.stderr,
522
+ )
503
523
  if not chosen:
504
524
  print("nothing new to share.", file=sys.stderr)
505
525
  return 0
@@ -514,22 +534,26 @@ def cmd_share(args: argparse.Namespace) -> int:
514
534
  target = (
515
535
  f"--write would create {path}."
516
536
  if held is None
517
- else f"--write would add them to {path}, which holds {held} rows."
537
+ else f"--write would add {'it' if len(chosen) == 1 else 'them'} to {path}, "
538
+ f"which holds {render.count(held, 'row')}."
518
539
  )
519
540
  print(
520
- f"dry run: {len(chosen)} rows shown above, nothing written. {target}",
541
+ f"dry run: {render.count(len(chosen), 'row')} shown above, nothing written. {target}",
521
542
  file=sys.stderr,
522
543
  )
523
544
  return 0
524
545
  added, existing = share.write_contribution(path, chosen)
525
546
  if existing:
526
547
  print(
527
- f"added {added} rows to {path}, which already held {existing}. "
548
+ f"added {render.count(added, 'row')} to {path}, which already held {existing}. "
528
549
  "Nothing has been sent. To submit:",
529
550
  file=sys.stderr,
530
551
  )
531
552
  else:
532
- print(f"wrote {added} rows to {path}. Nothing has been sent. To submit:", file=sys.stderr)
553
+ print(
554
+ f"wrote {render.count(added, 'row')} to {path}. Nothing has been sent. To submit:",
555
+ file=sys.stderr,
556
+ )
533
557
  for command in share.git_commands(path):
534
558
  print(f" {command}", file=sys.stderr)
535
559
  return 0
@@ -543,7 +567,7 @@ def cmd_validate(args: argparse.Namespace) -> int:
543
567
  for finding in findings:
544
568
  print(finding)
545
569
  if findings:
546
- print(f"{len(findings)} problems", file=sys.stderr)
570
+ print(render.count(len(findings), "problem"), file=sys.stderr)
547
571
  return 1
548
572
  print("all rows valid")
549
573
  return 0
@@ -593,7 +617,7 @@ def cmd_claims(args: argparse.Namespace) -> int:
593
617
  if args.check and stale:
594
618
  print(f"out of date: {', '.join(stale)}. Run `agentpace claims`.", file=sys.stderr)
595
619
  return 1
596
- print("claims match the data" if args.check else f"updated {len(stale)} files")
620
+ print("claims match the data" if args.check else f"updated {render.count(len(stale), 'file')}")
597
621
  return 0
598
622
 
599
623
 
@@ -15,6 +15,11 @@ CLOCK_NOTE = (
15
15
  )
16
16
 
17
17
 
18
+ def count(n: int, noun: str, plural: str | None = None) -> str:
19
+ """A count with its noun in agreement: `1 row`, `2 rows`. `plural` defaults to noun + s."""
20
+ return f"{n} {noun if n == 1 else (plural or noun + 's')}"
21
+
22
+
18
23
  def human_text(human: HumanPart) -> str:
19
24
  """The human block. It names the quantity and its status, and never offers a number derived
20
25
  from agent time. A measured form quotes only the user's own waits, per human turn. No
@@ -25,7 +30,8 @@ def human_text(human: HumanPart) -> str:
25
30
  return (
26
31
  f"{HUMAN_PART}: {human.status} from {human.source}. Waiting on you per human turn: "
27
32
  f"P50 {duration(p50)}, P80 {duration(p80)}, P90 {duration(p90)} "
28
- f"({human.gaps} gaps, {human.sessions} sessions); elapsed time, not effort. "
33
+ f"({count(human.gaps or 0, 'gap')}, {count(human.sessions or 0, 'session')}); "
34
+ "elapsed time, not effort. "
29
35
  "No allowance for it is added to the total above, and up to the idle cap such waits "
30
36
  "already sit inside the session clock, so do not add them to it. "
31
37
  "Do not derive it from the agent time."
@@ -84,9 +90,10 @@ def outcomes_text(plan: PlanRange) -> str | None:
84
90
  "not task acceptance, and they are left out of the fit."
85
91
  )
86
92
  if summary.completed_without_duration:
93
+ without = summary.completed_without_duration
87
94
  line += (
88
- f" {summary.completed_without_duration} completed rows with no duration are left out "
89
- "too."
95
+ f" {count(without, 'completed row')} with no duration "
96
+ f"{'is' if without == 1 else 'are'} left out too."
90
97
  )
91
98
  return line
92
99
 
@@ -120,12 +127,12 @@ def plan_text(plan: PlanRange, quoted: str | None = None) -> str:
120
127
  else:
121
128
  lines.append(
122
129
  f"Effective parallelism at cap {plan.agent_cap}: {plan.effective_parallelism:.2f} "
123
- f"(from {plan.parallelism_sessions} sessions). Throughput set the total in "
130
+ f"(from {count(plan.parallelism_sessions, 'session')}). Throughput set the total in "
124
131
  f"{plan.throughput_bound_share:.0%} of simulations."
125
132
  )
126
133
  excluded = f", {plan.rows_excluded} not completed so excluded" if plan.rows_excluded else ""
127
134
  lines.append(
128
- f"Method: {plan.method}. {plan.rows_used} runs{excluded}. "
135
+ f"Method: {plan.method}. {count(plan.rows_used, 'run')}{excluded}. "
129
136
  f"{plan.draws} simulations, seed {plan.seed}."
130
137
  )
131
138
  outcomes = outcomes_text(plan)
@@ -100,11 +100,19 @@ def dedupe_key(row: Row) -> tuple[str, str, int, int]:
100
100
 
101
101
 
102
102
  def read_rows(path: Path) -> list[Row]:
103
+ """Every row in `path`. A bad line is named by file and line number, never by its content."""
103
104
  rows: list[Row] = []
104
105
  with path.open(encoding="utf-8") as handle:
105
- for line in handle:
106
- if line.strip():
107
- rows.append(json.loads(line))
106
+ for number, line in enumerate(handle, start=1):
107
+ if not line.strip():
108
+ continue
109
+ try:
110
+ row = json.loads(line)
111
+ except ValueError:
112
+ raise ValueError(f"{path.name}:{number}: not valid JSON") from None
113
+ if not isinstance(row, dict):
114
+ raise ValueError(f"{path.name}:{number}: not a JSON object")
115
+ rows.append(row)
108
116
  return rows
109
117
 
110
118
 
@@ -8,9 +8,10 @@ from __future__ import annotations
8
8
 
9
9
  import os
10
10
  from collections.abc import Iterable, Sequence
11
+ from contextlib import suppress
11
12
  from pathlib import Path
12
13
 
13
- from agentpace import schema
14
+ from agentpace import render, schema
14
15
  from agentpace.adapters import EXPERIMENTAL
15
16
  from agentpace.schema import Row
16
17
 
@@ -60,7 +61,7 @@ def select(
60
61
  unmatched = sorted(batch for batch, count in dropped.items() if not count)
61
62
  if unmatched:
62
63
  raise ValueError(
63
- f"--drop-session names {len(unmatched)} sessions with no local run "
64
+ f"--drop-session names {render.count(len(unmatched), 'session')} with no local run "
64
65
  f"({', '.join(unmatched)}); nothing was written. See `agentpace runs`"
65
66
  )
66
67
  return sorted(chosen, key=schema.dedupe_key), skipped, dropped
@@ -103,7 +104,16 @@ def write_contribution(path: Path, rows: Sequence[Row]) -> tuple[int, int]:
103
104
  path.parent.mkdir(parents=True, exist_ok=True)
104
105
  temporary = path.with_name(path.name + ".tmp")
105
106
  temporary.write_bytes(old + new)
106
- os.replace(temporary, path)
107
+ try:
108
+ os.replace(temporary, path)
109
+ except OSError:
110
+ # On Windows a file another program holds open cannot be replaced.
111
+ with suppress(OSError):
112
+ temporary.unlink()
113
+ raise ValueError(
114
+ f"could not replace {path.name}: it is open in another program. Nothing was changed;"
115
+ " close it and run share --write again"
116
+ ) from None
107
117
  return len(rows), existing
108
118
 
109
119
 
@@ -113,10 +123,13 @@ def experimental_note(rows: Iterable[Row]) -> str | None:
113
123
  if not harnesses:
114
124
  return None
115
125
  names = ", ".join(sorted(set(harnesses)))
126
+ one = len(harnesses) == 1
127
+ them = "it" if one else "them"
116
128
  return (
117
- f"{len(harnesses)} rows come from experimental adapters ({names}). validate rejects them"
118
- " until the adapter is verified, so a pull request with them stays red until a maintainer"
119
- " reconciles them by hand; see docs/verify-adapter.md."
129
+ f"{render.count(len(harnesses), 'row')} {'comes' if one else 'come'} from experimental "
130
+ f"adapters ({names}). validate rejects {them} until the adapter is verified, so a pull "
131
+ f"request with {them} stays red until a maintainer reconciles {them} by hand; see "
132
+ "docs/verify-adapter.md."
120
133
  )
121
134
 
122
135
 
@@ -21,7 +21,7 @@ from pathlib import Path
21
21
  from typing import Any
22
22
 
23
23
  from agentpace import estimate as est
24
- from agentpace import ingest, paths, pseudonym, schema
24
+ from agentpace import ingest, paths, pseudonym, render, schema
25
25
  from agentpace.adapters.claude_code import _extended, _parse_time
26
26
 
27
27
  Turn = dict[str, Any]
@@ -55,21 +55,24 @@ class TurnsReport:
55
55
 
56
56
  def lines(self) -> list[str]:
57
57
  lines = [
58
- f"read {self.files} main-session transcripts: {self.gaps} gaps in "
59
- f"{self.sessions} sessions"
58
+ f"read {render.count(self.files, 'main-session transcript')}: "
59
+ f"{render.count(self.gaps, 'gap')} in {render.count(self.sessions, 'session')}"
60
60
  ]
61
61
  if self.no_origin:
62
62
  lines.append(
63
- f"skipped {self.no_origin} sessions with no turnOrigin, so human prompts cannot "
64
- "be told apart from other records"
63
+ f"skipped {render.count(self.no_origin, 'session')} with no turnOrigin, so human "
64
+ "prompts cannot be told apart from other records"
65
65
  )
66
66
  if self.too_short:
67
- lines.append(f"skipped {self.too_short} sessions with fewer than 2 human prompts")
67
+ lines.append(
68
+ f"skipped {render.count(self.too_short, 'session')} with fewer than 2 human prompts"
69
+ )
68
70
  if self.unreadable:
69
- lines.append(f"could not read {self.unreadable} files")
71
+ lines.append(f"could not read {render.count(self.unreadable, 'file')}")
70
72
  if self.kept_from_earlier:
71
73
  lines.append(
72
- f"kept {self.kept_from_earlier} gaps from sessions whose transcripts are gone"
74
+ f"kept {render.count(self.kept_from_earlier, 'gap')} from sessions whose "
75
+ "transcripts are gone"
73
76
  )
74
77
  return lines
75
78