@aliip/pilah 0.0.0-stage → 1.0.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.
Files changed (88) hide show
  1. package/BUILD_STATUS.md +23 -0
  2. package/LICENSE +21 -0
  3. package/README.md +108 -2
  4. package/assets/logo.svg +5 -0
  5. package/docs/AB_EVALUATION.md +62 -0
  6. package/docs/ACCEPTANCE_GATE.md +41 -0
  7. package/docs/ADAPTIVE_RCA_WORKFLOW.md +93 -0
  8. package/docs/AGENT_DECISION_REVIEW.md +17 -0
  9. package/docs/AGENT_TRACE_BENCHMARK.md +17 -0
  10. package/docs/ALWAYS_ON_5_WHYS.md +75 -0
  11. package/docs/ARCHITECTURE.md +43 -0
  12. package/docs/BEHAVIORAL_5_WHYS_V2_0_1.md +117 -0
  13. package/docs/CHECKPOINT_RECOVERY.md +86 -0
  14. package/docs/CI_EFFICIENCY.md +63 -0
  15. package/docs/COMPATIBILITY.md +84 -0
  16. package/docs/CONTRACTS.md +177 -0
  17. package/docs/CONVERSATION_USAGE.md +52 -0
  18. package/docs/ENGINEERING_METHOD.md +68 -0
  19. package/docs/HOST_VALIDATION.md +35 -0
  20. package/docs/INDEPENDENT_ACCEPTANCE_RUNBOOK.md +72 -0
  21. package/docs/INTERVENTION_LEDGER.md +25 -0
  22. package/docs/MAIN_VALIDATION_BACKLOG.md +19 -0
  23. package/docs/NATIVE_FIRST_WORKFLOW.md +27 -0
  24. package/docs/OPEN_SOURCE_ENGINEERING_STANDARDS.md +62 -0
  25. package/docs/ORCHESTRATION_ADVISOR.md +36 -0
  26. package/docs/PRE_VNEXT_INTEGRATION.md +27 -0
  27. package/docs/PRIVATE_BENCHMARK_EXPORT.md +14 -0
  28. package/docs/README.md +58 -0
  29. package/docs/RELEASE.md +33 -0
  30. package/docs/RELEASE_AUTHORIZATION.md +33 -0
  31. package/docs/RISK_GUIDANCE.md +18 -0
  32. package/docs/SECURITY.md +76 -0
  33. package/docs/SECURITY_RELIABILITY_AUDIT_V2_0_1.md +55 -0
  34. package/docs/SEMANTIC_EVIDENCE.md +27 -0
  35. package/docs/SOURCES.md +13 -0
  36. package/docs/STOCKROOM_BENCHMARK_RECHECK_2026_11_18.md +53 -0
  37. package/docs/TOKEN_EFFICIENCY.md +71 -0
  38. package/docs/TOKEN_PROVENANCE.md +15 -0
  39. package/docs/V2_0_1_TRACEABILITY.md +66 -0
  40. package/hooks.json +45 -0
  41. package/mcp_config.json +16 -0
  42. package/package.json +31 -4
  43. package/plugin.json +27 -0
  44. package/rules/AGENTS.md +2 -0
  45. package/schemas/database.sql +84 -0
  46. package/schemas/mcp-tools.json +552 -0
  47. package/scripts/a2a.mjs +343 -0
  48. package/scripts/check-release.mjs +42 -0
  49. package/scripts/check-syntax.mjs +30 -0
  50. package/scripts/checkpoint.mjs +50 -0
  51. package/scripts/compare-agent-traces.mjs +53 -0
  52. package/scripts/context-guardian.mjs +132 -0
  53. package/scripts/evaluate-acceptance.mjs +110 -0
  54. package/scripts/export-benchmark.mjs +31 -0
  55. package/scripts/generate-contracts.mjs +6 -0
  56. package/scripts/hook.mjs +406 -0
  57. package/scripts/host-check.mjs +40 -0
  58. package/scripts/intervention-ledger.mjs +94 -0
  59. package/scripts/pilah.mjs +3 -0
  60. package/scripts/release-authorization.mjs +137 -0
  61. package/scripts/review-agent-decisions.mjs +34 -0
  62. package/scripts/semantic-evidence.mjs +15 -0
  63. package/scripts/verifykit.mjs +3 -0
  64. package/skills/pilah/SKILL.md +24 -0
  65. package/src/acceptance-matrix.mjs +84 -0
  66. package/src/browser-evidence.mjs +40 -0
  67. package/src/context-health.mjs +14 -0
  68. package/src/conversations.mjs +302 -0
  69. package/src/engine.mjs +494 -0
  70. package/src/graph.mjs +169 -0
  71. package/src/mcp-diagnostics.mjs +53 -0
  72. package/src/mcp.mjs +151 -0
  73. package/src/model-recovery.mjs +108 -0
  74. package/src/native-tool-recovery.mjs +45 -0
  75. package/src/node-runtime.mjs +13 -0
  76. package/src/orchestration-advisor.mjs +24 -0
  77. package/src/rca.mjs +174 -0
  78. package/src/risk-guidance.mjs +95 -0
  79. package/src/scanner.mjs +303 -0
  80. package/src/security.mjs +793 -0
  81. package/src/semantic-evidence.mjs +144 -0
  82. package/src/skill-discovery.mjs +23 -0
  83. package/src/sqlite-compat.mjs +11 -0
  84. package/src/storage.mjs +455 -0
  85. package/src/tokens.mjs +627 -0
  86. package/src/tools.mjs +164 -0
  87. package/src/verification.mjs +567 -0
  88. package/src/workflow-router.mjs +34 -0
