estimetry 0.1.2 → 0.3.0
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.
- package/CHANGELOG.md +20 -0
- package/README.md +88 -16
- package/dist/application/contracts/skill-mention.js +20 -0
- package/dist/application/estimetry.js +2 -0
- package/dist/application/hooks/context-limit.js +10 -2
- package/dist/application/hooks/hook-context.js +12 -4
- package/dist/application/hooks/receive-session-hook.js +15 -4
- package/dist/application/hooks/session-end-import.js +6 -7
- package/dist/application/project/init-defaults.js +17 -4
- package/dist/application/project/init-project.js +4 -1
- package/dist/application/project/install-copy.js +8 -1
- package/dist/application/project/show-init-choices.js +1 -1
- package/dist/application/project/tool-notices.js +8 -0
- package/dist/application/task/import-session-logs.js +4 -1
- package/dist/application/task/show-calibration.js +12 -8
- package/dist/application/task/task-cards.js +1 -1
- package/dist/bootstrap/container.js +23 -6
- package/dist/bootstrap/hook-receiver.js +7 -14
- package/dist/bootstrap/main.js +1 -1
- package/dist/domain/calibration/applicable-coefficient.js +35 -19
- package/dist/domain/calibration/calibration-policy.js +39 -0
- package/dist/domain/calibration/calibration.js +21 -36
- package/dist/domain/calibration/level-parts.js +41 -0
- package/dist/domain/calibration/ratio-samples.js +34 -0
- package/dist/domain/code/code-classes.js +1 -1
- package/dist/domain/estimate/estimate.js +22 -5
- package/dist/domain/progress/progress-record-parser.js +6 -0
- package/dist/domain/progress/session-log.js +2 -1
- package/dist/domain/usage/task-usage.js +24 -7
- package/dist/infrastructure/persistence/records.js +1 -1
- package/dist/infrastructure/persistence/yaml-config-store.js +6 -5
- package/dist/infrastructure/persistence/yaml-estimate-reader.js +20 -12
- package/dist/integrations/tools/claude-code/claude-code-adapter.js +29 -48
- package/dist/integrations/tools/claude-code/hook-events.js +4 -0
- package/dist/integrations/tools/claude-code/hook-translation.js +16 -34
- package/dist/integrations/tools/claude-code/importer/claude-code-logs.js +1 -1
- package/dist/integrations/tools/claude-code/skill-file.js +7 -19
- package/dist/integrations/tools/codex/codex-adapter.js +161 -0
- package/dist/integrations/tools/codex/hook-events.js +23 -0
- package/dist/integrations/tools/codex/hook-translation.js +76 -0
- package/dist/integrations/tools/codex/hook-trust.js +69 -0
- package/dist/integrations/tools/codex/importer/codex-logs.js +208 -0
- package/dist/integrations/tools/codex/importer/rollout-parser.js +163 -0
- package/dist/integrations/tools/codex/sandbox-rules.js +38 -0
- package/dist/integrations/tools/codex/skill-file.js +22 -0
- package/dist/integrations/tools/codex/trust-tables.js +96 -0
- package/dist/integrations/tools/content/commands.js +35 -26
- package/dist/integrations/tools/shared/generated-file.js +26 -0
- package/dist/integrations/tools/shared/hook-payload.js +33 -0
- package/dist/integrations/tools/{claude-code → shared}/hook-settings.js +37 -22
- package/dist/integrations/tools/shared/instructions-block.js +39 -0
- package/dist/integrations/tools/shared/skills-plan.js +39 -0
- package/dist/interface/cli/commands/calibrate-command.js +11 -0
- package/dist/interface/cli/commands/hook-command.js +1 -1
- package/dist/interface/cli/commands/init-command.js +16 -7
- package/dist/interface/cli/commands/status-command.js +5 -2
- package/dist/interface/cli/help.js +3 -1
- package/dist/interface/cli/presenters/text/closing-text.js +7 -3
- package/dist/interface/cli/presenters/text/estimate-text.js +35 -13
- package/dist/interface/cli/presenters/text/notices-text.js +1 -0
- package/dist/interface/cli/presenters/text/task-text.js +1 -1
- package/dist/interface/cli/presenters/text-presenter.js +3 -3
- package/package.json +1 -1
- package/dist/integrations/tools/claude-code/claude-md.js +0 -28
- /package/dist/integrations/tools/{claude-code/importer → shared}/log-lines.js +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,26 @@ All notable changes to estimetry. Versions follow [semantic versioning](https://
|
|
|
4
4
|
|
|
5
5
|
## Unreleased
|
|
6
6
|
|
|
7
|
+
## 0.3.0 — 2026-11-22
|
|
8
|
+
|
|
9
|
+
- **Calibration from the first closed task.** The coefficient an estimate applies is the median of fact over estimate shrunk towards 1 with the weight n / (n + k) (`calibration.shrink`, 2 by default), instead of nothing until a slice has 5 tasks. The slices form a chain — all your tasks, the technology of the query with the most tasks, the task type — each shrunk towards the one above by the tasks no deeper slice holds, so every task counts once; the deepest applies, and the overall slice now counts too. `emt calibrate` names the slice, the number of tasks and the weight.
|
|
10
|
+
- **Pessimistic coefficient.** `c · e^(ln 2 / √n)`, at most 1 while your estimates run high: the agent multiplies the pessimistic hours by it and the optimistic and most likely hours by the coefficient. The estimate file takes it as `calibration.pessimistic`; the base calibration compares with is still likely over the coefficient.
|
|
11
|
+
- **Without calibration** an estimate is now only when no task is closed yet, every closed task is left out or has no estimate, there are fewer tasks than your `calibration.minTasks`, or some cards come from a newer estimetry; `emt calibrate` says which.
|
|
12
|
+
- New defaults: `calibration.minTasks: 1`, `calibration.shrink: 2`. A `minTasks` you set without `shrink` means `shrink: 0`; `minTasks: 5` alone gives the coefficient of earlier versions wherever they gave one, and the median of all your tasks where neither the type nor a technology has 5; the pessimistic hours get the pessimistic coefficient there too, a reserve earlier versions did not give. The README shows what to expect from each setting.
|
|
13
|
+
- `calibration.json` has schema 3: `weight` instead of `applicable` in every slice, and `shrink`. It is rewritten by the next closing or `emt rebuild`.
|
|
14
|
+
- `emt calibrate --json` has `schemaVersion: 2`: `coefficient` is `{ value, pessimistic, slice: { kind, key? }, n, weight }`, slices carry `weight` instead of `applicable`, and `shrink` sits beside `minTasks`.
|
|
15
|
+
- `emt calibrate --help` names `calibration.minTasks` and `calibration.shrink` with their defaults, and `emt --help` says where `config.yaml` lives.
|
|
16
|
+
- Run `emt upgrade` once: the skills are written again.
|
|
17
|
+
|
|
18
|
+
## 0.2.0 — 2026-11-21
|
|
19
|
+
|
|
20
|
+
- **Codex.** `estimetry init --tools codex`, or picking Codex in `init`, sets up the hooks of Codex (in `~/.codex/hooks.json`, or `.codex/hooks.json` of the project with `--shared-hooks`) and the `emt-…` skills (in `~/.agents/skills`, or `.agents/skills`), called as `$emt-…`. Sessions of Codex are measured like those of Claude Code, and both tools may serve one task. Codex runs a hook only once you trust it, and the agent's commands in a sandbox: in a terminal `init` asks whether to trust the estimetry hooks and to let the task commands (`emt start`, `extra`, `close`…) out of the sandbox, and records both with yes or `--trust-hooks` (`~/.codex/config.toml`, `~/.codex/rules/estimetry.rules`). `emt upgrade` trusts again the hooks it changes when you trusted them before; `emt status` warns while they are not trusted. Requires Codex 0.145 or newer.
|
|
21
|
+
- The rollouts of Codex sessions are imported at the session end and before a task closes: turns, subagents and tokens by model. Codex records no cost, so its sessions count in tokens only, and the cost of a task says by how many sessions it is counted (`cost from 1 of 2 sessions`, or `not reported`). Cards get `usage.withCost`.
|
|
22
|
+
- `init` without `--tools` now sets up the tools found on this machine (`~/.claude`, `~/.codex`) when none is installed in the project yet, instead of every tool.
|
|
23
|
+
- The texts outside an agent name the skills without the slash of Claude Code (`skill emt-retro`); the context the hooks give an agent names them as its tool calls them.
|
|
24
|
+
- The journal: `log.session` records may carry `costReported: false` and a `cacheWrite` count; records of 0.1 read as before, and 0.1 reads the new ones, though it counts a Codex session as costing nothing.
|
|
25
|
+
- Run `emt upgrade` once: the skills are written again.
|
|
26
|
+
|
|
7
27
|
## 0.1.2 — 2026-11-12
|
|
8
28
|
|
|
9
29
|
- The hooks `init` writes run the installation of estimetry that ran it, by the paths of its Node.js and entry point, and fall back to `estimetry` on `PATH`. A version manager (asdf, nvm) that picks another Node.js for a project, or one without estimetry, no longer stops the Claude Code hooks or the `post-commit` hook. Settings and hooks the project commits keep the plain `estimetry hook …`. Run `emt upgrade` once to rewrite the hooks.
|
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ The CLI is `estimetry`, with the short alias `emt`.
|
|
|
11
11
|
You need:
|
|
12
12
|
- Node.js 22.12 or newer;
|
|
13
13
|
- git;
|
|
14
|
-
- [Claude Code](https://docs.claude.com/en/docs/claude-code)
|
|
14
|
+
- an AI tool: [Claude Code](https://docs.claude.com/en/docs/claude-code), [Codex](https://github.com/openai/codex) 0.145 or newer, or both.
|
|
15
15
|
|
|
16
16
|
```sh
|
|
17
17
|
npm install -g estimetry
|
|
@@ -26,12 +26,14 @@ To update later: `npm install -g estimetry@latest`, then `emt upgrade` once (see
|
|
|
26
26
|
|
|
27
27
|
## Getting started
|
|
28
28
|
|
|
29
|
-
1. In the root of a repository, run `estimetry init`. It sets up the
|
|
30
|
-
2. Start a new
|
|
29
|
+
1. In the root of a repository, run `estimetry init`. It sets up the hooks and the `emt-…` skills of the AI tools it finds on your machine. Codex runs a hook only once you trust it: init asks whether to trust the estimetry hooks for you.
|
|
30
|
+
2. Start a new session there and ask how long a task will take, or run `/emt-estimate`. The agent creates the task, estimates it by parts and saves the estimate once you approve it.
|
|
31
31
|
3. Run `/emt-start` and work as usual. The hooks measure the time of the agents and your own time; `emt status` shows it.
|
|
32
32
|
4. When the work is done, run `/emt-close`. The agent closes the task and asks you why the fact differs from the estimate.
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
The skills are the same in both tools: Claude Code calls them as `/emt-…`, Codex as `$emt-…` (`$emt-estimate`, `$emt-start`). This README names them the Claude Code way.
|
|
35
|
+
|
|
36
|
+
Every closed task makes the next estimate more grounded: `emt similar` finds past tasks like the new one, and `emt calibrate` gives your own coefficient from the first closed task, more confident with every next one.
|
|
35
37
|
|
|
36
38
|
## Help
|
|
37
39
|
|
|
@@ -50,7 +52,7 @@ estimetry init
|
|
|
50
52
|
```
|
|
51
53
|
|
|
52
54
|
In a terminal it asks a few questions:
|
|
53
|
-
- which AI tools to set up
|
|
55
|
+
- which AI tools to set up: Claude Code, Codex, or both;
|
|
54
56
|
- the development process (OpenSpec or none);
|
|
55
57
|
- how to share data with your team;
|
|
56
58
|
- whether to install a git hook.
|
|
@@ -59,14 +61,34 @@ In a terminal it asks a few questions:
|
|
|
59
61
|
|
|
60
62
|
### What it installs
|
|
61
63
|
|
|
64
|
+
By default init sets up the tools already installed in the project, else those it finds on this machine (`~/.claude`, `~/.codex`), else all of them.
|
|
65
|
+
|
|
66
|
+
**Claude Code:**
|
|
67
|
+
|
|
62
68
|
| What | Where | Who gets it |
|
|
63
69
|
|---|---|---|
|
|
64
70
|
| Hooks for 12 Claude Code events, each running this installation (`<node> <estimetry> hook claude-code <event>`, else `estimetry hook claude-code <event>` from `PATH`) | `.claude/settings.local.json` | you |
|
|
65
71
|
| Skills `estimetry`, `emt-estimate`, `emt-start`, `emt-extra`, `emt-parallel`, `emt-manual`, `emt-close`, `emt-retro` (also the `/emt-…` commands) | `~/.claude/skills/` (or `$CLAUDE_CONFIG_DIR/skills/`) | you, in every project |
|
|
66
|
-
| Project id and development process | `.estimetry/config.yaml` | the team; commit it so clones of the repository are one project |
|
|
67
72
|
|
|
68
73
|
With `--shared-hooks` the hooks go to `.claude/settings.json` and the skills to `.claude/skills/` of the project. A reminder to run `/emt-estimate` before naming a deadline is added to `CLAUDE.md`, between `<!-- estimetry:start -->` and `<!-- estimetry:end -->`. These are files the project commits, so the whole team gets them.
|
|
69
74
|
|
|
75
|
+
**Codex:**
|
|
76
|
+
|
|
77
|
+
| What | Where | Who gets it |
|
|
78
|
+
|---|---|---|
|
|
79
|
+
| Hooks for 10 Codex events, each running this installation (`<node> <estimetry> hook codex <event>`, else `estimetry hook codex <event>` from `PATH`) | `~/.codex/hooks.json` (or `$CODEX_HOME/hooks.json`) | you, in every project |
|
|
80
|
+
| The same skills, called as `$emt-…` | `~/.agents/skills/` | you, in every project |
|
|
81
|
+
| With your consent: a trust of each hook | `~/.codex/config.toml`, `[hooks.state."…"]` | you |
|
|
82
|
+
| With your consent: a rule that lets the task commands (`emt start`, `extra`, `close`…) run outside the sandbox of Codex | `~/.codex/rules/estimetry.rules`, also with `--shared-hooks` | you |
|
|
83
|
+
|
|
84
|
+
Codex has no personal settings inside a project, so the hooks of a personal install serve every project on the machine; in a project without estimetry they do nothing. With `--shared-hooks` the hooks go to `.codex/hooks.json` and the skills to `.agents/skills/` of the project, and the reminder to run `$emt-estimate` goes to `AGENTS.md`. Codex reads the hooks of a project only once you trust the project.
|
|
85
|
+
|
|
86
|
+
**Both:**
|
|
87
|
+
|
|
88
|
+
| What | Where | Who gets it |
|
|
89
|
+
|---|---|---|
|
|
90
|
+
| Project id and development process | `.estimetry/config.yaml` | the team; commit it so clones of the repository are one project |
|
|
91
|
+
|
|
70
92
|
With `--track-commits` a `post-commit` hook is installed into the repository's hooks directory. This respects `core.hooksPath`, worktrees and husky (`.husky/post-commit`). An existing hook keeps its content: estimetry adds its own block between `# >>> estimetry >>>` and `# <<< estimetry <<<`. The hook runs estimetry in the background, so commits never wait for it. Colleagues without estimetry see nothing. A personal hook (in `.git`, or a hooks directory outside the repository) runs this installation by its paths, like the Claude Code hooks, so a commit from an IDE started from the Dock is recorded too. A hook the project commits (husky, `core.hooksPath` inside the repository) holds no paths of your machine and needs `estimetry` on `PATH`.
|
|
71
93
|
|
|
72
94
|
No task data ever goes into the repository. Tasks, estimates and the event journal live in `~/.local/share/estimetry/`, or in `ESTIMETRY_HOME` if set.
|
|
@@ -75,11 +97,12 @@ No task data ever goes into the repository. Tasks, estimates and the event journ
|
|
|
75
97
|
|
|
76
98
|
| Flag | Meaning |
|
|
77
99
|
|---|---|
|
|
78
|
-
| `--tools <ids>` | AI tools, comma-separated: `claude-code` (alias `claude`) |
|
|
100
|
+
| `--tools <ids>` | AI tools, comma-separated: `claude-code` (alias `claude`), `codex` (alias `openai-codex`) |
|
|
79
101
|
| `--flow <id>` | `openspec` or `none`; detected by default (`openspec/` in the root means OpenSpec) |
|
|
80
102
|
| `--share <mode>` | `none`, `calibration` or `cards`; only saved for now |
|
|
81
103
|
| `--track-commits` / `--no-track-commits` | install or remove the git hook |
|
|
82
104
|
| `--shared-hooks` / `--no-shared-hooks` | install for the whole team or for yourself only |
|
|
105
|
+
| `--trust-hooks` / `--no-trust-hooks` | trust the hooks in tools that ask for it (Codex) and let the task commands run outside their sandbox; asked in a terminal, not done without one |
|
|
83
106
|
| `--force` | overwrite generated skills you have edited |
|
|
84
107
|
| `--no-interactive` | do not ask questions |
|
|
85
108
|
| `--json` | print the report as JSON |
|
|
@@ -89,7 +112,10 @@ A repeated run keeps what is installed: once the git hook or the shared install
|
|
|
89
112
|
### Good to know
|
|
90
113
|
|
|
91
114
|
- **Your edits to generated skills are kept.** Every generated skill carries `metadata.generatedBy` and a hash of its content. If you edit one, init keeps your version and reports it as `skipped`; `--force` overwrites it. A file of the same name that estimetry did not create is never touched.
|
|
92
|
-
- **
|
|
115
|
+
- **Codex runs a hook only once you trust it, and the agent's commands in a sandbox.** Neither the CLI nor the VS Code extension of Codex always asks, so the hooks may stay silent. In a terminal init asks whether to trust them; with yes (or `--trust-hooks`) it records the trust in `~/.codex/config.toml`, as `/hooks` in Codex would, and adds a rule that lets the task commands write to the store of estimetry without asking: the sandbox allows writes only inside the project. `init`, `upgrade` and `rebuild` stay outside the rule; `close` and `renegotiate` are in it, so the agent closes a task without a prompt of Codex, only after you agree in the conversation. The rule is yours even with a shared install, and it is also the mark of your consent: `emt upgrade` trusts again the hooks it changes while the rule is there, and `--no-trust-hooks` takes it away (the trusts Codex keeps stay; take them back in `/hooks`). Without a terminal nothing is trusted unless you pass `--trust-hooks`. A `config.toml` with an inline or dotted `hooks` table or a multi-line string is not changed: then trust the hooks in `/hooks`. The rule allows `emt` by name: keep project directories (direnv `./bin`, `node_modules/.bin`) out of your `PATH` in Codex, or the agent could put an `emt` of its own there. `emt status` warns while they are not trusted.
|
|
116
|
+
- **Personal and shared Codex hooks together run twice.** Codex adds up the hooks of every file. The fact stays right, since repeated events are dropped, but init warns and you may remove the estimetry hooks from `~/.codex/hooks.json`.
|
|
117
|
+
- **Codex may copy Claude Code settings.** Its migration of Claude Code settings (hooks, skills) can bring the Claude Code hooks of estimetry into Codex. Set up Codex with `estimetry init --tools codex` instead, and remove such copies.
|
|
118
|
+
- **A rewritten hook is yours.** estimetry recognises its hooks by the command it writes: the paths of the installation that fall back to `estimetry hook claude-code` (or `hook codex`), or that prefix alone. If you change that command, init treats the hook as yours and adds its own next to it.
|
|
93
119
|
- **`settings.local.json` may not be ignored by git.** Claude Code adds `**/.claude/settings.local.json` to your global git excludes only when it writes that file itself. If init creates it and git does not ignore it, init offers to add the same line. With `--no-interactive` it only warns.
|
|
94
120
|
- **Hooks run the installation that ran `init`.** `npm install -g` under the same Node.js replaces it in place. After installing estimetry under another Node.js, or removing the one that ran `init`, run `emt upgrade`: until then the hooks run the old installation or fall back to `estimetry` on `PATH`. Run through `npx`, or on Windows, init writes no paths, and the hooks need `estimetry` on `PATH`. The hooks also keep the data directory of that `init` unless `ESTIMETRY_HOME` is set where they run: an `init` with a temporary `ESTIMETRY_HOME` sends the hooks of the project there too.
|
|
95
121
|
|
|
@@ -108,8 +134,10 @@ emt calibrate --type feature --revise # for a revision of a task in progress
|
|
|
108
134
|
```
|
|
109
135
|
|
|
110
136
|
- **Similarity** weighs the shared technologies (half), the type of the first estimate and, with `--hours`, the size. Each task shows what its similarity is made of. Without `--stack`, the stack of the project counts.
|
|
111
|
-
- **The coefficient** is the median of fact over estimate
|
|
112
|
-
- **
|
|
137
|
+
- **The coefficient** comes from the first closed task. It is the median of fact over estimate, shrunk towards 1 with the weight n / (n + k), `k` being `calibration.shrink` (2 by default): one task weighs ⅓, two ½, six ¾. The slices form a chain: all your tasks, the technology of the query with the most tasks, the task type. Each is shrunk towards the one above by the tasks no deeper slice holds, so every task counts once, and the deepest one applies. `emt calibrate` names the slice, the number of tasks and the weight; below 50% the agent tells you the coefficient is still cautious.
|
|
138
|
+
- **The pessimistic coefficient**, `c · e^(ln 2 / √n)`, keeps a reserve while the tasks are few; while your estimates run high (`c < 1`) it is at most 1.
|
|
139
|
+
- **Without calibration** the estimate is only when no task is closed yet, every closed task is left out or has no estimate, there are fewer than your `calibration.minTasks`, or some cards come from a newer estimetry. `emt calibrate` says which, and the agent tells you.
|
|
140
|
+
- **A calibrated estimate** multiplies the optimistic and most likely hours of every part by the coefficient and the pessimistic hours by the pessimistic coefficient, and records both (`calibrated: true`, `calibration.coefficient`, `calibration.pessimistic`), so the next coefficient is computed from the estimate before it. A reserve goes only into the pessimistic hours, on top of that: extra work you absorbed is already in the coefficient.
|
|
113
141
|
- **Nothing is written** by `emt similar` and `emt calibrate`; `calibration.json` is updated by closings and `emt rebuild`.
|
|
114
142
|
- **A changed email.** Calibration is personal, by `author.id` in `config.yaml`. List earlier ids so that their cards stay yours:
|
|
115
143
|
|
|
@@ -121,7 +149,7 @@ emt calibrate --type feature --revise # for a revision of a task in progress
|
|
|
121
149
|
|
|
122
150
|
## Measuring a task
|
|
123
151
|
|
|
124
|
-
Once a task is started (`emt start`), the Claude Code
|
|
152
|
+
Once a task is started (`emt start`), the hooks of Claude Code and Codex record its sessions into the task's journal; sessions of both tools may serve one task. `emt status` shows the fact measured so far: the time of the agents, your own time, and how certain the numbers are.
|
|
125
153
|
|
|
126
154
|
### What counts
|
|
127
155
|
|
|
@@ -157,6 +185,8 @@ The cost is the total Claude Code itself records in the session log, at API pric
|
|
|
157
185
|
|
|
158
186
|
Sessions that ended before you installed this version are read when the task closes. Claude Code deletes logs after 30 days; for longer tasks raise `cleanupPeriodDays` in its settings.
|
|
159
187
|
|
|
188
|
+
**Codex** keeps a rollout of every session in `~/.codex/sessions/`. estimetry reads it in the same way: turns, subagents and tokens by model. Codex records no cost, so its sessions count in tokens only. The cost of a task then stands for its Claude Code sessions, and the status says by how many: `cost from 1 of 2 sessions`, or `not reported` when there are none. Codex compresses rollouts older than a week, and those are not read; the end of a session imports its rollout long before that. The internal subagents of Codex (such as the review of commands before you approve them) leave no hooks and are not counted.
|
|
189
|
+
|
|
160
190
|
### Which task a session serves
|
|
161
191
|
|
|
162
192
|
- **One task in progress** — a session binds to it by itself.
|
|
@@ -165,7 +195,7 @@ Sessions that ended before you installed this version are read when the task clo
|
|
|
165
195
|
|
|
166
196
|
### Restarts and parallel sessions
|
|
167
197
|
|
|
168
|
-
The hooks find the project by the directory
|
|
198
|
+
The hooks find the project by the directory the AI tool runs in, not by the session id. In Codex a session begins with its first prompt, not when Codex starts: Codex tells the hooks of a session only then.
|
|
169
199
|
|
|
170
200
|
- **After a restart** (VS Code, a crash, a reboot) the new session has a new id and binds again by the rules above: with one task in progress, time goes on into it without anything to do. With several, answer the agent which task it is: once attached, the work the new session did since the task started counts too.
|
|
171
201
|
- **A turn cut off by a crash** gets no end. Its tail is closed by the idle threshold and shows as uncertainty (`± …` in `emt status`). The time between the crash and the restart does not count.
|
|
@@ -281,13 +311,53 @@ Names, descriptions and the retro sit in a separate `text` section of the card,
|
|
|
281
311
|
- how well the code volume was forecast;
|
|
282
312
|
- which kinds of parts run over.
|
|
283
313
|
|
|
284
|
-
|
|
314
|
+
Every slice has a weight, n / (n + k), next to its median and mean (see [Estimating a task](#estimating-a-task) for how the coefficient is built from them):
|
|
315
|
+
|
|
316
|
+
```json
|
|
317
|
+
{
|
|
318
|
+
"schemaVersion": 3,
|
|
319
|
+
"minTasks": 1,
|
|
320
|
+
"shrink": 2,
|
|
321
|
+
"authors": {
|
|
322
|
+
"you@example.com": {
|
|
323
|
+
"tasks": 4,
|
|
324
|
+
"ratio": {
|
|
325
|
+
"overall": { "n": 4, "median": 0.5, "mean": 0.55, "weight": 0.667 },
|
|
326
|
+
"byType": { "feature": { "n": 3, "median": 0.6, "mean": 0.62, "weight": 0.6 } }
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
**Settings.** Two settings in `~/.local/share/estimetry/config.yaml` (under `ESTIMETRY_HOME` if you set it) decide how soon calibration starts and how strongly it acts:
|
|
285
334
|
|
|
286
335
|
```yaml
|
|
287
336
|
calibration:
|
|
288
|
-
minTasks:
|
|
337
|
+
minTasks: 1 # a slice counts from this many closed tasks; below it in all your tasks, no coefficient
|
|
338
|
+
shrink: 2 # k in n / (n + k): larger is more cautious, 0 applies the median as it is
|
|
289
339
|
```
|
|
290
340
|
|
|
341
|
+
Setting `minTasks` without `shrink` means `shrink: 0`: a threshold you chose yourself keeps the coefficient it gave.
|
|
342
|
+
|
|
343
|
+
**What to expect.** Say every closed task took half of its estimate (fact over estimate 0.5), all of one type and technology. The coefficient and the pessimistic coefficient after 1, 3, 5 and 10 closed tasks (— is without calibration):
|
|
344
|
+
|
|
345
|
+
| Settings | 1 task | 3 tasks | 5 tasks | 10 tasks |
|
|
346
|
+
|---|---|---|---|---|
|
|
347
|
+
| default: `minTasks: 1`, `shrink: 2` | ×0.79 / ×1.00 | ×0.66 / ×0.98 | ×0.61 / ×0.83 | ×0.56 / ×0.70 |
|
|
348
|
+
| faster: `shrink: 1` | ×0.71 / ×1.00 | ×0.59 / ×0.89 | ×0.56 / ×0.77 | ×0.53 / ×0.66 |
|
|
349
|
+
| more cautious: `shrink: 5` | ×0.89 / ×1.00 | ×0.77 / ×1.00 | ×0.71 / ×0.96 | ×0.63 / ×0.78 |
|
|
350
|
+
| later start: `minTasks: 3`, `shrink: 2` | — | ×0.66 / ×0.98 | ×0.61 / ×0.83 | ×0.56 / ×0.70 |
|
|
351
|
+
| as in 0.2: `minTasks: 5` | — | — | ×0.50 / ×0.68 | ×0.50 / ×0.62 |
|
|
352
|
+
| the median as it is: `shrink: 0` | ×0.50 / ×1.00 | ×0.50 / ×0.75 | ×0.50 / ×0.68 | ×0.50 / ×0.62 |
|
|
353
|
+
|
|
354
|
+
- The coefficient moves from 1 towards your median as tasks close; `shrink` sets how fast. The pessimistic coefficient stays at 1 while there is little experience and comes down to the coefficient with it.
|
|
355
|
+
- When your estimates run low, nothing caps the pessimistic coefficient: with fact over estimate 1.5 the default gives ×1.14 / ×2.29 after one task and ×1.40 / ×1.75 after ten.
|
|
356
|
+
- With tasks of several types and technologies the coefficient comes from the chain of slices: the tasks of the type weigh by their number, your other tasks fill in the rest of the weight, and what is still missing stays at 1.
|
|
357
|
+
- `minTasks: 5` gives the coefficient of earlier versions wherever they gave one, with two differences. When neither the type nor a technology has 5 tasks, the median of all your tasks applies, where earlier versions gave none. The pessimistic hours are multiplied by the pessimistic coefficient, not by the coefficient, so they keep a reserve earlier versions did not give.
|
|
358
|
+
|
|
359
|
+
**Changing them.** Edit `config.yaml` and run `emt calibrate --type <type> --stack <a,b>`: it computes from your cards at once and names the coefficient, the slice, the number of tasks and the weight. Estimates already saved keep their coefficient. `calibration.json` follows at the next closing or with `emt rebuild`, which also rewrites a `calibration.json` of an earlier schema.
|
|
360
|
+
|
|
291
361
|
Tasks in parallel mode count with their sequential equivalent. Abandoned tasks and tasks with manual time only are left out.
|
|
292
362
|
|
|
293
363
|
Revised tasks give two accuracies:
|
|
@@ -307,7 +377,7 @@ The journal keeps when things happened, not what was said or done: no prompt tex
|
|
|
307
377
|
|
|
308
378
|
Run `emt upgrade` once, from any directory. It sets estimetry up again in every working copy of every registered project on this machine (worktrees included), each with the choices it already has: tools, flow, a personal or shared install, the commit hook. It shows what will change and asks first; without a terminal it needs `--yes`. A copy where estimetry was never set up is skipped, and so is one that is not on this machine. With a shared install the plan warns that the files it changes are committed by the project. To update a single project instead, run `emt init` inside it.
|
|
309
379
|
|
|
310
|
-
Until then the hooks keep working: an update under the same Node.js replaces the installation they run; only what `init` wrote is old — the hook settings in each project, the skills and, with a shared install, the reminder in `CLAUDE.md`. At the start of a session in a project set up by an older version, the agent is told to suggest `emt upgrade`; it never runs it on its own.
|
|
380
|
+
Until then the hooks keep working: an update under the same Node.js replaces the installation they run; only what `init` wrote is old — the hook settings in each project, the skills and, with a shared install, the reminder in `CLAUDE.md` or `AGENTS.md`. Codex asks to trust its hooks again after `emt upgrade` changes them. At the start of a session in a project set up by an older version, the agent is told to suggest `emt upgrade`; it never runs it on its own.
|
|
311
381
|
|
|
312
382
|
Update every installed copy of estimetry at once. Cards written by an older version are rebuilt from the journals on the next closing, `emt task show` or `emt rebuild`. A newer card stops an older estimetry from rewriting `calibration.json` and is reported instead; versions before this check skip such cards silently, so close no task with them.
|
|
313
383
|
|
|
@@ -320,13 +390,15 @@ Every command and flag, by stage, as `emt --help` lists them. `estimetry` and `e
|
|
|
320
390
|
### Setup
|
|
321
391
|
|
|
322
392
|
- **`emt init`** — set up estimetry in this project: hooks, skills and commands of the AI tool, project config
|
|
323
|
-
- `--tools <ids>` — AI tools, comma-separated
|
|
393
|
+
- `--tools <ids>` — AI tools, comma-separated: claude-code, codex (default: installed, else found on this machine)
|
|
324
394
|
- `--flow <id>` — development process: openspec or none (default: detected)
|
|
325
395
|
- `--share <mode>` — sharing with the team: none, calibration, cards
|
|
326
396
|
- `--track-commits` — install a git post-commit hook
|
|
327
397
|
- `--no-track-commits` — remove the git post-commit hook
|
|
328
398
|
- `--shared-hooks` — install for the whole team, into files the project commits
|
|
329
399
|
- `--no-shared-hooks` — install for yourself only (default)
|
|
400
|
+
- `--trust-hooks` — trust the hooks in tools that ask for it (Codex) and let its task commands run outside their sandbox
|
|
401
|
+
- `--no-trust-hooks` — trust nothing, take away the rule for the task commands (without either flag: kept as it is)
|
|
330
402
|
- `--force` — overwrite generated skills you have edited
|
|
331
403
|
- `--no-interactive` — do not ask; use flags and defaults
|
|
332
404
|
- **`emt upgrade`** — after updating estimetry: set it up again in every project on this machine, each with its own choices
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A skill of estimetry named in a text for the agent, before the tool is known: the context of hooks and the
|
|
3
|
+
* bodies of skills mention a skill with this mark, and the tool's adapter turns it into the way its agent calls
|
|
4
|
+
* skills (`/emt-extra` in Claude Code, `$emt-extra` in Codex). One rule for every text.
|
|
5
|
+
*/
|
|
6
|
+
export function skillMention(id) {
|
|
7
|
+
return `{{skill:${id}}}`;
|
|
8
|
+
}
|
|
9
|
+
const MENTION = /\{\{skill:([a-z][a-z0-9-]*)\}\}/g;
|
|
10
|
+
/** The text with every mention of a skill named by `skillRef`. */
|
|
11
|
+
export function nameSkills(text, skillRef) {
|
|
12
|
+
return text.replace(MENTION, (_mark, id) => skillRef(id));
|
|
13
|
+
}
|
|
14
|
+
/** Where a body of a skill takes the arguments the user gave with it. */
|
|
15
|
+
export const ARGUMENTS_MENTION = '{{arguments}}';
|
|
16
|
+
/** A body of a skill in a tool's form: its skills named by `skillRef`, its arguments as `args`. */
|
|
17
|
+
export function renderBody(body, skillRef, args) {
|
|
18
|
+
return nameSkills(body, skillRef).replaceAll(ARGUMENTS_MENTION, args);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=skill-mention.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ImportSessionLogs } from './task/import-session-logs.js';
|
|
2
2
|
import { InitProject } from './project/init-project.js';
|
|
3
3
|
import { ShowInitChoices } from './project/show-init-choices.js';
|
|
4
|
+
import { toolNotices } from './project/tool-notices.js';
|
|
4
5
|
import { InstallCopy } from './project/install-copy.js';
|
|
5
6
|
import { UpgradePlanner } from './project/upgrade-plan.js';
|
|
6
7
|
import { ShowUpgradePlan } from './project/show-upgrade-plan.js';
|
|
@@ -92,6 +93,7 @@ function projectGroup(deps, core) {
|
|
|
92
93
|
init: (input) => initProject.execute(input),
|
|
93
94
|
upgradePlan: () => showUpgradePlan.execute(),
|
|
94
95
|
upgrade: () => upgradeProjects.execute(),
|
|
96
|
+
notices: () => toolNotices(deps.install, deps.workspace.currentRoot()),
|
|
95
97
|
};
|
|
96
98
|
}
|
|
97
99
|
function tasksGroup(deps, core) {
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
/** The agent reads this; the tool shows it among system messages, so it stays short. */
|
|
2
2
|
export const MAX_CONTEXT_LENGTH = 1000;
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Text for the agent cut to the limit, with an ellipsis when it was longer. A mention of a skill (`{{skill:…}}`) is
|
|
5
|
+
* named only after the cut, so a cut inside one drops the whole mark rather than leave a piece of it to the agent.
|
|
6
|
+
*/
|
|
4
7
|
export function cut(text, limit = MAX_CONTEXT_LENGTH) {
|
|
5
|
-
|
|
8
|
+
if (text.length <= limit) {
|
|
9
|
+
return text;
|
|
10
|
+
}
|
|
11
|
+
const head = text.slice(0, Math.max(0, limit - 1));
|
|
12
|
+
const open = head.lastIndexOf('{{');
|
|
13
|
+
return `${open > head.lastIndexOf('}}') ? head.slice(0, open) : head}…`;
|
|
6
14
|
}
|
|
7
15
|
//# sourceMappingURL=context-limit.js.map
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
+
import { skillMention } from '../contracts/skill-mention.js';
|
|
1
2
|
import { cut, MAX_CONTEXT_LENGTH } from './context-limit.js';
|
|
2
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Texts for the agent name skills with `skillMention`: the receiver names them the way the tool calls them.
|
|
5
|
+
* A mention is longer than any name it becomes, so a text cut to the limit stays within it.
|
|
6
|
+
*/
|
|
7
|
+
export const EXTRA_REMINDER = `estimetry: if the work has gone beyond the plan, record it with ${skillMention('emt-extra')}.`;
|
|
3
8
|
/** First line of every session start: estimates go through the protocol, never a guess (estimate mode, design §5.1). */
|
|
4
|
-
export const ESTIMATE_REMINDER =
|
|
9
|
+
export const ESTIMATE_REMINDER = `estimetry: before you name an effort or a deadline for a task, run ${skillMention('emt-estimate')}.`;
|
|
10
|
+
const START = skillMention('emt-start');
|
|
11
|
+
const CLOSE = skillMention('emt-close');
|
|
12
|
+
const NO_TASK = `estimetry: no task is in progress in this project, so the time of this session is not counted. Start one with ${START}.`;
|
|
5
13
|
/** The copy of the session was set up by an older estimetry (claude-code-hooks spec): the agent suggests, never runs, `emt upgrade`. */
|
|
6
14
|
export function upgradeText(current, installed) {
|
|
7
15
|
return (`estimetry: estimetry ${current} is installed, but this project was set up by ${installed ?? 'an older version'}. ` +
|
|
@@ -28,7 +36,7 @@ export function sessionStartContext(input) {
|
|
|
28
36
|
}
|
|
29
37
|
return cut(`${head}${list()}${ask}`, budget);
|
|
30
38
|
}
|
|
31
|
-
return
|
|
39
|
+
return NO_TASK;
|
|
32
40
|
}
|
|
33
41
|
/**
|
|
34
42
|
* A change of the task was completed (task-closing spec). The agent asks; the
|
|
@@ -42,7 +50,7 @@ export function closeProposalText(input) {
|
|
|
42
50
|
];
|
|
43
51
|
return cut(`estimetry: change ${input.change} of task ${input.task} was completed at ${when}` +
|
|
44
52
|
(plan.length === 0 ? '' : `; ${plan.join(', ')}`) +
|
|
45
|
-
`. If it was the last change of the task, ask the user whether to close it (
|
|
53
|
+
`. If it was the last change of the task, ask the user whether to close it (${CLOSE}); close only after they agree.`);
|
|
46
54
|
}
|
|
47
55
|
function duration(minutes) {
|
|
48
56
|
const whole = Math.round(minutes);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { InvalidValue } from '../../domain/shared/domain-error.js';
|
|
2
|
+
import { nameSkills } from '../contracts/skill-mention.js';
|
|
2
3
|
/**
|
|
3
4
|
* A hook of an AI tool's session: the call becomes activity of the session's
|
|
4
5
|
* task, then its kind decides what follows — the context of a session start or
|
|
@@ -29,7 +30,7 @@ export class ReceiveSessionHook {
|
|
|
29
30
|
throw new InvalidValue(`${adapter.id} ${event}: stdin is not JSON`); // its content is never repeated
|
|
30
31
|
}
|
|
31
32
|
const translation = adapter.translate(event, payload);
|
|
32
|
-
const located = this.locator.locate(call
|
|
33
|
+
const located = this.locator.locate(projectDirOf(adapter, call) ?? translation.cwd ?? call.cwd);
|
|
33
34
|
const resolved = this.sessionTask.resolve(translation.session, located, translation.kind, now);
|
|
34
35
|
if (resolved === undefined) {
|
|
35
36
|
return undefined; // not an estimetry project
|
|
@@ -37,17 +38,27 @@ export class ReceiveSessionHook {
|
|
|
37
38
|
this.recorder.record(adapter.id, translation, resolved, now);
|
|
38
39
|
switch (translation.kind) {
|
|
39
40
|
case 'session-start':
|
|
40
|
-
return adapter
|
|
41
|
+
return render(adapter, event, await this.start.text(translation.session, resolved, now));
|
|
41
42
|
case 'session-end':
|
|
42
|
-
await this.end.run(adapter
|
|
43
|
+
await this.end.run(adapter, translation.session, translation.transcript);
|
|
43
44
|
return undefined;
|
|
44
45
|
case 'prompt': {
|
|
45
46
|
const text = await this.prompt.text(translation.session, resolved, now);
|
|
46
|
-
return text === undefined ? undefined : adapter
|
|
47
|
+
return text === undefined ? undefined : render(adapter, event, text);
|
|
47
48
|
}
|
|
48
49
|
default:
|
|
49
50
|
return undefined;
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
53
|
}
|
|
54
|
+
/** The project root the tool names in its own environment variable; an empty one names none. */
|
|
55
|
+
function projectDirOf(adapter, call) {
|
|
56
|
+
const variable = adapter.projectDirVariable;
|
|
57
|
+
const value = variable === undefined ? undefined : call.environment?.(variable);
|
|
58
|
+
return value === '' ? undefined : value;
|
|
59
|
+
}
|
|
60
|
+
/** The context in the tool's format, with the skills named the way its agent calls them. */
|
|
61
|
+
function render(adapter, event, text) {
|
|
62
|
+
return adapter.renderContext(event, nameSkills(text, (id) => adapter.skillRef(id)));
|
|
63
|
+
}
|
|
53
64
|
//# sourceMappingURL=receive-session-hook.js.map
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { isInProgress } from '../../domain/task/task-status.js';
|
|
2
2
|
import { servedTasks } from '../ports/session-bindings.js';
|
|
3
|
-
/** The session end imports the session's log in the hook itself, within this time (claude-code-hooks spec). */
|
|
4
|
-
export const SESSION_END_IMPORT_BUDGET_MS = 5_000;
|
|
5
3
|
/**
|
|
6
|
-
* The log of an ended session goes into every task in progress it served
|
|
7
|
-
*
|
|
4
|
+
* The log of an ended session goes into every task in progress it served, in the hook itself, within the budget
|
|
5
|
+
* of the tool (it waits for the session end hook only so long). Past it the import gives up; the closing of the task
|
|
6
|
+
* catches up.
|
|
8
7
|
*/
|
|
9
8
|
export class SessionEndImport {
|
|
10
9
|
bindings;
|
|
@@ -17,7 +16,7 @@ export class SessionEndImport {
|
|
|
17
16
|
this.tasks = tasks;
|
|
18
17
|
this.logs = logs;
|
|
19
18
|
}
|
|
20
|
-
async run(
|
|
19
|
+
async run(tool, session, transcript) {
|
|
21
20
|
if (this.logs === undefined) {
|
|
22
21
|
return;
|
|
23
22
|
}
|
|
@@ -33,10 +32,10 @@ export class SessionEndImport {
|
|
|
33
32
|
const path = transcript ?? binding?.transcript;
|
|
34
33
|
(await this.logs()).execute({
|
|
35
34
|
session,
|
|
36
|
-
source,
|
|
35
|
+
source: tool.id,
|
|
37
36
|
...(path === undefined ? {} : { path }),
|
|
38
37
|
tasks,
|
|
39
|
-
budgetMs:
|
|
38
|
+
budgetMs: tool.sessionEndBudgetMs,
|
|
40
39
|
});
|
|
41
40
|
}
|
|
42
41
|
}
|
|
@@ -1,11 +1,24 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* The tools installed in the copy now. An install of the user outside the copy (`machineWide`) is there for every
|
|
3
|
+
* copy, so it counts only for a copy without a shared install: it must not make a team's copy install it for the team.
|
|
4
|
+
*/
|
|
2
5
|
export function installedTools(deps, root) {
|
|
3
|
-
|
|
6
|
+
const states = deps.registries.tools.all().map((tool) => ({ tool, state: tool.state(root, deps.files) }));
|
|
7
|
+
const sharedHere = states.some(({ state }) => state.installed && state.shared);
|
|
8
|
+
return states.filter(({ state }) => state.installed && !(state.machineWide === true && sharedHere)).map(({ tool }) => tool);
|
|
4
9
|
}
|
|
5
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* The tools already installed in the project, else the tools found on this machine, else every tool. An install of
|
|
12
|
+
* the user outside the copy alone does not make the copy's choice: then the tools found on the machine join it.
|
|
13
|
+
*/
|
|
6
14
|
export function defaultTools(deps, root) {
|
|
7
15
|
const installed = installedTools(deps, root);
|
|
8
|
-
|
|
16
|
+
if (installed.some((tool) => tool.state(root, deps.files).machineWide !== true)) {
|
|
17
|
+
return installed;
|
|
18
|
+
}
|
|
19
|
+
const all = deps.registries.tools.all();
|
|
20
|
+
const found = all.filter((tool) => tool.present(deps.files) || installed.includes(tool));
|
|
21
|
+
return found.length > 0 ? found : [...all];
|
|
9
22
|
}
|
|
10
23
|
/** Whether these tools have a shared install in the copy: then it stays shared. */
|
|
11
24
|
export function isSharedInstall(deps, root, tools) {
|
|
@@ -24,7 +24,9 @@ export class InitProject {
|
|
|
24
24
|
*/
|
|
25
25
|
execute(input) {
|
|
26
26
|
const root = this.workspace.currentRoot();
|
|
27
|
-
|
|
27
|
+
// A shared install puts the files into the team's repository: an install of the user's own does not go there by itself.
|
|
28
|
+
const defaults = defaultTools(this.deps, root).filter((tool) => input.shared !== true || tool.state(root, this.deps.files).machineWide !== true);
|
|
29
|
+
const tools = input.tools === undefined ? defaults : this.toolsById(input.tools);
|
|
28
30
|
const flow = this.flowById(input.flow ?? defaultFlow(this.deps, this.projectConfig, root));
|
|
29
31
|
const share = this.shareMode(input.share ?? this.deps.sharing.mode() ?? 'none');
|
|
30
32
|
const shared = input.shared ?? isSharedInstall(this.deps, root, tools);
|
|
@@ -53,6 +55,7 @@ export class InitProject {
|
|
|
53
55
|
trackCommits,
|
|
54
56
|
force: input.force ?? false,
|
|
55
57
|
...(input.excludePersonalFiles === undefined ? {} : { excludePersonalFiles: input.excludePersonalFiles }),
|
|
58
|
+
...(input.trustHooks === undefined ? {} : { trust: input.trustHooks }),
|
|
56
59
|
});
|
|
57
60
|
const project = this.projects.update(this.currentProject.register(registration).id, (registered) => {
|
|
58
61
|
const fingerprint = this.workspace.fingerprint();
|
|
@@ -17,7 +17,14 @@ export class InstallCopy {
|
|
|
17
17
|
plan(choices) {
|
|
18
18
|
const { root } = choices;
|
|
19
19
|
const { version, runner } = this.deps.installation;
|
|
20
|
-
const context = {
|
|
20
|
+
const context = {
|
|
21
|
+
projectRoot: root,
|
|
22
|
+
files: this.deps.files,
|
|
23
|
+
shared: choices.shared,
|
|
24
|
+
force: choices.force,
|
|
25
|
+
version,
|
|
26
|
+
...(choices.trust === undefined ? {} : { trust: choices.trust }),
|
|
27
|
+
};
|
|
21
28
|
const plan = mergePlans([
|
|
22
29
|
...choices.tools.map((tool) => tool.plan(runner === undefined ? context : { ...context, runner })),
|
|
23
30
|
this.deps.git.commitHook.plan(root, choices.trackCommits, runner),
|
|
@@ -14,7 +14,7 @@ export class ShowInitChoices {
|
|
|
14
14
|
const tools = defaultTools(this.deps, root);
|
|
15
15
|
return {
|
|
16
16
|
projectRoot: root,
|
|
17
|
-
tools: this.deps.registries.tools.all().map(({ id, title }) => ({ id, title })),
|
|
17
|
+
tools: this.deps.registries.tools.all().map(({ id, title, asksTrust }) => ({ id, title, asksTrust })),
|
|
18
18
|
flows: this.deps.registries.flows.all().map(({ id, title }) => ({ id, title })),
|
|
19
19
|
defaults: {
|
|
20
20
|
tools: tools.map((tool) => tool.id),
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** What the tools installed in the copy still need from the user for their hooks to run (trust them in Codex). */
|
|
2
|
+
export function toolNotices(deps, root) {
|
|
3
|
+
return deps.registries.tools.all().flatMap((tool) => {
|
|
4
|
+
const state = tool.state(root, deps.files);
|
|
5
|
+
return state.installed && state.notice !== undefined ? [state.notice] : [];
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=tool-notices.js.map
|
|
@@ -63,7 +63,8 @@ export class ImportSessionLogs {
|
|
|
63
63
|
from: offset,
|
|
64
64
|
turns,
|
|
65
65
|
agents,
|
|
66
|
-
cost: read.cost,
|
|
66
|
+
cost: read.cost ?? [],
|
|
67
|
+
costReported: read.cost !== undefined,
|
|
67
68
|
skipped: read.skipped,
|
|
68
69
|
});
|
|
69
70
|
this.deps.state.write(request.session, task.id, { fingerprint: read.fingerprint, next: read.next });
|
|
@@ -118,6 +119,8 @@ export class ImportSessionLogs {
|
|
|
118
119
|
turns: part.turns,
|
|
119
120
|
agents: part.agents,
|
|
120
121
|
cost: i === 0 ? content.cost : [],
|
|
122
|
+
// Written only when false: records of a tool with a cost stay as before, and old readers read them.
|
|
123
|
+
...(content.costReported === false ? { costReported: false } : {}),
|
|
121
124
|
skipped: i === 0 ? content.skipped : 0,
|
|
122
125
|
};
|
|
123
126
|
this.deps.journal.appendRecord(journalEntry('log.session', data, { ...this.deps.meta.at(at), project: task.project, task: task.id }));
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { applicableCoefficient } from '../../domain/calibration/applicable-coefficient.js';
|
|
2
|
-
import {
|
|
2
|
+
import { authorCards, calibrate, } from '../../domain/calibration/calibration.js';
|
|
3
3
|
import { otherAuthors } from '../../domain/calibration/other-authors.js';
|
|
4
4
|
import { estimateQuery } from './estimate-query.js';
|
|
5
|
-
|
|
5
|
+
/** 2: the coefficient with its pessimistic value and weight, the weight of a slice instead of `applicable` (dynamic-calibration). */
|
|
6
|
+
export const CALIBRATION_VIEW_SCHEMA_VERSION = 2;
|
|
6
7
|
const NO_TASKS = {
|
|
7
8
|
n: 0,
|
|
8
9
|
median: null,
|
|
9
10
|
mean: null,
|
|
10
|
-
|
|
11
|
+
weight: 0,
|
|
11
12
|
excluded: {},
|
|
12
13
|
uncertain: 0,
|
|
13
14
|
backgroundAgents: 0,
|
|
@@ -35,10 +36,10 @@ export class ShowCalibration {
|
|
|
35
36
|
const { cards, skipped } = this.cards.allCards();
|
|
36
37
|
const author = this.authors.current();
|
|
37
38
|
const aliases = this.authors.toCurrent();
|
|
38
|
-
const
|
|
39
|
+
const policy = this.settings.policy();
|
|
39
40
|
// Only the author's section is shown: other authors' cards are not computed at all.
|
|
40
|
-
const own =
|
|
41
|
-
const mine = calibrate(own, {
|
|
41
|
+
const own = authorCards(cards, author, aliases);
|
|
42
|
+
const mine = calibrate(own, { policy }).authors[author];
|
|
42
43
|
const revise = input.revise === true;
|
|
43
44
|
const type = query.type?.value;
|
|
44
45
|
const pick = (slices, empty) => ({
|
|
@@ -50,8 +51,11 @@ export class ShowCalibration {
|
|
|
50
51
|
schemaVersion: CALIBRATION_VIEW_SCHEMA_VERSION,
|
|
51
52
|
query: { type: type ?? null, stack: [...query.stack.values], revise },
|
|
52
53
|
// A calibration from an incomplete set of cards could give a wrong coefficient.
|
|
53
|
-
coefficient: skipped.length > 0
|
|
54
|
-
|
|
54
|
+
coefficient: skipped.length > 0
|
|
55
|
+
? null
|
|
56
|
+
: applicableCoefficient(cards, { author, aliases, estimate: query, revise }, policy),
|
|
57
|
+
minTasks: policy.minTasks,
|
|
58
|
+
shrink: policy.shrink,
|
|
55
59
|
tasks: mine?.tasks ?? 0,
|
|
56
60
|
ratio: pick(mine?.ratio, NO_TASKS),
|
|
57
61
|
revised: pick(mine?.revised, { ...NO_TASKS, countedAtShare: null }),
|
|
@@ -53,7 +53,7 @@ export class TaskCards {
|
|
|
53
53
|
}
|
|
54
54
|
const cards = stored.map((card) => card.schema === 'current' ? card.card : card.schema === 'newer' ? undefined : this.upgrade(card.card));
|
|
55
55
|
// A card that cannot be read even by its fields is left out, as a broken file is.
|
|
56
|
-
return calibrate(cards.filter((card) => card !== undefined), {
|
|
56
|
+
return calibrate(cards.filter((card) => card !== undefined), { policy: this.settings.policy(), aliases: this.aliases.toCurrent() });
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
/**
|