agy-context-saver 1.7.0 → 1.8.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.
- package/CHANGELOG.md +33 -0
- package/README.md +33 -34
- package/mcp/index.js +135 -249
- package/mcp/instructions.md +8 -6
- package/package.json +2 -3
- package/plugin.json +3 -3
- package/rules/AGENTS.md +16 -20
- package/scripts/execution-guard-hook.mjs +104 -14
- package/scripts/install-register.mjs +30 -76
- package/scripts/provision-rtk.mjs +66 -0
- package/scripts/state-dir.mjs +51 -0
- package/skills/context-governance/SKILL.md +26 -32
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
name: context-governance
|
|
3
3
|
description: >-
|
|
4
4
|
Use when running shell commands with large outputs, inspecting session transcript health,
|
|
5
|
-
preventing repetitive background polling loops, inspecting codebases with RTK
|
|
5
|
+
preventing repetitive background polling loops, or inspecting codebases with RTK.
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Context Governance & Execution Guard (Agy-Context-Saver + RTK)
|
|
9
9
|
|
|
10
|
-
Agy-Context-Saver and RTK protect session transcript health and LLM attention by transparently compressing command outputs, preventing repetitive background polling loops, routing native inspection to compact CLI interfaces
|
|
10
|
+
Agy-Context-Saver and RTK protect session transcript health and LLM attention by transparently compressing command outputs, preventing repetitive background polling loops, and routing native inspection to compact CLI interfaces.
|
|
11
11
|
|
|
12
12
|
## Architectural Boundaries
|
|
13
13
|
|
|
@@ -16,20 +16,24 @@ Agy-Context-Saver and RTK protect session transcript health and LLM attention by
|
|
|
16
16
|
|
|
17
17
|
---
|
|
18
18
|
|
|
19
|
-
## Codebase
|
|
19
|
+
## Unified 3-Tier Codebase & File Inspection
|
|
20
20
|
|
|
21
21
|
Unbounded full-file `view_file` calls and unoptimized search tools (`grep_search`, `find_by_name`, `list_dir`) bypass token compression and are guarded:
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
- `
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
- `rtk
|
|
32
|
-
-
|
|
23
|
+
1. **Tier 1 — Structural Discovery (`waymark_ask` with `plain: true`)**:
|
|
24
|
+
- Locate exact `[StartLine, EndLine]` coordinates via `waymark_ask(..., plain: true)` across all 23 supported formats (code ASTs + `markdown`, `yaml`, `json`, `toml`, `bash`). Always set `plain: true` (~19–466 tokens, zero shell quoting or stdin hazards).
|
|
25
|
+
2. **Tier 2 — Precision Workspace File Reading (`view_file` Hybrid Slice Policy)**:
|
|
26
|
+
- Pass `StartLine` and `EndLine` from `waymark_ask` into `view_file` (bounded slices of `1–150` lines) to preserve exact 1-indexed line numbers for `replace_file_content` without terminal stdout truncation. Partial slices of `151–800` lines are denied; an explicit one-pass full-file audit (`StartLine: 1, EndLine: <TotalLines>`) is permitted only when the file on disk is $\le 800$ lines and $\le 45\text{ KiB}$ (`46,080` bytes).
|
|
27
|
+
3. **Tier 3 — RTK Boundaries (`rtk read`, `rtk find`, `rtk rg`, `rtk err`, `rtk summary`)**:
|
|
28
|
+
- **Spillovers & Task Logs**: Read `.system_generated/steps/<step>/output.txt` spillovers and completed `tasks/<taskId>.log` files via `rtk read <path>` (`--head-lines` / `--tail-lines`). Never use `rtk read -l minimal|aggressive` or `-m` to derive line numbers for edits.
|
|
29
|
+
- **Directory / File Discovery**:
|
|
30
|
+
- **Windows**: Use `rtk find <path>` or PowerShell `dir` / `Get-ChildItem`. (Avoid `rtk ls` or `rtk tree` on Windows as they rely on POSIX binaries/flags).
|
|
31
|
+
- **POSIX / Linux / macOS**: Use `rtk find <path>`, `rtk ls <path>`, or `rtk tree`.
|
|
32
|
+
- **Prose / Regex Search (when symbol, heading, or config key is unknown)**:
|
|
33
|
+
- **Windows**: Use `rtk rg "<pattern>" .` (explicit target `.` is required to avoid child process stdin pipe stalls) or `rg "<pattern>" .`.
|
|
34
|
+
- **POSIX / Linux / macOS**: Use `rtk grep "<pattern>"` or `rtk rg "<pattern>"`.
|
|
35
|
+
- `rtk err <cmd>`: Runs command and displays only errors/warnings.
|
|
36
|
+
- `rtk summary <cmd>`: Runs command and produces a 2-line technical summary.
|
|
33
37
|
|
|
34
38
|
*Safe Harbor*: Documented Antigravity special files (`SKILL.md`, brain artifacts, `.gemini/config/`) may be viewed directly via `view_file` without slice bounds.
|
|
35
39
|
|
|
@@ -42,35 +46,26 @@ Performs streaming inspection of `transcript.jsonl` to calculate turn budgets, s
|
|
|
42
46
|
- **Parameters**:
|
|
43
47
|
- `transcriptPath` (string, required): Absolute path to `transcript.jsonl`.
|
|
44
48
|
|
|
45
|
-
### 2. `
|
|
46
|
-
Generates a strictly formatted, scope-isolated prompt for delegating research or debugging to a subagent (`invoke_subagent`). Enforces the **Pointer-Over-Wire (POW)** protocol: deliverables exceeding 1 KB must be written to workspace scratch files (e.g. `scratch/<task>_findings.md`), transmitting only an executive summary, scoreboard, and clickable `file:///` link in-band.
|
|
47
|
-
- **Parameters**:
|
|
48
|
-
- `objective` (string, required): Core investigative or implementation goal.
|
|
49
|
-
- `role` (string, optional): Subagent role / title.
|
|
50
|
-
- `scopeFiles` (array of strings, optional): Specific file targets.
|
|
51
|
-
- `expectedDeliverable` (string, optional): Expected concise synthesis format.
|
|
52
|
-
- `subagents` (array, optional): Batch of subagent objects for multi-role delegation.
|
|
53
|
-
|
|
54
|
-
### 3. `read_transcript`
|
|
49
|
+
### 2. `read_transcript`
|
|
55
50
|
Quickly reads recent conversation turns from an Antigravity transcript in clean Markdown format with zero JSON noise.
|
|
56
51
|
- **Parameters**:
|
|
57
52
|
- `conversationId` (string, required): Conversation UUID or path.
|
|
58
53
|
- `mode` (string, default: "compact"): "compact" or "full".
|
|
59
54
|
- `lastTurns` (number, default: 3): Number of turns to display.
|
|
60
55
|
|
|
61
|
-
###
|
|
56
|
+
### 3. `query_transcript`
|
|
62
57
|
Granular query and forensic filtering engine for transcripts with keyword/regex search, auto-dereferencing of truncated payloads, and surgical step projection.
|
|
63
58
|
- **Parameters**:
|
|
64
59
|
- `conversationId` (string, required): Conversation UUID or path.
|
|
65
60
|
- `query` (string, optional): Search keyword or regex.
|
|
66
|
-
- `roles` (array, default: ["user", "assistant"]): Filter by role.
|
|
61
|
+
- `roles` (array, default: ["user", "assistant"]): Filter by role (`"user"`, `"assistant"`, `"subagent"`, `"tool"`, `"error"`, `"all"`).
|
|
67
62
|
- `stepIndex` (number, optional): Specific step to dereference from `transcript_full.jsonl`.
|
|
68
63
|
- `field` (string, optional): Field projection (`"content"`, `"thinking"`, `"tool_calls"`).
|
|
69
64
|
|
|
70
|
-
###
|
|
65
|
+
### 4. `get_installation_status`
|
|
71
66
|
Audits the Antigravity integration layers (Native Plugin Link, Lifecycle Hook in `hooks.json`, MCP Server in `mcp_config.json`, Tool Schemas, and RTK binary/hook).
|
|
72
67
|
|
|
73
|
-
###
|
|
68
|
+
### 5. `sync_installation`
|
|
74
69
|
Re-verifies, repairs, and synchronizes the installation and tool schemas in ~25ms.
|
|
75
70
|
- **Parameters**:
|
|
76
71
|
- `checkOnly` (boolean, default: false): Dry-run audit mode.
|
|
@@ -88,13 +83,12 @@ Re-verifies, repairs, and synchronizes the installation and tool schemas in ~25m
|
|
|
88
83
|
|
|
89
84
|
2. **Layer 2: Transparent CLI & Codebase Streamlining**:
|
|
90
85
|
- Shell commands transparently rewrite via RTK (`rtk git`, `rtk pytest`, `rtk cargo`, etc.).
|
|
91
|
-
-
|
|
86
|
+
- Workspace file inspection follows `waymark_ask(..., plain: true)` $\to$ bounded `view_file(StartLine, EndLine)`, while `rtk read` handles step spillovers and completed task logs, and `rtk find` / `rtk rg "<pattern>" .` handle directory and free-text search.
|
|
92
87
|
- Direct access to `.system_generated/` is strictly denied; use `read_transcript` and `query_transcript`.
|
|
88
|
+
- **Log Hygiene (Git CRLF/LF Notice Stripping)**: Repetitive Git line-ending notices (`warning: LF will be replaced by CRLF` / `warning: CRLF will be replaced by LF...`) are non-actionable environment noise. Agy-Context-Saver automatically strips these warning lines across forensic transcript parsers, and agents suppress them at the source (`git -c core.safecrlf=false`) to protect context window tokens.
|
|
93
89
|
|
|
94
|
-
3. **Layer 3:
|
|
90
|
+
3. **Layer 3: Synchronous Execution**:
|
|
95
91
|
- Synchronous wait window expands to 10,000ms to eliminate unnecessary detachment.
|
|
96
|
-
- Heavy exploratory work is delegated to subagents (`invoke_subagent`).
|
|
97
|
-
- Subagents strictly follow Pointer-Over-Wire: write reports $>1\text{ KB}$ to disk; transmit only summary, scoreboard, and clickable file link.
|
|
98
92
|
|
|
99
93
|
---
|
|
100
94
|
|
|
@@ -102,5 +96,5 @@ Re-verifies, repairs, and synchronizes the installation and tool schemas in ~25m
|
|
|
102
96
|
|
|
103
97
|
To verify installation health and run test validation:
|
|
104
98
|
- **Health Check**: `npm run status` (verifies plugin link, hook, MCP config, schemas, RTK).
|
|
105
|
-
- **Test Suite**: `npm test` (runs all
|
|
99
|
+
- **Test Suite**: `npm test` (runs all 10 test suites).
|
|
106
100
|
- Detailed verification playbooks and release steps reside in `docs/publishing.md`.
|