ultimate-pi 0.19.0 → 0.20.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/.agents/skills/web-retrieval/SKILL.md +163 -0
- package/.agents/skills/wiki-autoresearch/SKILL.md +6 -6
- package/.pi/SYSTEM.md +30 -12
- package/.pi/agents/harness/planning/implementation-researcher.md +1 -1
- package/.pi/agents/harness/planning/stack-researcher.md +5 -1
- package/.pi/agents/harness/running/executor.md +42 -1
- package/.pi/agents/harness/web-retrieval/web-answerer.md +35 -0
- package/.pi/agents/harness/web-retrieval/web-criteria-verifier.md +28 -0
- package/.pi/agents/harness/web-retrieval/web-gap-analyzer.md +31 -0
- package/.pi/agents/harness/web-retrieval/web-query-expander-fast.md +34 -0
- package/.pi/agents/harness/web-retrieval/web-query-expander.md +60 -0
- package/.pi/agents/harness/web-retrieval/web-summarizer.md +18 -0
- package/.pi/extensions/harness-anchored-edit.ts +141 -0
- package/.pi/extensions/harness-web-guard.ts +2 -1
- package/.pi/extensions/harness-web-tools.ts +689 -51
- package/.pi/harness/agents.manifest.json +30 -6
- package/.pi/harness/agents.policy.yaml +37 -4
- package/.pi/harness/docs/adrs/0050-agentic-web-retrieval-stack.md +46 -0
- package/.pi/harness/docs/adrs/0051-hash-anchored-executor-edits.md +41 -0
- package/.pi/harness/docs/adrs/README.md +2 -0
- package/.pi/harness/docs/harness-web-search.md +97 -0
- package/.pi/harness/docs/practice-map.md +11 -0
- package/.pi/harness/env.harness.template +9 -1
- package/.pi/harness/examples/web-heuristic-angles.project.yaml +22 -0
- package/.pi/harness/web-heuristic-angles.json +278 -0
- package/.pi/harness/web-heuristic-angles.yaml +182 -0
- package/.pi/lib/agents-policy.d.mts +4 -0
- package/.pi/lib/agents-policy.mjs +49 -1
- package/.pi/lib/agents-policy.ts +1 -0
- package/.pi/lib/harness-anchored-edit/.hash_anchors +1721 -0
- package/.pi/lib/harness-anchored-edit/anchor-state.ts +320 -0
- package/.pi/lib/harness-anchored-edit/apply-anchored-edits.ts +161 -0
- package/.pi/lib/harness-anchored-edit/edit-executor.ts +146 -0
- package/.pi/lib/harness-anchored-edit/index.ts +9 -0
- package/.pi/lib/harness-anchored-edit/line-protocol.ts +38 -0
- package/.pi/lib/harness-anchored-edit/settings.ts +1 -0
- package/.pi/lib/harness-anchored-edit/task-id.ts +8 -0
- package/.pi/lib/harness-anchored-edit/types.ts +19 -0
- package/.pi/lib/harness-lens/clients/anchored-edit-autopatch.ts +158 -0
- package/.pi/lib/harness-lens/index.ts +24 -7
- package/.pi/lib/harness-subagent-auth.ts +39 -9
- package/.pi/lib/harness-subagents-bridge.ts +24 -1
- package/.pi/lib/harness-web/artifacts.ts +200 -0
- package/.pi/lib/harness-web/cache.ts +369 -0
- package/.pi/lib/harness-web/run-cli.ts +42 -2
- package/.pi/prompts/harness-plan.md +1 -0
- package/.pi/prompts/harness-setup.md +3 -1
- package/.pi/prompts/harness-steer.md +1 -1
- package/.pi/scripts/gen-web-heuristic-angles-json.mjs +24 -0
- package/.pi/scripts/harness-anchored-edit-smoke.mjs +45 -0
- package/.pi/scripts/harness-cli-verify.sh +5 -0
- package/.pi/scripts/harness-verify.mjs +145 -0
- package/.pi/scripts/harness-web-policy-guard.mjs +1 -1
- package/.pi/scripts/harness-web.py +218 -15
- package/.pi/scripts/harness_web/deep_search.py +55 -0
- package/.pi/scripts/harness_web/evidence_bundle.py +47 -0
- package/.pi/scripts/harness_web/find_similar.py +88 -0
- package/.pi/scripts/harness_web/heuristic_angles_shipped.py +85 -0
- package/.pi/scripts/harness_web/heuristic_config.py +251 -0
- package/.pi/scripts/harness_web/highlights.py +47 -0
- package/.pi/scripts/harness_web/multi_search.py +59 -0
- package/.pi/scripts/harness_web/output.py +24 -0
- package/.pi/scripts/harness_web/query_angles.py +116 -0
- package/.pi/scripts/harness_web/rank.py +163 -0
- package/.pi/scripts/harness_web/scrape.py +30 -0
- package/.pi/scripts/run-tests.mjs +64 -0
- package/.pi/scripts/tests/test_harness_web_heuristic_config.py +132 -0
- package/.pi/scripts/tests/test_harness_web_query_angles.py +45 -0
- package/.pi/scripts/tests/test_harness_web_rank.py +56 -0
- package/AGENTS.md +2 -2
- package/CHANGELOG.md +12 -0
- package/THIRD_PARTY_NOTICES.md +7 -0
- package/package.json +7 -4
- package/vendor/pi-subagents/src/agents.ts +5 -0
- package/vendor/pi-subagents/src/subagents.ts +22 -3
- package/.agents/skills/scrapling-web/SKILL.md +0 -98
- package/.pi/extensions/00-posthog-network-bootstrap.ts +0 -11
- package/.pi/scripts/harness_web/__pycache__/__init__.cpython-314.pyc +0 -0
- package/.pi/scripts/harness_web/__pycache__/config.cpython-314.pyc +0 -0
- package/.pi/scripts/harness_web/__pycache__/output.cpython-314.pyc +0 -0
- package/.pi/scripts/harness_web/__pycache__/scrape.cpython-314.pyc +0 -0
- package/.pi/scripts/harness_web/__pycache__/search.cpython-314.pyc +0 -0
- package/.pi/scripts/harness_web/__pycache__/search_ddg.cpython-314.pyc +0 -0
- package/.pi/scripts/harness_web/__pycache__/search_searxng.cpython-314.pyc +0 -0
- package/.pi/scripts/release.sh +0 -338
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema_version": "1.0.0",
|
|
3
3
|
"package": "ultimate-pi",
|
|
4
|
-
"package_version": "0.
|
|
5
|
-
"generated_at": "2026-05-
|
|
6
|
-
"policy_sha256": "
|
|
4
|
+
"package_version": "0.19.1",
|
|
5
|
+
"generated_at": "2026-05-26T07:37:49.163Z",
|
|
6
|
+
"policy_sha256": "5a1e71f380df7dde8f6d1f33b366da8bba191689476a6440b3bcdbd776dc617a",
|
|
7
7
|
"agents": {
|
|
8
8
|
"pi-pi/agent-expert": {
|
|
9
9
|
"path": ".pi/agents/pi-pi/agent-expert.md",
|
|
@@ -61,9 +61,33 @@
|
|
|
61
61
|
"path": ".pi/agents/harness/trace-librarian.md",
|
|
62
62
|
"sha256": "083ce6a3508bab2f5bc57e8ab13256c55fff58e0eac95cb6542bdd47fd02de65"
|
|
63
63
|
},
|
|
64
|
+
"harness/web-retrieval/web-answerer": {
|
|
65
|
+
"path": ".pi/agents/harness/web-retrieval/web-answerer.md",
|
|
66
|
+
"sha256": "c9876fb34aa6704c1a8eb9f4db4ada71c5a762790db411a1b01104a81745215d"
|
|
67
|
+
},
|
|
68
|
+
"harness/web-retrieval/web-criteria-verifier": {
|
|
69
|
+
"path": ".pi/agents/harness/web-retrieval/web-criteria-verifier.md",
|
|
70
|
+
"sha256": "bb0a9b514964f6f64ef539c1d766ff28ee23c4d9199dc4cae0f41b0fe7fdc860"
|
|
71
|
+
},
|
|
72
|
+
"harness/web-retrieval/web-gap-analyzer": {
|
|
73
|
+
"path": ".pi/agents/harness/web-retrieval/web-gap-analyzer.md",
|
|
74
|
+
"sha256": "f4487993f561c7141b22c79f9afff52986466c5b3af4f3ffb0e75e30a6da025a"
|
|
75
|
+
},
|
|
76
|
+
"harness/web-retrieval/web-query-expander-fast": {
|
|
77
|
+
"path": ".pi/agents/harness/web-retrieval/web-query-expander-fast.md",
|
|
78
|
+
"sha256": "161c5ce82e013af7aaec219b4ccb6b8c557bf5768f8e0c85b1d8f243056b015c"
|
|
79
|
+
},
|
|
80
|
+
"harness/web-retrieval/web-query-expander": {
|
|
81
|
+
"path": ".pi/agents/harness/web-retrieval/web-query-expander.md",
|
|
82
|
+
"sha256": "b522532e15759c747ff92198aa6db2624accd0998a4e0af4cb086617734f5ce7"
|
|
83
|
+
},
|
|
84
|
+
"harness/web-retrieval/web-summarizer": {
|
|
85
|
+
"path": ".pi/agents/harness/web-retrieval/web-summarizer.md",
|
|
86
|
+
"sha256": "0c25f814ded534f6d190cc50ff141306d26dba98eff2ad6d51b56e42c143861d"
|
|
87
|
+
},
|
|
64
88
|
"harness/running/executor": {
|
|
65
89
|
"path": ".pi/agents/harness/running/executor.md",
|
|
66
|
-
"sha256": "
|
|
90
|
+
"sha256": "1b8aa6e05ffacc8550569465d47cc8525902b53431e36b1c0f973ca633eab450"
|
|
67
91
|
},
|
|
68
92
|
"harness/reviewing/adversary": {
|
|
69
93
|
"path": ".pi/agents/harness/reviewing/adversary.md",
|
|
@@ -95,7 +119,7 @@
|
|
|
95
119
|
},
|
|
96
120
|
"harness/planning/implementation-researcher": {
|
|
97
121
|
"path": ".pi/agents/harness/planning/implementation-researcher.md",
|
|
98
|
-
"sha256": "
|
|
122
|
+
"sha256": "4559fc93ccf867ee199821a781cfd1b4a863e1f35ea8520d15ff389e61e17fd2"
|
|
99
123
|
},
|
|
100
124
|
"harness/planning/plan-adversary": {
|
|
101
125
|
"path": ".pi/agents/harness/planning/plan-adversary.md",
|
|
@@ -123,7 +147,7 @@
|
|
|
123
147
|
},
|
|
124
148
|
"harness/planning/stack-researcher": {
|
|
125
149
|
"path": ".pi/agents/harness/planning/stack-researcher.md",
|
|
126
|
-
"sha256": "
|
|
150
|
+
"sha256": "0f19febc96bc65fd22b2d3f1c3bbed02e021f7c8129a7bb21423ea29d8429d67"
|
|
127
151
|
}
|
|
128
152
|
}
|
|
129
153
|
}
|
|
@@ -22,10 +22,10 @@ kinds:
|
|
|
22
22
|
- write
|
|
23
23
|
- edit
|
|
24
24
|
- bash
|
|
25
|
-
- grep
|
|
26
|
-
- find
|
|
27
25
|
- ls
|
|
28
|
-
extensions
|
|
26
|
+
# Subprocess bundle (governance + anchored read/edit + lens) — not full .pi/extensions (parent phase hooks).
|
|
27
|
+
extension_bundle: executor
|
|
28
|
+
extensions: false
|
|
29
29
|
read_only: false
|
|
30
30
|
evaluator:
|
|
31
31
|
tools:
|
|
@@ -141,7 +141,6 @@ agents:
|
|
|
141
141
|
kind: executor
|
|
142
142
|
tools_add:
|
|
143
143
|
- submit_executor_handoff
|
|
144
|
-
extensions: true
|
|
145
144
|
max_turns: 20
|
|
146
145
|
thinking: medium
|
|
147
146
|
submit_tool: submit_executor_handoff
|
|
@@ -203,12 +202,44 @@ agents:
|
|
|
203
202
|
max_turns: 14
|
|
204
203
|
thinking: medium
|
|
205
204
|
submit_tool: submit_hypothesis_brief
|
|
205
|
+
harness/web-retrieval/web-query-expander:
|
|
206
|
+
kind: other
|
|
207
|
+
extensions: false
|
|
208
|
+
max_turns: 8
|
|
209
|
+
thinking: low
|
|
210
|
+
harness/web-retrieval/web-query-expander-fast:
|
|
211
|
+
kind: other
|
|
212
|
+
extensions: false
|
|
213
|
+
max_turns: 5
|
|
214
|
+
thinking: off
|
|
215
|
+
harness/web-retrieval/web-gap-analyzer:
|
|
216
|
+
kind: other
|
|
217
|
+
extensions: false
|
|
218
|
+
max_turns: 8
|
|
219
|
+
thinking: low
|
|
220
|
+
harness/web-retrieval/web-answerer:
|
|
221
|
+
kind: other
|
|
222
|
+
extensions: false
|
|
223
|
+
max_turns: 12
|
|
224
|
+
thinking: medium
|
|
225
|
+
harness/web-retrieval/web-summarizer:
|
|
226
|
+
kind: other
|
|
227
|
+
extensions: false
|
|
228
|
+
max_turns: 6
|
|
229
|
+
thinking: low
|
|
230
|
+
harness/web-retrieval/web-criteria-verifier:
|
|
231
|
+
kind: other
|
|
232
|
+
extensions: false
|
|
233
|
+
max_turns: 14
|
|
234
|
+
thinking: medium
|
|
206
235
|
harness/planning/implementation-researcher:
|
|
207
236
|
kind: planner
|
|
208
237
|
tools_add:
|
|
209
238
|
- bash
|
|
210
239
|
- web_search
|
|
211
240
|
- web_fetch
|
|
241
|
+
- web_find_similar
|
|
242
|
+
- web_contents
|
|
212
243
|
- submit_implementation_research
|
|
213
244
|
extensions: false
|
|
214
245
|
max_turns: 14
|
|
@@ -268,6 +299,8 @@ agents:
|
|
|
268
299
|
- bash
|
|
269
300
|
- web_search
|
|
270
301
|
- web_fetch
|
|
302
|
+
- web_find_similar
|
|
303
|
+
- web_contents
|
|
271
304
|
- submit_stack_brief
|
|
272
305
|
extensions: false
|
|
273
306
|
max_turns: 16
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# ADR 0050: Agentic Web Retrieval Stack (WRS)
|
|
2
|
+
|
|
3
|
+
- **Status:** Accepted
|
|
4
|
+
- **Date:** 2026-05-26
|
|
5
|
+
- **Deciders:** ultimate-pi harness team
|
|
6
|
+
|
|
7
|
+
## Context
|
|
8
|
+
|
|
9
|
+
Harness agents treated `web_search` as single-query SERP, yielding poor recall on ambiguous research questions. Exa-style outcomes (multi-angle discovery, fusion, evidence, synthesis) are needed without Exa API, MCP, or a neural index at Exa scale.
|
|
10
|
+
|
|
11
|
+
## Decision
|
|
12
|
+
|
|
13
|
+
Introduce **WRS** as the default non-API web layer:
|
|
14
|
+
|
|
15
|
+
1. **Tiers** on `web_search`: `instant`, `standard`, **`deep`** (default for research), `research`.
|
|
16
|
+
2. **Planning subagents** under `.pi/agents/harness/web-retrieval/` — e.g. `harness/web-retrieval/web-query-expander` produces `.web/angles.yaml`; parent runs `web_search(tier=deep, anglesFile=…)`.
|
|
17
|
+
3. **Python fusion**: parallel metasearch per angle (DDG HTML or SearXNG) + RRF (`k=60`) + optional lexical rerank.
|
|
18
|
+
4. **Extension tools**: `web_find_similar`, `web_contents`, `web_fetch` highlights.
|
|
19
|
+
5. **Synthesis subagents** (same directory): `web-answerer`, `web-gap-analyzer`, `web-criteria-verifier`, `web-summarizer`, `web-query-expander-fast`.
|
|
20
|
+
6. **web-retrieval** skill as canonical workflow; **SYSTEM.md** mandates deep default and anti-patterns.
|
|
21
|
+
7. **context7** remains sole path for library API documentation.
|
|
22
|
+
8. **User model routing:** env vars `HARNESS_WEB_FAST_MODEL`, `HARNESS_WEB_EXPANDER_MODEL`, `HARNESS_WEB_QUALITY_MODEL` (any Pi `provider/model-id`); else parent session or agent `model:` override.
|
|
23
|
+
9. **Pooled local cache:** `.web/cache/` keyed by search/fetch context with TTL (`HARNESS_WEB_CACHE_TTL_SEC`); workspace aliases under `.web/`. Optional `HARNESS_WEB_ISOLATE=1` for per-run/session dirs.
|
|
24
|
+
|
|
25
|
+
Subagents are **not** spawned inside tool `execute()`; parent orchestrates expander → deep → fetch.
|
|
26
|
+
|
|
27
|
+
## Consequences
|
|
28
|
+
|
|
29
|
+
### Positive
|
|
30
|
+
|
|
31
|
+
- Higher recall on landscape / prior-art questions without paid search APIs.
|
|
32
|
+
- Path-first `.web/` artifacts for harness-plan debate.
|
|
33
|
+
- Contract checks in `harness-verify.mjs` keep guidance aligned with tools.
|
|
34
|
+
|
|
35
|
+
### Negative / trade-offs
|
|
36
|
+
|
|
37
|
+
- Deep search is slower (N parallel SERP calls).
|
|
38
|
+
- Heuristic `--expand-heuristic` is weaker than expander subagent (templates from mergeable `.pi/harness/web-heuristic-angles.yaml`; projects extend via same path under their repo).
|
|
39
|
+
- No embedding index; O3 precision is approximate vs Exa neural search.
|
|
40
|
+
|
|
41
|
+
## References
|
|
42
|
+
|
|
43
|
+
- `.pi/harness/docs/harness-web-search.md`
|
|
44
|
+
- `.agents/skills/web-retrieval/SKILL.md`
|
|
45
|
+
- `.pi/extensions/harness-web-tools.ts`
|
|
46
|
+
- Plan: `.cursor/plans/exa-style_harness_web_fd231183.plan.md`
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# ADR 0051: Hash-anchored read/edit (Dirac-inspired)
|
|
2
|
+
|
|
3
|
+
- **Status:** Accepted
|
|
4
|
+
- **Date:** 2026-05-26
|
|
5
|
+
|
|
6
|
+
## Context
|
|
7
|
+
|
|
8
|
+
Harness executor sessions used Pi’s `oldText`/`newText` `edit` tool. Line-number and fuzzy-match edits fail when files drift between read and edit, causing retries and token waste. [Dirac](https://github.com/dirac-run/dirac) demonstrates stable **hash-anchored** line targeting with Myers-diff anchor reconciliation; user evaluation chose adoption for the harness.
|
|
9
|
+
|
|
10
|
+
We already own adjacent concerns: **harness-lens** (LSP, indentation autopatch, format), **shell `sg`** (structural search per ADR 0045), **Sentrux** (architecture gate). We must not duplicate those layers.
|
|
11
|
+
|
|
12
|
+
## Decision
|
|
13
|
+
|
|
14
|
+
1. **First-class tools** — [`.pi/extensions/harness-anchored-edit.ts`](../../../extensions/harness-anchored-edit.ts) registers harness `read` and `edit`. No env toggle.
|
|
15
|
+
2. **Vendored core** in [`.pi/lib/harness-anchored-edit/`](../../../lib/harness-anchored-edit/) (Apache-2.0 subset from Dirac: anchor state, line protocol, resolve/apply).
|
|
16
|
+
3. **`read`** output: `AnchorWord§line` per line; anchor state scoped per session/task id.
|
|
17
|
+
4. **`edit`** input: `anchor`, optional `end_anchor` (defaults to `anchor` for single-line replace), `edit_type`, `text`; batch `edits[]` per file.
|
|
18
|
+
5. **Native apply** — `applyAnchoredEditsToFile` writes disk directly (Pi `edit-diff` for unified diff in tool result). No `resolve-to-pi-edit` / no delegation to `createEditTool`.
|
|
19
|
+
6. **Lens** — `tool_call` autopatch corrects indentation on anchored `edits[].text` only ([`anchored-edit-autopatch.ts`](../../../lib/harness-lens/clients/anchored-edit-autopatch.ts)). Legacy `oldText` autopatch remains for non-harness agents that still use Pi edit.
|
|
20
|
+
7. **Executor subprocess bundle** — `kinds.executor.extension_bundle: executor` loads `--no-extensions` plus curated `-e` modules only: `subagent-governance.ts`, `harness-anchored-edit.ts`, `harness-lens.ts` ([`resolveExtensionBundlePaths`](../../../lib/agents-policy.mjs)). Avoids loading the full `.pi/extensions` tree (parent orchestration, run-context phase hooks) while still providing hash-anchored read/edit and lens format-on-result.
|
|
21
|
+
8. **Builtin suppression** — Executor subprocesses use `--no-builtin-tools` + tool allowlist ([`agents.policy.yaml`](../agents.policy.yaml) via `noBuiltinTools` when `extension_bundle` or full extensions apply).
|
|
22
|
+
9. **Executor policy** (prompt + practice-map): batching discipline, post-edit verification before `submit_executor_handoff`, structural refactor via `sg -p` → anchored edit — **no** `replace_symbol` Pi tools.
|
|
23
|
+
10. **Remove** `grep`/`find` from executor tool policy; use `bash` + `sg` for code search.
|
|
24
|
+
|
|
25
|
+
## Consequences
|
|
26
|
+
|
|
27
|
+
### Positive
|
|
28
|
+
|
|
29
|
+
- More stable edits across multi-step executor and steer repair loops.
|
|
30
|
+
- Single anchored edit surface; no Pi text-match shim on the hot path.
|
|
31
|
+
|
|
32
|
+
### Negative
|
|
33
|
+
|
|
34
|
+
- Models must learn anchor `§` protocol.
|
|
35
|
+
- Vendored Dirac code must be kept in sync for security fixes (small surface).
|
|
36
|
+
|
|
37
|
+
## References
|
|
38
|
+
|
|
39
|
+
- [practice-map.md](../practice-map.md) — Executor edit discipline
|
|
40
|
+
- [ADR 0045](0045-harness-lens-minimal-contract.md) — lens vs sg vs Sentrux
|
|
41
|
+
- [ADR 0044](0044-harness-steer-loop.md) — repair mode uses same edit rules
|
|
@@ -36,6 +36,8 @@ Team-shared ADRs for the ultimate-pi harness live under `.pi/harness/docs/adrs/`
|
|
|
36
36
|
| [0047](0047-agt-layered-security.md) | AGT layered security (rings, prompt defense, CI) | Accepted |
|
|
37
37
|
| [0048](0048-tool-call-hook-order.md) | tool_call hook interaction matrix | Accepted |
|
|
38
38
|
| [0049](0049-agents-policy-manifest.md) | agents.policy.yaml SSOT + native discovery | Accepted |
|
|
39
|
+
| [0050](0050-agentic-web-retrieval-stack.md) | Agentic Web Retrieval Stack (WRS) | Accepted |
|
|
40
|
+
| [0051](0051-hash-anchored-executor-edits.md) | Hash-anchored read/edit (Dirac-inspired) | Accepted |
|
|
39
41
|
|
|
40
42
|
## Practice map
|
|
41
43
|
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Harness Web Retrieval Stack (WRS)
|
|
2
|
+
|
|
3
|
+
Internal reference for multi-angle search, fusion, and agent workflows. User-facing procedures: **web-retrieval** skill (install + env).
|
|
4
|
+
|
|
5
|
+
## Outcomes (Exa analog)
|
|
6
|
+
|
|
7
|
+
| Outcome | Primitive |
|
|
8
|
+
|---------|-----------|
|
|
9
|
+
| Discovery / recall | `search-deep` + RRF |
|
|
10
|
+
| Precision | Multi-angle + optional `HARNESS_WEB_RERANK=lexical` |
|
|
11
|
+
| Evidence / highlights | `web_fetch(highlights)` |
|
|
12
|
+
| Similar pages | `find-similar` CLI / `web_find_similar` |
|
|
13
|
+
| Synthesis | `evidence-bundle` + `web-answerer` |
|
|
14
|
+
|
|
15
|
+
## CLI
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
python3 .pi/scripts/harness-web.py search-deep "query" \
|
|
19
|
+
--angles-file .web/angles.yaml -o .web/search-deep.json
|
|
20
|
+
python3 .pi/scripts/harness-web.py search-deep "query" --expand-heuristic -o .web/search-deep.json
|
|
21
|
+
python3 .pi/scripts/harness-web.py find-similar "https://example.com" -o .web/search-deep.json
|
|
22
|
+
python3 .pi/scripts/harness-web.py contents-batch --from-search .web/search-deep.json -o .web/contents/
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Python modules
|
|
26
|
+
|
|
27
|
+
- `harness_web/query_angles.py` — parse expander YAML
|
|
28
|
+
- `harness_web/multi_search.py` — parallel per-angle SERP
|
|
29
|
+
- `harness_web/rank.py` — normalize URL, RRF, lexical rerank
|
|
30
|
+
- `harness_web/deep_search.py` — orchestration
|
|
31
|
+
- `harness_web/highlights.py` — excerpt scoring
|
|
32
|
+
- `harness_web/evidence_bundle.py` — merge for answerer
|
|
33
|
+
|
|
34
|
+
## Artifacts
|
|
35
|
+
|
|
36
|
+
**Cache** (pooled): `.web/cache/<kind>/<cacheKey>/` with `meta.json` (search context, `createdAt`, `expiresAt`, `hitCount`).
|
|
37
|
+
|
|
38
|
+
**Workspace** (default `.web/`): tool aliases agents read. `web_search` / `web_fetch` set `cacheHit`, `cacheKey`, `cachePath` in details.
|
|
39
|
+
|
|
40
|
+
| Env / param | Effect |
|
|
41
|
+
|-------------|--------|
|
|
42
|
+
| `HARNESS_WEB_CACHE_TTL_SEC` | Default TTL (86400) |
|
|
43
|
+
| `HARNESS_WEB_CACHE=0` | Disable cache |
|
|
44
|
+
| `refreshCache: true` | Bypass cache |
|
|
45
|
+
| `cacheMaxAge` | Max reuse age (seconds) |
|
|
46
|
+
| `HARNESS_WEB_ISOLATE=1` | Per-run/session dirs (legacy) |
|
|
47
|
+
|
|
48
|
+
| File | Content |
|
|
49
|
+
|------|---------|
|
|
50
|
+
| `angles.yaml` | Expander output |
|
|
51
|
+
| `search-deep.json` | Fused SERP + scores + `angle_ids` |
|
|
52
|
+
| `evidence-bundle.json` | URLs + snippets + highlights |
|
|
53
|
+
| `answer.md` | Cited synthesis |
|
|
54
|
+
|
|
55
|
+
## Subagents (`.pi/agents/harness/web-retrieval/`)
|
|
56
|
+
|
|
57
|
+
| Spawn id | Role |
|
|
58
|
+
|----------|------|
|
|
59
|
+
| `harness/web-retrieval/web-query-expander` | Angles YAML (default research) |
|
|
60
|
+
| `harness/web-retrieval/web-query-expander-fast` | 2–3 angles (latency) |
|
|
61
|
+
| `harness/web-retrieval/web-gap-analyzer` | Follow-up angles |
|
|
62
|
+
| `harness/web-retrieval/web-answerer` | Cited answer |
|
|
63
|
+
| `harness/web-retrieval/web-summarizer` | Single-page digest |
|
|
64
|
+
| `harness/web-retrieval/web-criteria-verifier` | Criteria scoring |
|
|
65
|
+
|
|
66
|
+
## Heuristic angles config (user-extensible)
|
|
67
|
+
|
|
68
|
+
Emergency templates for `expandHeuristic:true` / `--expand-heuristic` load from YAML:
|
|
69
|
+
|
|
70
|
+
| File | Role |
|
|
71
|
+
|------|------|
|
|
72
|
+
| `<package>/.pi/harness/web-heuristic-angles.yaml` | Built-in defaults (code → github, stackoverflow, …) |
|
|
73
|
+
| `<project>/.pi/harness/web-heuristic-angles.yaml` | **Your** extensions (merged on top) |
|
|
74
|
+
|
|
75
|
+
Copy [examples/web-heuristic-angles.project.yaml](../examples/web-heuristic-angles.project.yaml) into an external project’s `.pi/harness/` to add sites per category or define new categories (use `category` on `web_search`).
|
|
76
|
+
|
|
77
|
+
Query templates use `{query}` as the user search string. Same `id` in a category replaces the package angle.
|
|
78
|
+
|
|
79
|
+
Optional: `HARNESS_WEB_HEURISTIC_ANGLES_FILE=/path/to/custom.yaml` (merged last).
|
|
80
|
+
|
|
81
|
+
## Environment
|
|
82
|
+
|
|
83
|
+
| Variable | Default |
|
|
84
|
+
|----------|---------|
|
|
85
|
+
| `HARNESS_WEB_SEARCH_ENGINE` | `ddg_html` |
|
|
86
|
+
| `HARNESS_WEB_DEEP_CONCURRENCY` | `4` |
|
|
87
|
+
| `HARNESS_WEB_RERANK` | `off` |
|
|
88
|
+
| `HARNESS_WEB_FAST_MODEL` | expander-fast, summarizer, gap-analyzer |
|
|
89
|
+
| `HARNESS_WEB_EXPANDER_MODEL` | full query expander |
|
|
90
|
+
| `HARNESS_WEB_QUALITY_MODEL` | answerer, criteria-verifier |
|
|
91
|
+
| `HARNESS_WEB_HEURISTIC_ANGLES_FILE` | Extra heuristic angles YAML (merged last) |
|
|
92
|
+
| `HARNESS_PROJECT_ROOT` | Project root for `.pi/harness/web-heuristic-angles.yaml` |
|
|
93
|
+
| `HARNESS_PKG_ROOT` | Package root for default heuristic YAML |
|
|
94
|
+
|
|
95
|
+
Values use Pi `provider/model-id` format (any provider your install supports). Unset → subagent inherits parent session model. See **web-retrieval** skill.
|
|
96
|
+
|
|
97
|
+
ADR: [0050-web-retrieval-retrieval-stack.md](adrs/0050-web-retrieval-retrieval-stack.md)
|
|
@@ -75,6 +75,17 @@ See also: [ADRs](adrs/README.md), [ADR 0040](adrs/0040-practice-grounded-orchest
|
|
|
75
75
|
| Handoff | Generator–evaluator | `submit_executor_handoff` | Executor |
|
|
76
76
|
| Next | Always verify | **`/harness-review`** (not replan on blocked) | Parent routing |
|
|
77
77
|
|
|
78
|
+
|
|
79
|
+
### Executor edit discipline (ADR 0051)
|
|
80
|
+
|
|
81
|
+
| Practice | Agent rule |
|
|
82
|
+
|----------|------------|
|
|
83
|
+
| Hash-anchored targeting | `read` → `Anchor§line`; `edit` uses anchors (default harness tools) |
|
|
84
|
+
| Batching | All edits per file in one `edit`; independent files same turn when safe |
|
|
85
|
+
| Pre-handoff verify | Run `acceptance_checks`; clear lens blockers; then `submit_executor_handoff` |
|
|
86
|
+
| Structural refactor | `sg -p` locate → read slice → anchored edit — no `replace_symbol` tools |
|
|
87
|
+
| Code search | `sg` / `ccc` only — not `grep`/`find` on executor |
|
|
88
|
+
|
|
78
89
|
## `/harness-review` — Monitoring and Controlling
|
|
79
90
|
|
|
80
91
|
| Phase | Practice | Agent translation | Actor |
|
|
@@ -13,6 +13,15 @@ HARNESS_WEB_SEARCH_ENGINE=ddg_html
|
|
|
13
13
|
# HARNESS_WEB_PROXY=
|
|
14
14
|
# HARNESS_WEB_RATE_LIMIT_MS=2000
|
|
15
15
|
# HARNESS_WEB_TIMEOUT_MS=30000
|
|
16
|
+
# Heuristic angles (--expand-heuristic): edit <project>/.pi/harness/web-heuristic-angles.yaml
|
|
17
|
+
# Optional override path (merged after package + project):
|
|
18
|
+
# HARNESS_WEB_HEURISTIC_ANGLES_FILE=
|
|
19
|
+
# Pooled WRS cache (Firecrawl-style freshness); workspace aliases under .web/
|
|
20
|
+
# HARNESS_WEB_CACHE_TTL_SEC=86400
|
|
21
|
+
# HARNESS_WEB_CACHE=0
|
|
22
|
+
# HARNESS_WEB_ISOLATE=1
|
|
23
|
+
# HARNESS_PROJECT_ROOT=
|
|
24
|
+
# HARNESS_PKG_ROOT=
|
|
16
25
|
|
|
17
26
|
# --- VCC compaction (env-only; no JSON config files) ---
|
|
18
27
|
# Default: VCC handles /compact and auto-compaction. Set false for Pi LLM compaction:
|
|
@@ -21,7 +30,6 @@ HARNESS_WEB_SEARCH_ENGINE=ddg_html
|
|
|
21
30
|
|
|
22
31
|
# --- PostHog (optional) ---
|
|
23
32
|
# Project key — required for harness_* telemetry when HARNESS_TELEMETRY_ENABLED=true
|
|
24
|
-
# WSL2: ultimate-pi loads 00-posthog-network-bootstrap.ts (IPv4 fetch for *.posthog.com).
|
|
25
33
|
# If flush still fails, set POSTHOG_ENABLED=false or fix outbound HTTPS to PostHog.
|
|
26
34
|
# POSTHOG_API_KEY=
|
|
27
35
|
# POSTHOG_HOST=https://us.i.posthog.com
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Example project extension — copy to:
|
|
2
|
+
# <your-project>/.pi/harness/web-heuristic-angles.yaml
|
|
3
|
+
#
|
|
4
|
+
# Merges on top of package .pi/harness/web-heuristic-angles.yaml.
|
|
5
|
+
# Same angle id in a category replaces the package entry; new ids append.
|
|
6
|
+
|
|
7
|
+
version: 1
|
|
8
|
+
|
|
9
|
+
categories:
|
|
10
|
+
code:
|
|
11
|
+
# Add Rust-specific angles (keeps github + stackoverflow from package defaults)
|
|
12
|
+
- id: docs_rs
|
|
13
|
+
query: "{query} site:docs.rs"
|
|
14
|
+
rationale: Official Rust API docs
|
|
15
|
+
- id: crates_io
|
|
16
|
+
query: "{query} site:crates.io"
|
|
17
|
+
rationale: Crate ecosystem
|
|
18
|
+
# Package already ships category=security; extend or override ids here:
|
|
19
|
+
# security:
|
|
20
|
+
# - id: cisa_kev
|
|
21
|
+
# query: "{query} site:cisa.gov/known-exploited-vulnerabilities"
|
|
22
|
+
# rationale: CISA KEV catalog
|