@aliip/pilah 0.0.0-stage → 1.0.1

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 (84) 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/ACCEPTANCE_GATE.md +41 -0
  6. package/docs/ADAPTIVE_RCA_WORKFLOW.md +93 -0
  7. package/docs/AGENT_DECISION_REVIEW.md +17 -0
  8. package/docs/ALWAYS_ON_5_WHYS.md +75 -0
  9. package/docs/ARCHITECTURE.md +43 -0
  10. package/docs/BEHAVIORAL_5_WHYS_V2_0_1.md +117 -0
  11. package/docs/CHECKPOINT_RECOVERY.md +86 -0
  12. package/docs/CI_EFFICIENCY.md +63 -0
  13. package/docs/COMPATIBILITY.md +84 -0
  14. package/docs/CONTRACTS.md +177 -0
  15. package/docs/CONVERSATION_USAGE.md +52 -0
  16. package/docs/ENGINEERING_METHOD.md +68 -0
  17. package/docs/HOST_VALIDATION.md +35 -0
  18. package/docs/INDEPENDENT_ACCEPTANCE_RUNBOOK.md +72 -0
  19. package/docs/INTERVENTION_LEDGER.md +25 -0
  20. package/docs/MAIN_VALIDATION_BACKLOG.md +19 -0
  21. package/docs/NATIVE_FIRST_WORKFLOW.md +27 -0
  22. package/docs/OPEN_SOURCE_ENGINEERING_STANDARDS.md +62 -0
  23. package/docs/ORCHESTRATION_ADVISOR.md +36 -0
  24. package/docs/PRE_VNEXT_INTEGRATION.md +27 -0
  25. package/docs/README.md +54 -0
  26. package/docs/RELEASE.md +33 -0
  27. package/docs/RELEASE_AUTHORIZATION.md +33 -0
  28. package/docs/RISK_GUIDANCE.md +18 -0
  29. package/docs/SECURITY.md +76 -0
  30. package/docs/SECURITY_RELIABILITY_AUDIT_V2_0_1.md +55 -0
  31. package/docs/SEMANTIC_EVIDENCE.md +27 -0
  32. package/docs/SOURCES.md +13 -0
  33. package/docs/TOKEN_EFFICIENCY.md +71 -0
  34. package/docs/TOKEN_PROVENANCE.md +15 -0
  35. package/docs/V2_0_1_TRACEABILITY.md +66 -0
  36. package/hooks.json +45 -0
  37. package/mcp_config.json +16 -0
  38. package/package.json +31 -4
  39. package/plugin.json +27 -0
  40. package/rules/AGENTS.md +2 -0
  41. package/schemas/database.sql +84 -0
  42. package/schemas/mcp-tools.json +552 -0
  43. package/scripts/a2a.mjs +344 -0
  44. package/scripts/check-release.mjs +42 -0
  45. package/scripts/check-syntax.mjs +30 -0
  46. package/scripts/checkpoint.mjs +50 -0
  47. package/scripts/compare-agent-traces.mjs +53 -0
  48. package/scripts/context-guardian.mjs +132 -0
  49. package/scripts/evaluate-acceptance.mjs +110 -0
  50. package/scripts/export-benchmark.mjs +31 -0
  51. package/scripts/generate-contracts.mjs +6 -0
  52. package/scripts/hook.mjs +406 -0
  53. package/scripts/host-check.mjs +40 -0
  54. package/scripts/intervention-ledger.mjs +94 -0
  55. package/scripts/pilah.mjs +3 -0
  56. package/scripts/release-authorization.mjs +137 -0
  57. package/scripts/review-agent-decisions.mjs +34 -0
  58. package/scripts/semantic-evidence.mjs +15 -0
  59. package/scripts/verifykit.mjs +3 -0
  60. package/skills/pilah/SKILL.md +24 -0
  61. package/src/acceptance-matrix.mjs +84 -0
  62. package/src/browser-evidence.mjs +40 -0
  63. package/src/context-health.mjs +14 -0
  64. package/src/conversations.mjs +302 -0
  65. package/src/engine.mjs +494 -0
  66. package/src/graph.mjs +169 -0
  67. package/src/mcp-diagnostics.mjs +53 -0
  68. package/src/mcp.mjs +151 -0
  69. package/src/model-recovery.mjs +108 -0
  70. package/src/native-tool-recovery.mjs +45 -0
  71. package/src/node-runtime.mjs +13 -0
  72. package/src/orchestration-advisor.mjs +24 -0
  73. package/src/rca.mjs +174 -0
  74. package/src/risk-guidance.mjs +95 -0
  75. package/src/scanner.mjs +303 -0
  76. package/src/security.mjs +793 -0
  77. package/src/semantic-evidence.mjs +144 -0
  78. package/src/skill-discovery.mjs +23 -0
  79. package/src/sqlite-compat.mjs +11 -0
  80. package/src/storage.mjs +455 -0
  81. package/src/tokens.mjs +627 -0
  82. package/src/tools.mjs +164 -0
  83. package/src/verification.mjs +567 -0
  84. package/src/workflow-router.mjs +34 -0