@@ -0,0 +1,23 @@
1
+ # PILAH — build and validation status
2
+
3
+ **As of 24 November 2026:** PILAH is on `main` with source manifest version `1.0.0`. The canonical repository remains `the existing repository` until a separate GitHub rename. `@aliip/pilah` is the package manifest name, **not confirmation of publication**.
4
+
5
+ | Area | Observable evidence | Boundary |
6
+ | --- | --- | --- |
7
+ | PILAH rebrand | PR #107, 9/9 matrix | Source-level Node 22/24/26.13.1 CI across three OS |
8
+ | Reduced CI and native routing | PR #108 | 1 full-suite job/PR, 3 on main, 9 manually available |
9
+ | Latest verified main source CI | Run #45313799636 | **3/3** Ubuntu/macOS/Windows Node 24 jobs passed at `9426397` |
10
+ | Engineering hardening | PRs #111–#115 | MCP contracts, directional graph, SAFE handoffs, consent-gated privacy, Python imports, and fail-closed CLI host preflight passed their PR suites; no live host proof |
11
+ | Installed Antigravity | [Backlog](docs/MAIN_VALIDATION_BACKLOG.md) | No complete independent live-host acceptance for PILAH |
12
+ | Context Guardian overhead | [Backlog](docs/MAIN_VALIDATION_BACKLOG.md) | Host per-invocation latency/CPU/token effect not measured |
13
+ | Token savings | [A/B evaluation](docs/AB_EVALUATION.md) | Not established through matched independent trials |
14
+ | Real STOCKROOM F01–F18 | [Independent runbook](docs/INDEPENDENT_ACCEPTANCE_RUNBOOK.md) | Runtime HTTP/DB/browser cases not established as PASS |
15
+ | npm / GitHub Package / tagged release | [Release authorization](docs/RELEASE_AUTHORIZATION.md) | **NO-GO** without signed external evidence and approval |
16
+
17
+ Green CI means the complete checked-in test suite and static release checks passed for the specified commit and runner—not actual browser, printing, database race, installed plugin, autonomous tool selection, or cost evidence. Keep missing acceptance marked **not tested**.
18
+
19
+ ## Earlier PILAH provenance
20
+
21
+ The original `v2.0.1` integration was promoted to `main` through PR #105; PILAH branding followed in PR #107. Issues #15, #71, #91 and #92 were closed **administratively as deferred/superseded**, not completed evidence. Historical 213/213 tests and 4/4 OS/runtime jobs describe an older source snapshot, not the current version.
22
+
23
+ Check [documentation](docs/README.md), [CI lanes](docs/CI_EFFICIENCY.md), and [outstanding validation](docs/MAIN_VALIDATION_BACKLOG.md). Do not infer release authorization from a merge.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 VerifyKit Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,109 @@
1
- # Temporary Holding Version
1
+ # PILAH
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **Project Intelligence, Logic, Analysis & Handoffs** — a small, native-first engineering layer for Google Antigravity.
4
+
5
+ PILAH helps coding agents find relevant cross-file context, reason about change impact, plan verification and track evidence **only when native tools cannot efficiently resolve the uncertainty**. PILAH does **not** edit project files, run shell commands, launch agents, replace Antigravity, or guarantee token savings.
6
+
7
+ **CI:** view the repository's Actions tab · [Documentation](docs/README.md) · [MIT License](LICENSE)
8
+
9
+ > **Source status — 24 November 2026:** The plugin is named **PILAH** (manifest `1.0.0`); the repository is accessed through the current URL displayed in GitHub's **Code** menu. The package manifest uses `@aliip/pilah`, but **publication is not verified**. The source-level CI passed on the latest main push (3/3 OS jobs on Node 24). Real installed Antigravity adoption, independent STOCKROOM F01–F18 runtime acceptance and matched token benchmarks are **not yet verified**. See [current status](BUILD_STATUS.md) and [validation backlog](docs/MAIN_VALIDATION_BACKLOG.md).
10
+
11
+ ## What it provides
12
+
13
+ | MCP tool | Use it for | Does not do |
14
+ | --- | --- | --- |
15
+ | `pilah_context` | Targeted symbol, source and cross-file relationship queries | Automatically read an entire repository for each prompt |
16
+ | `pilah_impact` | Scoped change-impact and candidate tests | Prove that every dependency or behavior was covered |
17
+ | `pilah_verify` | Risk-aware acceptance planning and named test-evidence assessment | Run or independently certify actual tests |
18
+ | `pilah_evidence` | Source-bound incidents, optional checkpoints and recovery guidance | Replay unknown tools or grant new permissions |
19
+
20
+ The scanner resolves basic local Python imports, configured Composer PSR-4 PHP class imports, and explicit JS/TS path aliases only when exact target files exist. Runtime framework dispatch remains unknown. Only `pilah_context` is eager by default; the other tools remain lazy. **A clear task should trigger zero PILAH calls.** One precise call is preferable to an automatic chain. For difficult bugs: reproduce → test a hypothesis → make the smallest complete fix → run relevant tests → report what remains unverified. See the [PILAH skill](skills/pilah/SKILL.md) and [engineering method](docs/ENGINEERING_METHOD.md).
21
+
22
+ ## Requirements and source setup
23
+
24
+ In the command below, replace `REPOSITORY_URL` with the HTTPS clone URL from the repository's GitHub **Code** menu.
25
+
26
+ - Node.js **22.13.0 or newer** with built-in `node:sqlite`; no third-party npm runtime dependencies.
27
+ - Google Antigravity with support for the plugin/MCP features used here.
28
+ - Permission to inspect the intended workspace; protected roots, sensitive files and revoked workspaces remain denied.
29
+
30
+ ```sh
31
+ git clone REPOSITORY_URL pilah
32
+ cd pilah
33
+ node --version
34
+ npm run check
35
+ node scripts/check-release.mjs
36
+ node scripts/pilah.mjs doctor
37
+ node scripts/pilah.mjs doctor --public # Redacted diagnostics for issue reports
38
+ node scripts/pilah.mjs host-check # requires agy; may report blocked
39
+ ```
40
+
41
+ The optional `host-check` command only validates the CLI's plugin manifest and whether PILAH appears in plugin listings. It cannot certify tool selection, browser workflows or independent E2E behavior. Missing `agy` is reported as blocked, not passed.
42
+
43
+ Install/register this **source checkout** using the native plugin manager supported by your Antigravity version. If the `agy` CLI is available, validate it with `agy plugin validate --strict .` and inspect `agy plugin list`. These are **steps for your machine**, not claims of a completed live installation test. For real host acceptance criteria, see [the host-validation runbook](docs/HOST_VALIDATION.md). The bundle includes `plugin.json`, `mcp_config.json`, `hooks.json`, `rules/AGENTS.md` and `skills/pilah/SKILL.md`.
44
+
45
+ Do not rely on the unpublished `@aliip/pilah` package identifier as an installation command. Avoid registering duplicate plugin instances unless explicitly intended.
46
+
47
+ ## CLI from a checkout
48
+
49
+ The supported source CLI is `scripts/pilah.mjs`, and the package manifest declares `pilah` as its preferred binary name. The following commands are **CLI subcommands**, not guaranteed Antigravity slash commands:
50
+
51
+ ```sh
52
+ node scripts/pilah.mjs help
53
+ node scripts/pilah.mjs doctor
54
+ node scripts/pilah.mjs mode on-demand
55
+ node scripts/pilah.mjs mode always-on # optional, explicit opt-in
56
+ node scripts/pilah.mjs toggle
57
+ node scripts/pilah.mjs compact on
58
+ node scripts/pilah.mjs autotrust active-only
59
+ node scripts/pilah.mjs allow /absolute/path/to/project
60
+ node scripts/pilah.mjs revoke /absolute/path/to/project
61
+ node scripts/pilah.mjs inspect /absolute/path/to/project
62
+ node scripts/pilah.mjs privacy status /absolute/path/to/project
63
+ node scripts/pilah.mjs impact /absolute/path/to/project src/auth.js
64
+ node scripts/pilah.mjs tokens --limit 5 --json
65
+ node scripts/pilah.mjs route --profile economy --task cross-file --uncertain
66
+ ```
67
+
68
+ **Defaults:** On-Demand and Compact. Always-On remains opt-in and does not require a tool call for simple tasks. Context Guardian is separate, also opt-in, and does not compact conversations automatically. `tokens` distinguishes observed metadata and estimates from provider-reported usage; **model token savings cannot be inferred from a smaller response or fewer MCP calls**.
69
+
70
+ For intentionally clearing locally stored workspace records, run `node scripts/pilah.mjs privacy purge /absolute/path/to/project --confirm-purge`. This deletes only the project's scoped SQLite records; it **does not** delete source files, evidence artifacts on disk, trust grants, or unscoped historic notes. Back up anything you need first.
71
+
72
+ `inspect` includes bounded file-scan I/O diagnostics. Use `node benchmarks/bench.mjs` to measure cold/warm local indexing, rather than treating bytes scanned as model token usage.
73
+
74
+ ## Verification example
75
+
76
+ Send the following arguments to `pilah_verify` with `operation="plan"`:
77
+
78
+ ```json
79
+ {
80
+ "workspace": "/absolute/path/to/project",
81
+ "operation": "plan",
82
+ "criteria": [{
83
+ "id": "duplicate-checkin",
84
+ "given": "A guest already checked in",
85
+ "when": "The QR code is scanned again",
86
+ "then": "No second print job is produced",
87
+ "evidence_type": "hardware",
88
+ "negative": true
89
+ }]
90
+ }
91
+ ```
92
+
93
+ Planning produces `not_tested` until evidence exists. A passing build or a local test report is **not** proof of real printer hardware, UI state, security, browser behavior or independent release acceptance. Run the actual tests with native Antigravity tools and report the names of the tests that ran. See [MCP contracts](docs/CONTRACTS.md), [security](docs/SECURITY.md) and [independent acceptance](docs/INDEPENDENT_ACCEPTANCE_RUNBOOK.md).
94
+
95
+ ## Compatibility with earlier installations
96
+
97
+ Public MCP tools use the `pilah_*` prefix. Previous tool and CLI aliases, environment settings and local data remain supported internally, so existing installations retain their workspace authorization and saved history. For the exact compatibility identifiers, consult [tool definitions](src/tools.mjs) and [security source](src/security.mjs). Do not guess or rename configuration keys.
98
+
99
+ Use the repository URL from the GitHub **Code** menu to clone. Do not delete existing configuration or database folders when installing PILAH.
100
+
101
+ ## Testing, CI and release
102
+
103
+ Routine CI now uses **1 full-suite PR job** on Ubuntu/Node 24, **3 jobs on main** (Ubuntu/macOS/Windows, Node 24), with the **full 9-job OS × Node 22/24/26.13.1 matrix** available by manually dispatching the workflow. A green repository CI run is not a live Antigravity acceptance or publication authorization. No automatic release or new package publication was performed.
104
+
105
+ - [Documentation index](docs/README.md) · [Architecture](docs/ARCHITECTURE.md) · [Compatibility](docs/COMPATIBILITY.md)
106
+ - [CI and efficiency methodology](docs/CI_EFFICIENCY.md) · [Release process](docs/RELEASE.md)
107
+ - [Status](BUILD_STATUS.md) · [Outstanding independent validation](docs/MAIN_VALIDATION_BACKLOG.md)
108
+
109
+ [MIT](LICENSE) © 2026 Alif Akbar and contributors.
@@ -0,0 +1,5 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" width="256" height="256" role="img" aria-label="PILAH mark">
2
+ <rect width="256" height="256" rx="44" fill="#F4F3EF"/>
3
+ <path d="M73 198V60h65c37 0 65 21 65 54s-28 54-65 54h-29" fill="none" stroke="#181C22" stroke-width="23" stroke-linejoin="round" stroke-linecap="round"/>
4
+ <circle cx="143" cy="114" r="12" fill="#4263EB"/>
5
+ </svg>
@@ -0,0 +1,62 @@
1
+ # Reproducible Antigravity A/B evaluation (issue #3)
2
+
3
+ **Representative candidate suite:** [six PILAH evaluation scenarios](../tests/fixtures/pilah-eval-scenarios.json) cover zero-call edits, cross-file impact, workspace denial, negative acceptance, stale handoff and complex UI/API work. The checked-in fixture is a reproducible *candidate*, not a signed independent evaluator-owned registry. Copy and freeze it outside the agent-controlled workspace before scoring. Every scenario starts `not_tested`; do not infer success or provider usage.
4
+
5
+ This read-only evaluator consumes completed official `agy -p ... --output-format json` or `stream-json` captures. It **does not launch model runs**, claim equal quotas, or overwrite either benchmark application.
6
+
7
+ Capture with the same prompt, task repository snapshot, model, thinking effort, permissions and independent acceptance suite. Record those settings in a manifest. Use a fresh workspace per run. Alternate or randomize order; at least five repetitions per variant are recommended. Keep source, environment and success criteria immutable.
8
+
9
+ Example `manifest.json`:
10
+
11
+ ```json
12
+ {
13
+ "setup": {
14
+ "task_id": "stockroom-eval-v1",
15
+ "snapshot_sha": "pinned-source-commit",
16
+ "model": "gemini-3.8-flash",
17
+ "effort": "high",
18
+ "antigravity_version": "1.5.7",
19
+ "permissions": "request-review",
20
+ "evaluation_version": "acceptance-v1"
21
+ },
22
+ "scenarios": ["checkout-idempotency", "offline-reopen", "cross-tenant-isolation"],
23
+ "runs": [
24
+ {
25
+ "variant": "native",
26
+ "repeat": 1,
27
+ "capture": "native-run-1.json",
28
+ "acceptance": {
29
+ "checkout-idempotency": "passed",
30
+ "offline-reopen": "not-tested",
31
+ "cross-tenant-isolation": "failed"
32
+ }
33
+ }
34
+ ]
35
+ }
36
+ ```
37
+
38
+ Run:
39
+
40
+ ```sh
41
+ node benchmarks/ab-evaluate.mjs manifest.json > aggregated.json
42
+ ```
43
+
44
+ Supported variants: `native`, `pilah-on-demand`, `pilah-always-on`, plus corresponding subagent, swarm and teamwork variants. Swarm/Teamwork availability depends on the current Antigravity plan and should never be presumed for Free Tier.
45
+
46
+ Values are medians with min/max, but interpretation depends on independent evidence. A `passed` verdict must be assigned by an external evaluator, not the implementation agent itself. Unknown/skipped are not passes. The final `result.usage.total_tokens` is cumulative for streaming sessions; do not sum step records or add cache-read/thinking to it.
47
+
48
+ **Privacy:** transcripts can contain prompts, paths and secrets; store captures locally and never commit or publish unreviewed copies. The aggregated output includes metadata but not raw transcript content.
49
+
50
+ **Sources:** [Antigravity headless output](https://antigravity.google/docs/cli/headless/), [plan quotas](https://antigravity.google/docs/plans), [Google DeepMind AlphaProof Code: independent verification](https://deepmind.google/blog/introducing-alphaproof-code/).
51
+
52
+ **Limitations:** Comparison readiness means repeated captures exist; it does not automatically prove randomization, identical external conditions, causal improvements or quota equivalence.
53
+
54
+ **Pre-vNext correction (18 Nov 2026):** This evaluator now refuses identical capture bytes reused as independent runs (SHA-256 collision of the entire captured result) and rejects per-run setup overrides that contradict the frozen manifest. `comparability.capture_repetitions_ready` only indicates sufficient **distinct captures**; `comparability.ready` remains **false** until independence, acceptance evidence and provider usage are established out of band. Distinct files alone still do not prove statistical or causal equivalence. No winner can be declared from self-reported weekly Free Tier percentages.
55
+
56
+ ## Distribution scope
57
+
58
+ The evaluator at `benchmarks/ab-evaluate.mjs` is intentionally **source-checkout-only**. It is excluded from the installable npm tarball to avoid distributing optional research code in the runtime plugin. Clone or download the source repository at a pinned revision to run the command above; this does not require a new dependency. The packaged PILAH MCP and CLI remain independent of the benchmark runner.
59
+
60
+ ## Behavioral reliability comparison — current candidate
61
+
62
+ The v2.0.1 behavioral changes include a truthful completion summary, explicit checkpoints, native error guidance and parallel-ownership gating. To evaluate their effect, hold the prompt, source, model, effort, tool permissions and acceptance registry fixed across **Native, prior PILAH baseline and v2.0.1**. Run at least **five independent trials per variant**; randomize order and measure user-visible acceptance outcomes as well as official usage when exposed. Reused transcripts, simulated F01–F18 proofs or browser-tab reloads cannot substitute for independent execution. **No matched repeated benchmark proving an improvement has been completed as of 18 November 2026**; issue #15 remains open.
@@ -0,0 +1,41 @@
1
+ # PILAH Independent Release Assessment (#4)
2
+
3
+ `pilah_verify(operation="assess")` checks named JUnit/TAP/JSON assertions **only**. It now states `release_ready:false` even when tests pass.
4
+
5
+ For critical release readiness, use `pilah_verify(operation="assess_release",artifact="reports/release.json")` in an authorized workspace or `node scripts/evaluate-acceptance.mjs release.json [trusted-public-keys.json]` offline.
6
+
7
+ ## Trust configuration
8
+ PILAH reads **public** Ed25519 evaluator keys from `~/.config/pilah/trusted-evaluators.json` when using the MCP action. A user/independent CI administrator must provision and protect this file **outside the coding agent's project**. Example:
9
+
10
+ ```json
11
+ {"ci-reviewer":"-----BEGIN PUBLIC KEY-----\n...\n-----END PUBLIC KEY-----\n"}
12
+ ```
13
+
14
+ Do **not** generate or trust a public key submitted inside the implementation repository; the key is only meaningful when controlled independently from the agent being evaluated. Never commit the private signing key.
15
+
16
+ A release manifest provides `revision`, `evaluator:{"name":"independent-ci","independent":true}`, `scenarios` and `critical_defects`. Each `passed` scenario needs machine evidence of type junit/tap/browser/security/integration/etc. with `outcome:passed`, the current `revision`, an opaque `reference`, `checked_at`, a 64-hex `artifact_sha256`, a positive `assertion_count`, `key_id` and a base64 Ed25519 `signature`.
17
+
18
+ The signature covers the canonical UTF-8 JSON serialization produced by `attestationPayload({revision,scenarioId,evidence})` in `scripts/evaluate-acceptance.mjs`. The independent test runner must create the payload **after executing and checking its assertions**, then sign it. The code only **verifies signature and metadata**; it does not run the tests itself.
19
+
20
+ Critical scenarios without an independently verified signature are downgraded to `not-tested`. Stale revision, mismatched evidence types and open critical defects block readiness. Successful evaluation means **eligible for independent review**, not production security certification. A valid signature proves possession of a trusted issuer key, not semantic correctness of the tests.
21
+
22
+ No PILAH tool launches a CI runner, changes filesystem permission, or approves a PR automatically.
23
+
24
+
25
+ ## Mandatory frozen acceptance scope
26
+
27
+ A signed test result is not proof that the agent submitted every required scenario. Release eligibility now fails closed unless an independent user-pinned registry matches all scenario IDs, requirement SHA-256 hashes, critical flags and required evidence types. The agent must not be able to edit the registry or signing keys.
28
+
29
+ Place the registry at `~/.config/pilah/acceptance-registry.json` outside the generated application workspace:
30
+
31
+ ```json
32
+ {"schema":"<registry-schema-id-from-source>","scenarios":[{"id":"offline-restart","requirement_sha256":"64-character-sha256-of-the-exact-requirement","critical":true,"required_evidence_types":["browser","integration"]}]}
33
+ ```
34
+
35
+ The registry is read by `pilah_verify(operation="assess_release")`. The CLI `scripts/evaluate-acceptance.mjs` also accepts an optional pinned-registry path after the trust-keys path.
36
+
37
+ Without a matching registry, `release_ready` stays false even if all submitted assertions have valid signatures. A true result means eligible for independent review of signed evidence, not proof of test execution or production certification. File permissions and reviewer keys must be protected by the user's OS.
38
+
39
+ ## Behavioral completion versus release gate (v2.0.1)
40
+
41
+ PR #36 added a separate **typed** plan/assessment contract: each criterion may declare `given`, `when`, `then` and `evidence_type`; browser and visual criteria require `viewport`, `ui_state` and `reference`. Planning is `not_tested`. Local `assess` can report passed **named machine assertions** but its `completion.fully_verified` stays false, and local test artifacts cannot independently establish UI/browser, hardware, security or release evidence. `assess_semantic` and `assess_browser` remain **unattested structural reviews**. Only the separately signed, pinned `assess_release` plus the [publish authorization policy](RELEASE_AUTHORIZATION.md) can contribute to release eligibility. F01–F18 external evidence is still pending.
@@ -0,0 +1,93 @@
1
+ > **Historical research record:** Terminology has been standardized to PILAH. Dates, CI results and observed limitations refer to the source revision investigated at that time, not necessarily the current plugin.
2
+
3
+ # Adaptive 5 Whys — evidence-guided RCA in PILAH v2.0.1
4
+
5
+ **Status:** Local software workflow and verification contract; not an automatic investigator, model chain, forensic proof, native test runner or independent release approval. See issue #48 and the original [behavioral Five Whys](BEHAVIORAL_5_WHYS_V2_0_1.md).
6
+
7
+ ## Zero-first workflow
8
+
9
+ 1. **Fast path (zero RCA tool calls):** simple typo, isolated change or cause already reproduced and understood → native edit and targeted regression. Do not invoke PILAH merely to ask five questions.
10
+ 2. **RCA-lite (native reasoning, zero or one context/impact call):** for uncertain nontrivial bugs, state expected versus actual, the observed symptom, one or two *competing* causes, a falsifier for each and the cheapest differentiating experiment. A chain may stop after two or three Whys. No storage unless explicitly approved.
11
+ 3. **RCA-deep (opt-in):** recurrent failure, regression after a fix, inconsistent browser/printer result, concurrency, authorization, financial effects or multi-module ambiguity. If useful, one targeted `pilah_context(query,limit=5)` OR `pilah_impact(summary=true)`. The native Antigravity agent still runs experiments; PILAH records only explicitly approved, bounded structured notes.
12
+ 4. **Evidence:** use a real named unit/integration JUnit/TAP/PILAH JSON testcase with `pilah_verify(assess)`. Do not infer a root cause from a successful build, UI test name, tester's narrative or the mere presence of an evidence ID.
13
+ 5. **Countermeasure:** minimize the fix; include controlled negative controls, recurrence scenario and non-regression cases. Re-check source revisions and evidence artifacts after any edit. Report separately what the test supports, what was refuted and what remains unverified.
14
+
15
+ ## Explicit local RCA lifecycle (four existing MCP tools)
16
+
17
+ ### 1. Record observed incident (not a proven root cause)
18
+
19
+ ```json
20
+ {
21
+ "workspace": "/authorized/project",
22
+ "operation": "record_incident",
23
+ "persist_rca": true,
24
+ "title": "Second QR scan triggers duplicate print",
25
+ "root_cause": "Possible UI handler replay",
26
+ "paths": ["src/checkin.js"]
27
+ }
28
+ ```
29
+
30
+ Invoke via `pilah_evidence` only with user consent to retain RCA text locally. `root_cause` is retained for backwards compatibility but treated as a **candidate**, never verified. Incident state is `investigating`. A linked evidence ID is checked for authorized workspace, fresh source and intact artifact, but **does not prove relevance or cause**. A repeat incident signature may suggest a prior related incident ID, not its cause.
31
+
32
+ ### 2. Create falsifiable hypothesis
33
+
34
+ ```json
35
+ {
36
+ "workspace": "/authorized/project",
37
+ "operation": "add_hypothesis",
38
+ "persist_rca": true,
39
+ "incident_id": "<incident ID>",
40
+ "hypothesis": "The check-in UI sends the same print event twice",
41
+ "experiment": "Disable UI handler, replay one check-in and compare server print counts",
42
+ "predicted_observation": "No second print after disabling the handler",
43
+ "disconfirming_test": "Observe duplicate backend queue prints with UI handler disabled",
44
+ "expected_criterion_id": "qr-print-guard"
45
+ }
46
+ ```
47
+
48
+ Optional `parent_hypothesis_id` creates **branches** of a Why chain up to eight levels; multiple hypotheses can represent competing causes. Optional `plan_id` ensures the criterion belongs to an intact, current, opt-in acceptance plan. An arbitrary string is **not** an executed test or independent witness.
49
+
50
+ ### 3. Run native test then assess it
51
+
52
+ Run the controlled experiment with native Antigravity tools. Produce JUnit/TAP/PILAH JSON and assess the *exact named* unit/integration test with `pilah_verify(operation="assess")`. Capture its `evidence_id`. Then:
53
+
54
+ ```json
55
+ {
56
+ "workspace": "/authorized/project",
57
+ "operation": "assess_hypothesis",
58
+ "persist_rca": true,
59
+ "hypothesis_id": "<hypothesis ID>",
60
+ "experiment_outcome": "supports",
61
+ "observation": "The named regression passed after suppressing the duplicate handler",
62
+ "evidence_ids": ["<fresh exact named-test evidence ID>"]
63
+ }
64
+ ```
65
+
66
+ Allowed outcomes: `supports`, `refutes`, `inconclusive`. Results are `locally_supported`, `refuted` or `inconclusive`, **never `proven`**. For supports/refutes, the evidence must be a passing exact named **unit/integration** assertion for the hypothesis' `expected_criterion_id`, from the same authorized workspace/source revision and an intact report. A passing negative-control test can be submitted with the agent's interpretation `refutes`; that interpretation is not cryptographically attested. **Failed, build-only, visual, browser, hardware, security, stale, unrelated and altered artifacts cannot promote a hypothesis.**
67
+
68
+ ### 4. Read status and re-evaluate when source changes
69
+
70
+ `pilah_evidence(operation="hypotheses",incident_id="...")` lists branches, recorded outcomes and source freshness; `operation="incidents"` shows candidate causes with `root_cause_verified:false`. When source changes, old hypotheses are reported `stale`; create a new reviewed hypothesis and run new tests. Do not silently reuse an earlier `locally_supported` status. The final response distinguishes **reproduced, locally supported, refuted, stale, blocked and untested**.
71
+
72
+ ## Safety and token budget
73
+
74
+ - Default **On-Demand**: no automatic RCA calls, session notices, extra models or teamwork. Compact output retains all causal proof warnings. The skill adds only one short adaptive branch, staying under its existing 3,000-character CI limit.
75
+ - **Consent:** `persist_rca:true` is required for local writes. Persist only minimal text; common plaintext secret assignments are rejected as defense in depth, not perfect secret filtering. No raw transcripts, credentials or customer artifacts should be copied into notes.
76
+ - **Bounded:** max 8 Why depth, up to 20 evidence links, 40 criteria and standard MCP response limits. Existing SQLite history remains locally stored; disabling other snapshot features does **not** automatically erase RCA records.
77
+ - **No automatic evidence creation:** risk-guidance templates are suggestions, `required_test_ids` remains empty for that advisory, and only explicit user-reviewed acceptance criteria are mandatory.
78
+ - **Locality vs causality:** a named passing unit/integration assertion and an agent's observation may be useful diagnostic support, but they cannot independently establish production behavior or causal truth. The signed release process is separate.
79
+
80
+ ## Regression acceptance
81
+
82
+ The repository tests cover consent, hypothetical competing causes and parent branches, refutation, missing/unrelated/build-only/altered/stale evidence, source revision changes, existing SQLite migration, Compact warnings and actual MCP stdio+SQLite lifecycle. These are **synthetic tests**. The external release issue #15 still requires real installed Antigravity, F01–F18, browser/physical printer where applicable, independent validation and repeated matched Native/PILAH trials with official provider usage.
83
+
84
+ Source of truth: [`src/rca.mjs`](../src/rca.mjs), [MCP contracts](CONTRACTS.md), [database schema](../schemas/database.sql), [tests](../tests/rca_lifecycle.test.mjs).
85
+
86
+ ### 5. Inspect bounded history or delete RCA notes
87
+
88
+ In default Compact, `pilah_evidence(operation="incidents"|"hypotheses")` returns up to **8** entries, including `total`, `more_available` and a proof-warning. Use `compact off` to inspect up to 50 records. Reading a prior locally supported/refuted hypothesis re-checks all its linked artifact hashes; missing/modified evidence changes the displayed status to **stale**, even if source revision itself is unchanged.
89
+
90
+ For explicit local cleanup, `pilah_evidence(operation="delete_incident",incident_id="...",persist_rca=true,confirm_deletion=true)` logically removes **one** incident and its attached hypotheses, leaving independent test artifacts, acceptance plans and other incidents untouched. Require user approval: deletion cannot be undone through PILAH, but SQLite WAL/backups may retain old bytes, so it is **not cryptographic erasure**. Do not claim this deletes all related personal data.
91
+
92
+ Each assessment also appends a local immutable-in-application **experiment history entry** (observation, outcome, exact criterion, evidence IDs, revision and time). The `hypotheses` response returns up to three recent outcomes and the `experiments_total` count; it never upgrades those user-reported interpretations to independent proof. Deleting an incident logically deletes its hypotheses **and this experimental history**, leaving unrelated reports intact.
93
+
@@ -0,0 +1,17 @@
1
+ > **Historical research record:** Terminology has been standardized to PILAH. Dates, CI results and observed limitations refer to the source revision investigated at that time, not necessarily the current plugin.
2
+
3
+ # Independent Observable Agent-Decision Review
4
+
5
+ **Purpose:** inspect *observable* Antigravity tool and work decisions, **not hidden model reasoning**. This optional source-checkout utility was introduced for issue #12.
6
+
7
+ ## Local usage
8
+
9
+ ```bash
10
+ node scripts/review-agent-decisions.mjs local-transcript.jsonl independent-review.json
11
+ ```
12
+
13
+ The external review JSON identifies `reviewer.role="independent"` and annotations with `step_index`, `area` (planning, diagnosis, tool-selection, verification, error-recovery, handoff), `grade` (supported, incomplete, contradicted, not-observable) and opaque `evidence_ref` such as `trace:step10`.
14
+
15
+ The utility validates that referenced observable steps exist and summarizes **reviewer-reported judgments**. It cannot certify reviewer independence, inspect hidden chain-of-thought, authenticate raw transcript observations, or demonstrate that an PILAH intervention caused better code. Store transcripts privately; remove credentials and user content before any sharing.
16
+
17
+ **Current context:** behavioral reliability PR #36 merged into `v2.0.1`, with local MCP/SQLite E2E passing. Live Antigravity/18-case acceptance remains open in #15. See [5 Whys](BEHAVIORAL_5_WHYS_V2_0_1.md) and [A/B protocol](AB_EVALUATION.md).
@@ -0,0 +1,17 @@
1
+ > **Historical research record:** Terminology has been standardized to PILAH. Dates, CI results and observed limitations refer to the source revision investigated at that time, not necessarily the current plugin.
2
+
3
+ # Observable Agent-Trace Comparison
4
+
5
+ The optional local-only comparison from issue #12 counts observable Antigravity events. **It cannot inspect hidden model thinking or establish causal speed/quality improvements.**
6
+
7
+ ## Usage
8
+
9
+ ```bash
10
+ node scripts/compare-agent-traces.mjs native-transcript.jsonl pilah-transcript.jsonl
11
+ ```
12
+
13
+ Input is local `transcript.jsonl` material containing available `USER_INPUT`, `PLANNER_RESPONSE`, `GENERIC` and `ERROR_MESSAGE` records. Repeated planner `step_index` entries are deduplicated. Output is bounded counts, sanitized tool names, timestamps and coverage warnings — **not prompts, arguments or model responses**.
14
+
15
+ A larger number of tool calls is not automatically lower quality; repeated source reads can be necessary after edits. Pair this comparison with independent acceptance results, matched task/model/effort/permissions and official CLI usage if available. Baseline Native/PILAH output quality has **not** been causally established by the current CI.
16
+
17
+ Private transcripts may contain login credentials; do not commit unreviewed originals. See [Decision review](AGENT_DECISION_REVIEW.md), [Intervention ledger](INTERVENTION_LEDGER.md), [benchmark protocol](AB_EVALUATION.md) and release blocker #15.
@@ -0,0 +1,75 @@
1
+ > **Historical research record:** Terminology has been standardized to PILAH. Dates, CI results and observed limitations refer to the source revision investigated at that time, not necessarily the current plugin.
2
+
3
+ # Always-On Token Efficiency: Five-Whys Scenarios
4
+
5
+ ## Scope and evidence level
6
+ **Code-observed:** persistent plugin rules, lifecycle hooks, skeleton output, repeated tool instructions, estimated telemetry. **Not yet measured:** per-task increase/decrease in Gemini token consumption. Use [TOKEN_EFFICIENCY.md](TOKEN_EFFICIENCY.md) for real A/B trials. Do not turn these causal hypotheses into claimed percent savings.
7
+
8
+ ## Scenario 1 — Simple typo edit consumes unnecessary context
9
+ 1. **Why** may the task use more input tokens? Plugin guidance is present even for a trivial change.
10
+ 2. **Why** is guidance always present? The bundled `rules/AGENTS.md` is continuously active, independent of the current mode.
11
+ 3. **Why** was it large? The rules bundled all verification, dependency, token metrics and teamwork procedures.
12
+ 4. **Why** are those unnecessary? A one-file typo does not require graph analysis, handoff reports or incident handling.
13
+ 5. **Why** was there no separation? Mode-specific decisions were expressed as persistent instructions rather than a concise router plus a one-time policy.
14
+
15
+ **Fix:** Reduce persistent rule to a tiny router; inject adaptive Always-On guidance at `SessionStart` only when enabled. Never auto-call PILAH for docs, typos, styles or isolated changes. **Proof:** static size budget test for `rules/AGENTS.md`, hook startup test.
16
+
17
+ ## Scenario 2 — The agent asks for skeleton and still reads full source
18
+ 1. **Why** might two context payloads be consumed? Both skeleton output and native full-source output reach the model.
19
+ 2. **Why** are both used? The agent still needs implementation details after initial navigation.
20
+ 3. **Why** does skeleton often not answer that need? `skeletonizeCode()` strips comments/blank lines, not method bodies.
21
+ 4. **Why** was it treated as a general context replacement? The policy encouraged skeletonization for every unfamiliar file.
22
+ 5. **Why** did this persist? The savings calculation compares hypothetical raw source with skeleton output, not two complete task traces.
23
+
24
+ **Fix:** In Always-On, use `pilah_context(action="query")` for names/locations. Use skeleton only for orientation, avoid the full-read duplication when the preview suffices, and use native reads for exact implementation. **Proof:** rule/skill contract review; require empirical A/B for net effect. A true semantic outline parser is out of scope and is not claimed.
25
+
26
+ ## Scenario 3 — Every meaningful edit causes a chain of optional checks
27
+ 1. **Why** does agent reasoning/tool output grow? It calls impact, context, plan, testing, assess and history in sequence.
28
+ 2. **Why** does it call every stage? The workflow's descriptions looked mandatory rather than conditional.
29
+ 3. **Why** was no early exit allowed? The policy lacked an explicit minimum-work stop condition.
30
+ 4. **Why** did impact contribute output bloat? The full response includes up to 25 affected items, multiple test files and telemetry.
31
+ 5. **Why** wasn't a light first-pass available? PILAH offered only the full impact payload.
32
+
33
+ **Fix:** Add `pilah_impact(summary=true)` as a one-call triage that caps affected/test previews but **retains risk, uncertainty, coverage flags, and full counts**. Expand only when needed. Skip token telemetry in summary. Do not automatically call `plan` and `assess` if direct report assessment suffices. **Proof:** summary contract and integration test ensure smaller payload and no missing uncertainty.
34
+
35
+ ## Scenario 4 — High-frequency lifecycle hooks add repeated work
36
+ 1. **Why** is there overhead during each turn? The plugin spawns a Node process in `PreInvocation`.
37
+ 2. **Why** does the process run so often? Antigravity fires `PreInvocation` before model calls.
38
+ 3. **Why** does PILAH use it? To maintain active session metadata.
39
+ 4. **Why** is that repetitive? Most session identifiers are stable until a new conversation.
40
+ 5. **Why** wasn't `SessionStart` sufficient? The original architecture registered a hook for every lifecycle opportunity.
41
+
42
+ **Fix:** Remove `PreInvocation` from `hooks.json`. Use the officially supported `SessionStart` session ID, retain targeted `PostToolUse` for test/artifact bookkeeping. This reduces local CPU/process overhead, **not automatically model tokens**. **Proof:** hook configuration test. Mid-session mode toggles are communicated by command responses; start a new conversation for guaranteed startup-policy refresh.
43
+
44
+ ## Scenario 5 — Dashboard reports savings while total session tokens increase
45
+ 1. **Why** can reported savings be positive? `tokens_saved=max(0, raw_scope_tokens-response_tokens)`.
46
+ 2. **Why** is `raw_scope_tokens` a generous baseline? It estimates how much source **might** be read.
47
+ 3. **Why** isn't this net savings? Native may not read that scope, and PILAH adds its own instructions, reports and follow-up calls.
48
+ 4. **Why** aren't those included? Local telemetry sees size of its own outputs, not a counterfactual native task.
49
+ 5. **Why** was this called measured? Scoped data was confused with controlled model-session consumption.
50
+
51
+ **Fix (implemented in PR #2):** Stop exposing computed `tokens_saved`, savings percentages or dollar savings as if observed. Display source-size and tool-response estimates separately, keep net savings `null`, and accept only officially reported Antigravity CLI JSON for per-run usage. For task-level savings, a controlled [A/B evaluation](TOKEN_EFFICIENCY.md) is mandatory.
52
+
53
+ ## Always-On policy invariants
54
+ - **Correctness first:** no output compression that hides `risk`, `uncertainty`, `freshness`, or evidence status.
55
+ - **No false PASS:** relevant native tests + mapped acceptance evidence are still required for testable code deliverables.
56
+ - **No redundant work:** one impact triage per affected scope; context lookup only when needed; no auto history/telemetry calls.
57
+ - **Native-first:** PILAH does not force Teamwork, subagents, tool execution or a particular browser.
58
+ - **Privacy:** do not use internal transcripts as a billing-grade source or include private session data in task output.
59
+
60
+ ## Acceptance criteria
61
+ 1. Default `on-demand` adds no startup instruction injection; explicit `always-on` injects one adaptive policy.
62
+ 2. Persistent rule fits a 400-character budget. `PreInvocation` does not spawn PILAH.
63
+ 3. `pilah_impact(summary=true)` reports full risk/uncertainty and is smaller than the comparable full response on a dependency fixture.
64
+ 4. MCP `verify_handoff` accepts its documented parameters and does not require reports for research-only tasks.
65
+ 5. CI runs on Windows, macOS and Linux.
66
+ 6. Publish no net token savings percentage until controlled sessions demonstrate it.
67
+
68
+ ## Official platform references
69
+ - [Google Antigravity — Rules](https://antigravity.google/docs/rules/)
70
+ - [Google Antigravity — Hooks](https://antigravity.google/docs/hooks)
71
+ - [Google Antigravity — Build plugins](https://antigravity.google/docs/build-plugins/)
72
+
73
+ ## Current v2.0.1 behavioral alignment
74
+
75
+ The historical Always-On improvements remain present: on-demand by default, tiny rule, no PreInvocation, scope-limited summary and no invented token savings. Behavioral PR #36 subsequently added **typed Given/When/Then acceptance with evidence types**, **source-fresh explicit checkpoint decisions**, nonexecuting native tool failure guidance, and a stricter independence requirement for parallel teamwork recommendations. Only request these optional tools when they materially reduce uncertainty; never transform the 71.5% repeated-read *path* statistic into a measured token saving. A green local report does not make `completion.fully_verified` true. Live IDE and controlled performance benefits are still open in issue #15.
@@ -0,0 +1,43 @@
1
+ # PILAH — architecture
2
+
3
+ PILAH is a **local-first, native-first engineering support layer** for Google Antigravity. Antigravity remains responsible for reasoning, file edits, terminal/browser actions, host permissions and optional native agents. PILAH provides scoped code intelligence, candidate impact, structured verification planning, and evidence/recovery diagnostics. It is **not** an agent runtime, language server, arbitrary shell executor or a guarantee of model cost savings.
4
+
5
+ ## Runtime surface
6
+
7
+ - **Plugin:** `plugin.json`, `mcp_config.json`, `hooks.json`, `rules/AGENTS.md`, `skills/pilah/SKILL.md`.
8
+ - **Four public MCP tools:** `pilah_context`, `pilah_impact`, `pilah_verify`, `pilah_evidence`. They use JSON-RPC 2.0 over stdio and require an authorized absolute workspace. `pilah_context` is the only eager tool; others are lazy.
9
+ - **Compatibility:** public calls use `pilah_*`, and the preferred source CLI is `scripts/pilah.mjs`. Earlier internal tool aliases, configuration keys and database paths remain recognized without exposing retired names in public guides. Inspect source before changing persisted identifiers.
10
+ - **Runtime:** Node.js >=22.13.0 with built-in SQLite, no third-party npm runtime dependency, no automatic network service and no arbitrary project-command MCP tool.
11
+
12
+ ## Components
13
+
14
+ | Component | Function | Known boundary |
15
+ | --- | --- | --- |
16
+ | [Security](../src/security.mjs) | Workspace trust/revocation, protected paths, settings and bounded file reads | No authorization from untrusted tool arguments |
17
+ | [Scanner](../src/scanner.mjs) and [graph](../src/graph.mjs) | Static symbols, directional imports (including local Composer PSR-4 and configured JS/TS aliases), and heuristic test candidates | Not a compiler, full LSP or complete cross-language dependency graph |
18
+ | [Engine](../src/engine.mjs) and [MCP server](../src/mcp.mjs) | Four bounded public operations, JSON-RPC errors, read-first calls | Cannot edit code or control Antigravity |
19
+ | [Storage](../src/storage.mjs) | Local SQLite index, revision metadata, opt-in checkpoints, incident evidence and consent-gated workspace purge | Explicitly saved notes may include private user-supplied content |
20
+ | [Verification](../src/verification.mjs) | Given/When/Then scope, machine-report assessment | Local tests do not independently certify visual, security, hardware or production outcomes |
21
+ | [Token diagnostics](../src/tokens.mjs) | Local provenance, size estimates and eligible session usage | Does not prove model token savings or billing |
22
+ | [RCA](../src/rca.mjs) | Bounded hypothesis and falsification notes | Local evidence is not independent causal proof |
23
+ | [Router](../src/workflow-router.mjs) | Deterministic native-only versus scoped PILAH advice | Does not switch models or auto-call tools |
24
+
25
+ ## Versioned graph index
26
+
27
+ `src/scanner.mjs` includes an explicit `GRAPH_INDEX_VERSION` in each source snapshot fingerprint. This invalidates a previously persisted SQLite dependency graph when PILAH's static parsing semantics are upgraded, even if project files themselves are untouched. The engine rebuilds the graph using the authorized workspace's current files. This is distinct from user edits: the source-index revision may change after a plugin update, intentionally invalidating prior evidence freshness claims rather than reusing relationships from an older scanner.
28
+
29
+ Do not automatically increment this version for documentation changes. Bump it when symbol/import/relationship generation changes and preserve a regression test that loads an older index revision. Existing workspace grants, user notes and project source are not deleted.
30
+
31
+ ## Engineering flow
32
+
33
+ 1. **Native first.** If the task is clear, use zero PILAH calls. Prefer existing project code or platform primitives before adding code.
34
+ 2. **Bound uncertainty.** When cross-file ownership/risk is unclear, request only one specific `pilah_context` or `pilah_impact` result; do not automatically chain.
35
+ 3. **Reproduce and implement.** Antigravity executes approved project commands and changes source. Use a minimal complete patch, preserving validation, permissions, accessibility and public contracts.
36
+ 4. **Verify at the right level.** Define typed plans for risk, run existing native test tools, attach exact named evidence where available. Changed source revisions invalidate stale evidence. Browser/security/hardware/independent claims need independent execution.
37
+ 5. **Handoff.** State changed scope, observed results, failures, `not tested` cases and provenance. Never derive savings from response sizes or call counts.
38
+
39
+ ## Trust, privacy and release
40
+
41
+ Project root authorization is mandatory; protected paths, credential files, unsafe symlinks, unauthorized descendants and source/evidence staleness are denied or flagged. Automatic full Markdown snapshots and user-global Context Guardian are disabled by default; opt-in features may retain local state or add invocation overhead. No agent or plugin may manufacture passing independent acceptance evidence.
42
+
43
+ The [current status](../BUILD_STATUS.md), [security model](SECURITY.md), [MCP contracts](CONTRACTS.md) and [validation backlog](MAIN_VALIDATION_BACKLOG.md) determine operational claims. **Repository CI is not an installed Antigravity E2E or authorized package release.**