@@ -0,0 +1,27 @@
1
+ # Semantic and Browser Evidence — issue #8
2
+
3
+ PILAH provides read-only local evidence assessment via:
4
+
5
+ - `pilah_verify(operation="assess_semantic",artifact="reports/scenarios.json")`
6
+ - `pilah_verify(operation="assess_browser",artifact="reports/browser.json")`
7
+ - `node scripts/semantic-evidence.mjs reports/scenarios.json` for an offline standalone report
8
+
9
+ `assess_semantic` checks scenario-specific structural observations against the current workspace revision. Supported categories include genuine two-connection overlapping stock checkout, browser process restart with a persistent profile, idempotent response loss with conflicting payload, payment arithmetic, bounded refund/restock, tenant/store entrypoint matrix, invitation and authentication negatives.
10
+
11
+ **Crucially:** a test named `ConcurrentCheckoutTest` or a JSON `witnessed_capabilities` list never proves parallel execution. The evaluator computes capabilities from structured facts. All facts are still **unattested** caller input; results can only be `evidence-present-unattested`, `insufficient-evidence` or `stale`, never independently verified release approval.
12
+
13
+ The browser contract is `<browser-evidence-schema-id-from-source>`. It requires a scenario ID, source fingerprint, build artifact SHA-256, claimed served build hash, browser version, runner version, timestamps, executed assertions, and optional hashed local artifact references. PILAH recomputes referenced artifact file hashes locally using workspace-safety rules. A matching pair of digest strings is **not** proof that the expected build was served; external harness/CI review remains necessary. Screenshots by themselves are not functional assertions.
14
+
15
+ The 18 predefined negative-control cases are listed in `tests/fixtures/acceptance-18.json`. They are **frozen acceptance specifications**, not completed independent browser/PHP E2E results. Backend isolation, payment and exactly-once invariants still require independently executed test runners.
16
+
17
+ PILAH does not control Chrome, install dependencies, run arbitrary project commands or bypass approvals.
18
+
19
+ ## Source revision and evidence separation
20
+
21
+ Place generated PILAH JSON reports under a `reports/`, `report/`, or `test-results/` directory in the authorized workspace. Only recognized PILAH evidence structures in those directories are excluded from the application-source fingerprint; ordinary JSON source/config files remain indexed and revision-bound. This avoids a circular report: a generated report may contain the revision it is attesting without changing that revision by its own presence.
22
+
23
+ The report bytes remain separately hashed and any later edits invalidate recorded artifact integrity. Application source changes still invalidate report revision matching. This exclusion is only bookkeeping; report content remains **unattested** and never becomes independent release proof.
24
+
25
+ ## Behavioral acceptance contract (merged PR #36)
26
+
27
+ Use `pilah_verify(operation="plan")` with typed Given/When/Then criteria *before* native execution. For browser and visual work, specify the exact viewport, interactive state and design/reference target; every scenario begins **not_tested**. A screenshot or passing local test named after the scenario does not authenticate that the native browser ran the specified interaction. `pilah_verify(operation="assess")` explicitly returns `completion.fully_verified:false` for ordinary reports. These structural inspectors remain separate from independently signed release assessment and the full STOCKROOM external acceptance tracked in issue #15.
@@ -0,0 +1,13 @@
1
+ # Primary sources (reviewed 16 November 2026)
2
+
3
+ - Google Antigravity, Build Plugins: https://antigravity.google/docs/build-plugins/
4
+ - Google Antigravity, MCP: https://antigravity.google/docs/mcp/
5
+ - Google Antigravity, Hooks: https://antigravity.google/docs/hooks
6
+ - Google Antigravity, IDE Browser: https://antigravity.google/docs/ide/browser/
7
+ - Google Antigravity, Permissions: https://antigravity.google/docs/permissions/
8
+ - Google SRE, Effective Troubleshooting: https://sre.google/sre-book/effective-troubleshooting/
9
+ - Lauren Tan, pstack: https://github.com/cursor/plugins/tree/main/pstack
10
+
11
+ Source-derived decisions: the plugin manifest fields and `mcp_config.json` name, `${PLUGIN_ROOT}`/`PLUGIN_DATA`, `agy plugin validate`, Node-based local stdio MCP, and lazy-loaded tool definitions. PILAH's graph algorithm, security controls, data schema and evidence model are **original design decisions**, not features claimed to be natively provided by Google.
12
+
13
+ **Provenance note:** This list records external research sources reviewed at the date in the heading; links, API terms, release availability and entitlement rules may change. It does **not** mean external code, plugins, agents or MCP servers were installed. The source of truth for current PILAH behavior is [the local executable contract](CONTRACTS.md), the [architecture](ARCHITECTURE.md) and CI evidence. External Antigravity integration remains unverified for this candidate.
@@ -0,0 +1,71 @@
1
+ # Token measurement and A/B protocol
2
+
3
+ ## Past and current conversations
4
+
5
+ `pilah tokens` now scans available `~/.gemini/antigravity*/brain/<conversation-id>/.system_generated/logs/transcript.jsonl` entries, including sessions from before PILAH existed. It reports each conversation's recent completed model-step counters and totals recorded locally. Model-step counters may not match official usage accounting; two interpretations (cache included/excluded from input) are displayed, **never treated as a confirmed bill**. Imported official CLI JSON supersedes the same conversation's local counters instead of being added twice.
6
+
7
+ The report itself includes a size estimate for its printed response; **printing it in a terminal makes no Gemini model call**. When the agent reads the report, a subsequent completed model turn is needed before that consumption can appear in Antigravity's logs.
8
+
9
+ For performance, `pilah_context(action="tokens")` defaults to the latest available conversation; specify `history_scope="all"` explicitly to include other conversations. Historical scanning is local and read-only; model prompts are parsed only for usage metadata, not stored anew.
10
+
11
+ For explanation of coverage, privacy, limits and accuracy, see [CONVERSATION_USAGE.md](CONVERSATION_USAGE.md).
12
+
13
+ ## What PILAH can and cannot measure
14
+
15
+ **Without a provider usage record:** `pilah tokens` reports only an **estimated workspace source inventory** and **estimated tool payload sizes**. These numbers are **not** consumed context, billable tokens, savings, or the Gemini context window. Net savings, percentages, and USD estimates are intentionally `null`. Existing legacy telemetry rows cannot retroactively prove savings.
16
+
17
+ **With official Antigravity CLI usage:** `agy --output-format json` provides a run-level `usage` object; `stream-json` provides it in the final `event: result`. PILAH validates and displays the official `total_tokens` without summing cache-read or thinking tokens a second time.
18
+
19
+ ```bash
20
+ # Only runs a new headless Antigravity task; it does NOT measure an existing IDE conversation.
21
+ agy -p "Explain this module without changing files" --output-format json > agy-result.json
22
+
23
+ # Show the official usage for that completed run plus the separate workspace inventory.
24
+ node scripts/pilah.mjs tokens . --usage-file agy-result.json
25
+ ```
26
+
27
+ The imported file may contain conversation content. Keep it local and private; do not commit it. Files over 4 MiB and inconsistent usage totals are rejected. PILAH does not automatically read arbitrary other conversations.
28
+
29
+ ## Source of truth
30
+
31
+ Google's [official CLI headless documentation](https://antigravity.google/docs/cli/headless/) defines the `usage` object. For its example, `input_tokens=10,418`, `output_tokens=589`, and `total_tokens=11,007`. `thinking_tokens=551` and `cache_read_tokens=8,113` are reported fields; neither is separately added to `total_tokens`.
32
+
33
+ Source inventory is estimated from UTF-8 file sizes, not from the live Gemini tokenizer. PILAH cannot directly inspect a model's private context or billing records.
34
+
35
+ ## Controlled A/B procedure
36
+
37
+ 1. Choose at least five tasks with measurable acceptance criteria: trivial edit, regression fix, multi-module change, security fix, and verification/report task.
38
+ 2. Pin repository snapshot, model, Antigravity version, instruction effort, permissions, OS and prompt. Use fresh sessions to prevent prior turns from leaking into the comparison.
39
+ 3. Run from equivalent snapshots in each mode: **Native** (plugin disabled), **On-Demand**, and **Always-On**. Randomize order and repeat each variant multiple times.
40
+ 4. Capture the official CLI JSON result for every run. Use `usage.total_tokens` consistently as the per-run reported metric; separately report `cache_read_tokens`, `thinking_tokens`, `duration_seconds`, number of turns, tool calls and retries.
41
+ 5. Record acceptance-test outcome, regression count and human-review errors. A lower token total with broken behavior is not an improvement.
42
+ 6. Report median and spread by task type. Keep sources/configuration reproducible, and never confuse tool payload counters with provider usage.
43
+
44
+ For matched runs, define `net_difference_pct = 100 * (total_tokens_PILAH - total_tokens_native)/total_tokens_native`. Positive values mean more reported tokens; negative values mean fewer. PILAH cannot calculate this without **both** runs.
45
+
46
+ Do not publish token-savings percentages, cache savings, or 0% false-positive completion until independently verified end-to-end.
47
+
48
+ ## Behavioral-audit interpretation (18 November 2026)
49
+
50
+ The private Antigravity history showed repeated reads of the same path in a session, but these reads may be justified after edits. The value **does not measure wasted tokens** or establish net PILAH savings. Checkpoint/acceptance changes from PR #36 are intended to reduce repeated, ungrounded exploration and overclaims, but the effect requires actual matched A/B experiments, not documentation or microbenchmarks. The release blocker remains #15.
51
+
52
+ ## Low-token skill and MCP budgets — 19 November 2026
53
+
54
+ Issue #44 addresses unnecessary instruction/context overhead on the `v2.0.1` development branch. The policy is **zero calls for trivial work; normally one targeted query OR bounded impact summary**; subsequent calls require new uncertainty or actual machine evidence. The skill no longer carries repeated CLI lists, chronological security incidents or release history.
55
+
56
+ | Static text surface | Before | Revised | Scope |
57
+ | --- | ---: | ---: | --- |
58
+ | `skills/pilah/SKILL.md` | 5,658 characters | 2,792 characters | **51%** less text if the complete skill is loaded |
59
+ | `rules/AGENTS.md` | 382 | 241 characters | Tiny permanent instruction |
60
+ | Always-On `SessionStart` message | 622 | 324 characters | Injected only when opt-in; zero on default On-Demand |
61
+
62
+ **Combined static character footprint:** 6,662 → 3,357 (**49.6% lower**), equivalent to roughly 1,753 → 883 local **chars/3.8 estimates**, *not* live Gemini billed tokens or cumulative session usage. Actual injection behavior depends on the installed IDE and which prompt surfaces are loaded. Do not add these numbers to provider usage or call them net savings.
63
+
64
+ **MCP output limits in default Compact (new installations):**
65
+
66
+ - `pilah_context(action="skeleton")`: 4,800 total skeleton characters; max 1,600 per file; up to six file previews, remaining entries marked `skipped: true`. Keep source revision, omitted/truncated counts and `estimated_preview_only`.
67
+ - `pilah_context(action="query",limit=5)`: prefer an exact symbol. In Compact, at most twelve relation rows. If clipped, `relations_truncated:true` and `relations_before_compaction` describe **the retrieved query response**, not the entire graph.
68
+ - `pilah_impact(summary=true)`: bounded eight affected paths and five related tests with risk, coverage and uncertainty preserved. This pre-existing summary remains the preferred impact call.
69
+ - Full outputs remain available via **explicit** `node scripts/pilah.mjs compact off`; existing explicit settings are preserved. Do not infer correctness from truncated previews.
70
+
71
+ **Quality gates:** automated tests enforce character budgets, default On-Demand injection neutrality, default Compact behavior, skeleton omission disclosure, relation trimming and non-fabricated token estimates. These tests measure **local output sizes only**. To prove usage benefit, run matched Native vs PILAH model/effort/tasks with official provider usage and independent acceptance; F01–F18 and real installed Antigravity validation remain in issue #15.
@@ -0,0 +1,15 @@
1
+ # Token history: provenance and worker overlap (#5)
2
+
3
+ PILAH reports available Antigravity conversation usage including pre-install history. The report now includes `usage_accounting` for explicit source priority, excluded/included workers, missing records, attributable PILAH token *unknowns*, and unsupported weekly quota measurements.
4
+
5
+ **Do not sum parent and worker counters** when `--include-subagents` is requested: a parent result may already contain delegated usage. The optional view shows additional conversations for inspection, not a provider-confirmed combined bill. `detected plugin-call count` is a count of recognized tool calls, not an exact measure of model tokens caused by PILAH.
6
+
7
+ Official CLI `usage.total_tokens` already equals `input_tokens + output_tokens`; cache-read and thinking are separate diagnostics, not values added to official totals. Local transcript counters have undocumented semantics. No automatic collection, publication or background scanning is introduced.
8
+
9
+ Official source: https://antigravity.google/docs/cli/headless/ ; quota limitations: https://antigravity.google/docs/plans . See also `docs/CONVERSATION_USAGE.md`.
10
+
11
+ The future benchmark must validate worker inclusion and exact plugin overhead against independent provider instrumentation where available; a zero or invented savings percentage is not acceptable.
12
+
13
+ ## Current developer status
14
+
15
+ The PR #36 behavioral work added recovery and evidence scopes but **did not** add a provider usage API or promise token savings. Local MCP/SQLite E2E is not a controlled Native/PILAH model-token benchmark. See open acceptance.
@@ -0,0 +1,66 @@
1
+ > **Historical implementation record:** Naming is standardized to PILAH for current documentation; the recorded branch, test results and decisions remain historical rather than claims about present release readiness.
2
+
3
+ # v2.0.1 Integration Traceability and Promotion Gate
4
+
5
+ > **State:** Integrated into `v2.0.1` only; **NOT released**, not benchmark-validated, not merged into `main`.
6
+
7
+ ## Source and immutable baseline
8
+
9
+ - Repository: the existing repository.
10
+ - Previous baseline: `main` at `b622110d0feabf469390a41f3c93338053b3c7b6`. Preserve it for the benchmark.
11
+ - Version branch: `v2.0.1`.
12
+ - Combined source integration: PR #29, **merged to `v2.0.1` only**.
13
+ - Integration merge commit: `049a5297fbd4c542918f4a23e9676d5e2b0530ce`.
14
+ - Both `package.json` and `plugin.json` declare `2.0.1`. No npm publication, GitHub release, or release tag is implied.
15
+ - Historical cross-platform CI after the 12 original feature merges at `1da0c8ff5ecec83a1000e8e57cbeb941fcdc870e` (not the current candidate head): GitHub Actions run #44248690103. GitHub Actions tested Ubuntu Node 22/24, Windows Node 22, macOS Node 22.
16
+ - All feature PRs #16–#27 are now **individually Merged into `v2.0.1`**, after their implementation was reconciled and integrated by PR #29. Conflicting feature branches were recorded using Git two-parent merge commits retaining the reviewed combined tree (`83dfa3a653056595b31032584079f613a0b8ec6e`), so there were **no duplicate code changes**. Implementation issues #3–#14 are closed; independent validation remains open in #15.
17
+
18
+ ## Original PR → integration traceability
19
+
20
+ | Issue | Original PR (Merged to v2.0.1) | Scope incorporated into PR #29 |
21
+ | --- | --- | --- |
22
+ | #3 | #16 | Reproducible A/B evaluator, conservative official usage and repeated-run checks |
23
+ | #4 | #17 | Signed independent acceptance gate, user-pinned frozen acceptance registry |
24
+ | #5 | #18 | Historical token provenance and worker overlap limitations |
25
+ | #6 | #19 | Privacy-safe MCP error diagnostics and authorization recovery |
26
+ | #7 | #20 | Static impact coverage uncertainty and bounded test candidates |
27
+ | #8 | #21 | Semantic negative controls, browser evidence, 18-case STOCKROOM acceptance **specification** |
28
+ | #9 | #22 | Interrupted run and verification checkpoint recovery |
29
+ | #10 | #23 | Risk-driven financial, inventory, authorization, offline verification prompts |
30
+ | #11 | #24 | Native Teamwork/Swarm/subagent advisor requiring user consent |
31
+ | #12 | #25 | Observable agent trace comparison and independent decision-review metadata |
32
+ | #13 | #26 | PILAH intervention ledger without causal claims |
33
+ | #14 | #27 | Opt-in, privacy-limited benchmark report export |
34
+
35
+ **Important integration detail:** #17, #21 and #24 modified `src/engine.mjs`, `src/tools.mjs`, and generated MCP schemas; #17 and #23 modified `src/verification.mjs`. Their handlers/contracts were manually reconciled into PR #29 and validated together. Therefore, the source of truth for the combined version is **the `v2.0.1` branch**, not any individual PR head.
36
+
37
+ ## Promotion requirements: v2.0.1 → main
38
+
39
+ All conditions below must be independently verified before preparing the final pull request:
40
+
41
+ - [ ] All 18 frozen STOCKROOM scenarios (F01–F18) executed against isolated *running applications* with real HTTP/browser/backend/database assertions. The checked-in scenario JSON is a specification, not passing evidence.
42
+ - [ ] Separate evaluator-controlled scenario registry, pinned signing keys, artifact provenance and build/source freshness verified; unauthorized or missing evidence fails closed.
43
+ - [ ] Real Antigravity installation and MCP smoke tests completed using the `v2.0.1` branch, with workspace permissions and browser behavior confirmed.
44
+ - [ ] Controlled A/B benchmark completed against frozen `main` and Native using comparable models, prompts, environments, repeated runs, official usage where available, and independent acceptance results.
45
+ - [ ] Privacy and negative-control review completed; no high-severity regression remains.
46
+ - [ ] Final `v2.0.1` commit passes combined CI and release contract checks.
47
+ - [ ] **Explicit human approval** to promote the version branch to `main`.
48
+
49
+ Only after those gates pass, **create one PR with base `main` and head `v2.0.1`**. Do not merge, tag, publish to npm, or create a GitHub Release automatically. The twelve original feature PRs have already been individually merged to `v2.0.1`; implementation issues #3–#14 are closed with unverified external acceptance consolidated into open tracking issue #15. Do not merge these features again.
50
+
51
+ See [Release Engineering](./RELEASE.md) and [Independent Acceptance Runbook](./INDEPENDENT_ACCEPTANCE_RUNBOOK.md).
52
+
53
+ ## Current decision
54
+
55
+ **Feature integration: all 12 original feature PRs and behavioral PR #36 merged into `v2.0.1`.** **Cross-platform CI: passed at the current documented behavioral merge commit.** **Independent live acceptance/benchmark: not completed.** **Promotion to main: blocked until approval and evidence.**
56
+
57
+ ## Behavioral reliability merge and latest audited implementation (18 November 2026)
58
+
59
+ - Behavioral audit implementation: PR #36 **merged into `v2.0.1`**, squash commit `67ea5888caf61751952c8a7daa1eb222d738d4b6`.
60
+ - Six code-level issues **closed**: #30 truthful completion and structured criteria; #31 UI state and Figma/browser acceptance; #32 tool recovery; #33 source-fresh decision checkpoints; #34 independent-file-ownership teamwork; #35 private transcript hygiene and MCP E2E.
61
+ - Post-merge Actions run 44325007116: **success 4/4** (Ubuntu Node 22/24, macOS Node 22, Windows Node 22); Ubuntu Node 22: **213/213 passed**.
62
+ - Exactly four public MCP tools remain; Node runtime package dependencies unchanged. Two branches remained after merge: `main` and `v2.0.1`.
63
+ - `main` baseline at the time of this audit: `b622110d0feabf469390a41f3c93338053b3c7b6`. **No promotion, tag, npm candidate publish, or GitHub Release.**
64
+ - Closing implementation issues is **not** the same as independent acceptance. #15 remains the sole external release blocker: native installed Antigravity, frozen real F01–F18, repeated benchmark, independent signing and explicit release approval.
65
+
66
+ See [behavioral Five Whys](BEHAVIORAL_5_WHYS_V2_0_1.md), [current contracts](CONTRACTS.md), [docs index](README.md).
package/hooks.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "pilah-session-telemetry": {
3
+ "SessionStart": [
4
+ {
5
+ "type": "command",
6
+ "command": "node ./scripts/hook.mjs",
7
+ "timeout": 5
8
+ }
9
+ ],
10
+ "PostToolUse": [
11
+ {
12
+ "matcher": "run_command",
13
+ "hooks": [
14
+ {
15
+ "type": "command",
16
+ "command": "node ./scripts/hook.mjs",
17
+ "timeout": 5
18
+ }
19
+ ]
20
+ },
21
+ {
22
+ "matcher": "write_file|edit_file|write_to_file|replace_file_content|multi_replace_file_content",
23
+ "hooks": [
24
+ {
25
+ "type": "command",
26
+ "command": "node ./scripts/hook.mjs",
27
+ "timeout": 5
28
+ }
29
+ ]
30
+ }
31
+ ],
32
+ "PreToolUse": [
33
+ {
34
+ "matcher": "run_command",
35
+ "hooks": [
36
+ {
37
+ "type": "command",
38
+ "command": "node ./scripts/hook.mjs",
39
+ "timeout": 5
40
+ }
41
+ ]
42
+ }
43
+ ]
44
+ }
45
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "mcpServers": {
3
+ "pilah": {
4
+ "command": "node",
5
+ "args": [
6
+ "${PLUGIN_ROOT}/src/mcp.mjs"
7
+ ],
8
+ "timeoutSeconds": 90,
9
+ "tools": {
10
+ "pilah_context": {
11
+ "eager": true
12
+ }
13
+ }
14
+ }
15
+ }
16
+ }
package/package.json CHANGED
@@ -1,6 +1,33 @@
1
1
  {
2
2
  "name": "@aliip/pilah",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.1",
4
+ "description": "PILAH (Project Intelligence, Logic, Analysis & Handoffs): native-first engineering context, minimal-change guidance and evidence-scoped verification for Google Antigravity.",
5
+ "type": "module",
6
+ "main": "src/engine.mjs",
7
+ "bin": {
8
+ "pilah": "scripts/pilah.mjs",
9
+ "a2a": "scripts/a2a.mjs"
10
+ },
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/alifakbxr/pilah.git"
17
+ },
18
+ "bugs": {
19
+ "url": "https://github.com/alifakbxr/pilah/issues"
20
+ },
21
+ "homepage": "https://github.com/alifakbxr/pilah#readme",
22
+ "license": "MIT",
23
+ "engines": {
24
+ "node": ">=22.13.0"
25
+ },
26
+ "scripts": {
27
+ "test": "node --test tests/*.test.mjs",
28
+ "check": "npm run syntax && npm test",
29
+ "selftest": "node scripts/pilah.mjs doctor",
30
+ "benchmark": "node benchmarks/bench.mjs",
31
+ "syntax": "node scripts/check-syntax.mjs"
32
+ }
33
+ }
package/plugin.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "$schema": "https://antigravity.google/schemas/v1/plugin.json",
3
+ "name": "pilah",
4
+ "displayName": "PILAH",
5
+ "version": "1.0.1",
6
+ "description": "PILAH (Project Intelligence, Logic, Analysis & Handoffs): native-first engineering context, minimal-change guidance and evidence-scoped verification for Google Antigravity.",
7
+ "logo": "assets/logo.svg",
8
+ "author": {
9
+ "name": "Alif Akbar"
10
+ },
11
+ "license": "MIT",
12
+ "repository": "https://github.com/alifakbxr/pilah",
13
+ "keywords": [
14
+ "pilah",
15
+ "engineering",
16
+ "native-first",
17
+ "minimal-code",
18
+ "verification",
19
+ "context",
20
+ "token-awareness"
21
+ ],
22
+ "suggestedPrompts": [
23
+ "/pilah - Native-first code intelligence and minimal-change workflow",
24
+ "Ask PILAH for a scoped impact analysis before a risky edit",
25
+ "Review a fix using an evidence-based test plan"
26
+ ]
27
+ }
@@ -0,0 +1,2 @@
1
+ # PILAH
2
+ Native first: zero calls for clear tasks. Reuse code and platform primitives. For unclear cross-file risk, one scoped MCP call. Reproduce, test, simplify. Preserve security and compatibility. No automatic agents, compaction or token claims.
@@ -0,0 +1,84 @@
1
+ -- A2A database schema v1; runtime applies idempotently.
2
+ CREATE TABLE IF NOT EXISTS meta (key TEXT PRIMARY KEY, value TEXT NOT NULL);
3
+ CREATE TABLE IF NOT EXISTS workspaces (id TEXT PRIMARY KEY, canonical_path TEXT UNIQUE NOT NULL, created_at TEXT NOT NULL, current_revision_id TEXT);
4
+ CREATE TABLE IF NOT EXISTS revisions (id TEXT PRIMARY KEY, workspace_id TEXT NOT NULL, git_head TEXT, snapshot_sha TEXT NOT NULL, environment_json TEXT NOT NULL DEFAULT '{}', created_at TEXT NOT NULL, FOREIGN KEY(workspace_id) REFERENCES workspaces(id));
5
+ CREATE INDEX IF NOT EXISTS revisions_by_ws ON revisions(workspace_id,created_at DESC);
6
+ CREATE TABLE IF NOT EXISTS files (workspace_id TEXT NOT NULL, path TEXT NOT NULL, content_sha TEXT NOT NULL, language TEXT, bytes INTEGER NOT NULL, revision_id TEXT NOT NULL, mtime_ms REAL, PRIMARY KEY(workspace_id,path));
7
+ CREATE TABLE IF NOT EXISTS nodes (workspace_id TEXT NOT NULL, id TEXT NOT NULL, kind TEXT NOT NULL, label TEXT NOT NULL, file_path TEXT, line INTEGER, basis TEXT NOT NULL DEFAULT 'source', revision_id TEXT NOT NULL, PRIMARY KEY(workspace_id,id));
8
+ CREATE INDEX IF NOT EXISTS nodes_search ON nodes(workspace_id,label);
9
+ CREATE TABLE IF NOT EXISTS edges (workspace_id TEXT NOT NULL, id TEXT NOT NULL, source TEXT NOT NULL, target TEXT NOT NULL, kind TEXT NOT NULL, basis TEXT NOT NULL, state TEXT NOT NULL, source_file TEXT, revision_id TEXT NOT NULL, PRIMARY KEY(workspace_id,id));
10
+ CREATE INDEX IF NOT EXISTS edges_source ON edges(workspace_id,source);
11
+ CREATE INDEX IF NOT EXISTS edges_target ON edges(workspace_id,target);
12
+ CREATE TABLE IF NOT EXISTS evidence (id TEXT PRIMARY KEY, workspace_id TEXT NOT NULL, revision_id TEXT NOT NULL, criterion_id TEXT NOT NULL, status TEXT NOT NULL CHECK(status IN ('passed','failed','blocked','inconclusive')), evidence_type TEXT NOT NULL, artifact_path TEXT NOT NULL, artifact_sha TEXT NOT NULL, metadata_json TEXT NOT NULL, created_at TEXT NOT NULL);
13
+ CREATE INDEX IF NOT EXISTS evidence_lookup ON evidence(workspace_id,criterion_id,created_at DESC);
14
+ CREATE TABLE IF NOT EXISTS runs (id TEXT PRIMARY KEY, workspace_id TEXT NOT NULL, revision_id TEXT NOT NULL, verdict TEXT NOT NULL, criteria_json TEXT NOT NULL, created_at TEXT NOT NULL);
15
+ CREATE TABLE IF NOT EXISTS incidents (id TEXT PRIMARY KEY, workspace_id TEXT NOT NULL, title TEXT NOT NULL, root_cause TEXT NOT NULL, state TEXT NOT NULL, revision_id TEXT NOT NULL, related_paths_json TEXT NOT NULL, criteria_json TEXT NOT NULL, evidence_ids_json TEXT NOT NULL, created_at TEXT NOT NULL, signature_sha TEXT);
16
+ CREATE INDEX IF NOT EXISTS incidents_lookup ON incidents(workspace_id,created_at DESC);
17
+ CREATE INDEX IF NOT EXISTS incidents_signature ON incidents(workspace_id,signature_sha,created_at DESC);
18
+ CREATE TABLE IF NOT EXISTS hypotheses (id TEXT PRIMARY KEY, workspace_id TEXT NOT NULL, incident_id TEXT, description TEXT NOT NULL, status TEXT NOT NULL, experiment TEXT, evidence_ids_json TEXT NOT NULL, created_at TEXT NOT NULL, revision_id TEXT, parent_hypothesis_id TEXT, why_depth INTEGER NOT NULL DEFAULT 1, predicted_observation TEXT, disconfirming_test TEXT, expected_criterion_id TEXT, plan_id TEXT, assessment_json TEXT NOT NULL DEFAULT '{}', assessed_revision_id TEXT, updated_at TEXT);
19
+ CREATE INDEX IF NOT EXISTS hypotheses_incident ON hypotheses(workspace_id,incident_id,created_at DESC);
20
+ -- Append-only local experimental interpretations. Never independent causal proof.
21
+ CREATE TABLE IF NOT EXISTS rca_experiments (
22
+ id TEXT PRIMARY KEY,
23
+ workspace_id TEXT NOT NULL,
24
+ hypothesis_id TEXT NOT NULL,
25
+ revision_id TEXT NOT NULL,
26
+ outcome TEXT NOT NULL,
27
+ observation TEXT NOT NULL,
28
+ criterion_id TEXT NOT NULL,
29
+ evidence_ids_json TEXT NOT NULL,
30
+ created_at TEXT NOT NULL
31
+ );
32
+ CREATE INDEX IF NOT EXISTS rca_experiments_history ON rca_experiments(workspace_id,hypothesis_id,created_at DESC);
33
+ CREATE TABLE IF NOT EXISTS telemetry (workspace_id TEXT NOT NULL, tool_name TEXT NOT NULL, action TEXT NOT NULL, raw_scope_tokens INTEGER NOT NULL DEFAULT 0, response_tokens INTEGER NOT NULL DEFAULT 0, tokens_saved INTEGER NOT NULL DEFAULT 0, created_at TEXT NOT NULL);
34
+ CREATE INDEX IF NOT EXISTS telemetry_by_ws ON telemetry(workspace_id,created_at DESC);
35
+ CREATE TABLE IF NOT EXISTS side_questions (id TEXT PRIMARY KEY, workspace_id TEXT, conversation_id TEXT NOT NULL, parent_conversation_id TEXT, title TEXT, question TEXT NOT NULL, summary TEXT, status TEXT NOT NULL DEFAULT 'resolved', transcript_path TEXT, metadata_json TEXT NOT NULL DEFAULT '{}', created_at TEXT NOT NULL, updated_at TEXT NOT NULL);
36
+ CREATE INDEX IF NOT EXISTS side_q_conv ON side_questions(conversation_id);
37
+ CREATE INDEX IF NOT EXISTS side_q_parent ON side_questions(parent_conversation_id);
38
+ CREATE INDEX IF NOT EXISTS side_q_ws ON side_questions(workspace_id);
39
+ CREATE TABLE IF NOT EXISTS artifact_versions (id TEXT PRIMARY KEY, workspace_id TEXT, conversation_id TEXT NOT NULL, artifact_name TEXT NOT NULL, version_number INTEGER NOT NULL, content_sha TEXT NOT NULL, content TEXT NOT NULL, diff_from_previous TEXT, created_at TEXT NOT NULL);
40
+ CREATE INDEX IF NOT EXISTS artifact_v_lookup ON artifact_versions(conversation_id, artifact_name, version_number DESC);
41
+ CREATE INDEX IF NOT EXISTS artifact_v_conv ON artifact_versions(conversation_id);
42
+ CREATE INDEX IF NOT EXISTS artifact_v_ws ON artifact_versions(workspace_id);
43
+
44
+
45
+ -- A2A model recovery: only sanitized model/category metadata, never raw errors.
46
+ CREATE TABLE IF NOT EXISTS model_recovery_state (
47
+ workspace_id TEXT NOT NULL,
48
+ conversation_id TEXT NOT NULL,
49
+ model_name TEXT,
50
+ incident_category TEXT,
51
+ incident_confidence TEXT,
52
+ incident_at TEXT,
53
+ notice_signature TEXT,
54
+ updated_at TEXT NOT NULL,
55
+ PRIMARY KEY(workspace_id, conversation_id)
56
+ );
57
+ CREATE INDEX IF NOT EXISTS model_recovery_recent ON model_recovery_state(workspace_id,updated_at DESC);
58
+ -- Checkpoints are explicit opt-in summaries, not automatic transcript copies.
59
+ CREATE TABLE IF NOT EXISTS recovery_checkpoints (
60
+ workspace_id TEXT NOT NULL,
61
+ conversation_id TEXT NOT NULL,
62
+ revision_id TEXT,
63
+ task_summary TEXT NOT NULL,
64
+ completed_json TEXT NOT NULL,
65
+ next_steps_json TEXT NOT NULL,
66
+ decisions_json TEXT NOT NULL DEFAULT '[]',
67
+ pending_tests_json TEXT NOT NULL DEFAULT '[]',
68
+ created_at TEXT NOT NULL,
69
+ updated_at TEXT NOT NULL,
70
+ PRIMARY KEY(workspace_id, conversation_id)
71
+ );
72
+ CREATE INDEX IF NOT EXISTS recovery_recent ON recovery_checkpoints(workspace_id,updated_at DESC);
73
+
74
+ -- Explicit opt-in, revision-bound acceptance plan scope for subsequent assess calls.
75
+ CREATE TABLE IF NOT EXISTS acceptance_plans (
76
+ id TEXT PRIMARY KEY,
77
+ workspace_id TEXT NOT NULL,
78
+ revision_id TEXT NOT NULL,
79
+ manifest_sha TEXT NOT NULL,
80
+ criteria_json TEXT NOT NULL,
81
+ created_at TEXT NOT NULL,
82
+ FOREIGN KEY(workspace_id) REFERENCES workspaces(id)
83
+ );
84
+ CREATE INDEX IF NOT EXISTS acceptance_plans_recent ON acceptance_plans(workspace_id,created_at DESC);