agent-efficiency 1.4.2__tar.gz

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 (92) hide show
  1. agent_efficiency-1.4.2/.claude-plugin/marketplace.json +16 -0
  2. agent_efficiency-1.4.2/.claude-plugin/plugin.json +16 -0
  3. agent_efficiency-1.4.2/.github/workflows/ci.yml +43 -0
  4. agent_efficiency-1.4.2/.github/workflows/release.yml +53 -0
  5. agent_efficiency-1.4.2/.gitignore +12 -0
  6. agent_efficiency-1.4.2/CHANGELOG.md +26 -0
  7. agent_efficiency-1.4.2/LICENSE +21 -0
  8. agent_efficiency-1.4.2/PKG-INFO +267 -0
  9. agent_efficiency-1.4.2/README.md +233 -0
  10. agent_efficiency-1.4.2/SECURITY.md +21 -0
  11. agent_efficiency-1.4.2/agent_efficiency/__init__.py +15 -0
  12. agent_efficiency-1.4.2/agent_efficiency/cli.py +23 -0
  13. agent_efficiency-1.4.2/agent_efficiency/mcp_entry.py +25 -0
  14. agent_efficiency-1.4.2/benchmarks/benchmark_efficiency.py +532 -0
  15. agent_efficiency-1.4.2/benchmarks/eval_llm_ab.py +945 -0
  16. agent_efficiency-1.4.2/docs/assets/audit-doctor-card.svg +53 -0
  17. agent_efficiency-1.4.2/docs/assets/before-after-run.svg +53 -0
  18. agent_efficiency-1.4.2/mcp/server.py +519 -0
  19. agent_efficiency-1.4.2/pyproject.toml +51 -0
  20. agent_efficiency-1.4.2/requirements.txt +7 -0
  21. agent_efficiency-1.4.2/rules/AGENT_RULES.md +9 -0
  22. agent_efficiency-1.4.2/scripts/ae_cli.py +327 -0
  23. agent_efficiency-1.4.2/scripts/ae_init.py +267 -0
  24. agent_efficiency-1.4.2/scripts/ae_manage.py +578 -0
  25. agent_efficiency-1.4.2/scripts/install.py +308 -0
  26. agent_efficiency-1.4.2/scripts/pretool_hook.py +350 -0
  27. agent_efficiency-1.4.2/scripts/render_demo_svg.py +180 -0
  28. agent_efficiency-1.4.2/scripts/setup_hooks.py +330 -0
  29. agent_efficiency-1.4.2/scripts/sync_shared.py +85 -0
  30. agent_efficiency-1.4.2/scripts/validate_skills.py +150 -0
  31. agent_efficiency-1.4.2/shared/_ae_core/__init__.py +90 -0
  32. agent_efficiency-1.4.2/shared/_ae_core/io_lock.py +199 -0
  33. agent_efficiency-1.4.2/shared/_ae_core/savings.py +249 -0
  34. agent_efficiency-1.4.2/shared/_ae_core/security.py +235 -0
  35. agent_efficiency-1.4.2/shared/_ae_core/usage.py +195 -0
  36. agent_efficiency-1.4.2/skills/adaptive-orchestration-handoff/SKILL.md +80 -0
  37. agent_efficiency-1.4.2/skills/adaptive-orchestration-handoff/config/models.json +237 -0
  38. agent_efficiency-1.4.2/skills/adaptive-orchestration-handoff/examples/workflow.md +77 -0
  39. agent_efficiency-1.4.2/skills/adaptive-orchestration-handoff/references/routing-and-escalation.md +63 -0
  40. agent_efficiency-1.4.2/skills/adaptive-orchestration-handoff/references/state-and-handoff.md +84 -0
  41. agent_efficiency-1.4.2/skills/adaptive-orchestration-handoff/scripts/_ae_core/__init__.py +90 -0
  42. agent_efficiency-1.4.2/skills/adaptive-orchestration-handoff/scripts/_ae_core/io_lock.py +199 -0
  43. agent_efficiency-1.4.2/skills/adaptive-orchestration-handoff/scripts/_ae_core/savings.py +249 -0
  44. agent_efficiency-1.4.2/skills/adaptive-orchestration-handoff/scripts/_ae_core/security.py +235 -0
  45. agent_efficiency-1.4.2/skills/adaptive-orchestration-handoff/scripts/_ae_core/usage.py +195 -0
  46. agent_efficiency-1.4.2/skills/adaptive-orchestration-handoff/scripts/agent_state.py +266 -0
  47. agent_efficiency-1.4.2/skills/adaptive-orchestration-handoff/scripts/context_doctor.py +780 -0
  48. agent_efficiency-1.4.2/skills/adaptive-orchestration-handoff/scripts/llm_adapter.py +306 -0
  49. agent_efficiency-1.4.2/skills/adaptive-orchestration-handoff/scripts/route_task.py +496 -0
  50. agent_efficiency-1.4.2/skills/adaptive-orchestration-handoff/scripts/state_ops.py +580 -0
  51. agent_efficiency-1.4.2/skills/adaptive-orchestration-handoff/scripts/state_render.py +428 -0
  52. agent_efficiency-1.4.2/skills/adaptive-orchestration-handoff/scripts/state_store.py +440 -0
  53. agent_efficiency-1.4.2/skills/adaptive-orchestration-handoff/scripts/transcript_audit.py +854 -0
  54. agent_efficiency-1.4.2/skills/local-context-index/SKILL.md +71 -0
  55. agent_efficiency-1.4.2/skills/local-context-index/references/cli-reference.md +112 -0
  56. agent_efficiency-1.4.2/skills/local-context-index/scripts/_ae_core/__init__.py +90 -0
  57. agent_efficiency-1.4.2/skills/local-context-index/scripts/_ae_core/io_lock.py +199 -0
  58. agent_efficiency-1.4.2/skills/local-context-index/scripts/_ae_core/savings.py +249 -0
  59. agent_efficiency-1.4.2/skills/local-context-index/scripts/_ae_core/security.py +235 -0
  60. agent_efficiency-1.4.2/skills/local-context-index/scripts/_ae_core/usage.py +195 -0
  61. agent_efficiency-1.4.2/skills/local-context-index/scripts/compact_run.py +395 -0
  62. agent_efficiency-1.4.2/skills/local-context-index/scripts/context_index.py +341 -0
  63. agent_efficiency-1.4.2/skills/local-context-index/scripts/idx_db.py +393 -0
  64. agent_efficiency-1.4.2/skills/local-context-index/scripts/idx_ignore.py +184 -0
  65. agent_efficiency-1.4.2/skills/local-context-index/scripts/idx_indexer.py +330 -0
  66. agent_efficiency-1.4.2/skills/local-context-index/scripts/idx_lsp.py +213 -0
  67. agent_efficiency-1.4.2/skills/local-context-index/scripts/idx_parsers.py +769 -0
  68. agent_efficiency-1.4.2/skills/local-context-index/scripts/idx_search.py +498 -0
  69. agent_efficiency-1.4.2/skills/local-context-index/scripts/idx_slice.py +610 -0
  70. agent_efficiency-1.4.2/skills/local-context-index/scripts/idx_trace.py +553 -0
  71. agent_efficiency-1.4.2/skills/local-context-index/scripts/idx_workspace.py +219 -0
  72. agent_efficiency-1.4.2/skills/prompt-cache-manager/SKILL.md +52 -0
  73. agent_efficiency-1.4.2/skills/prompt-cache-manager/references/provider-caching.md +52 -0
  74. agent_efficiency-1.4.2/skills/prompt-cache-manager/scripts/_ae_core/__init__.py +90 -0
  75. agent_efficiency-1.4.2/skills/prompt-cache-manager/scripts/_ae_core/io_lock.py +199 -0
  76. agent_efficiency-1.4.2/skills/prompt-cache-manager/scripts/_ae_core/savings.py +249 -0
  77. agent_efficiency-1.4.2/skills/prompt-cache-manager/scripts/_ae_core/security.py +235 -0
  78. agent_efficiency-1.4.2/skills/prompt-cache-manager/scripts/_ae_core/usage.py +195 -0
  79. agent_efficiency-1.4.2/skills/prompt-cache-manager/scripts/cache_payload.py +278 -0
  80. agent_efficiency-1.4.2/skills/prompt-cache-manager/scripts/prompt_cache.py +488 -0
  81. agent_efficiency-1.4.2/tests/test_audit_regressions.py +498 -0
  82. agent_efficiency-1.4.2/tests/test_automation_mcp.py +159 -0
  83. agent_efficiency-1.4.2/tests/test_context_index.py +227 -0
  84. agent_efficiency-1.4.2/tests/test_ide_power_features.py +326 -0
  85. agent_efficiency-1.4.2/tests/test_orchestration_handoff.py +374 -0
  86. agent_efficiency-1.4.2/tests/test_production_readiness.py +352 -0
  87. agent_efficiency-1.4.2/tests/test_prompt_cache.py +179 -0
  88. agent_efficiency-1.4.2/tests/test_risk_hardening.py +337 -0
  89. agent_efficiency-1.4.2/tests/test_schlager_upgrades.py +408 -0
  90. agent_efficiency-1.4.2/tests/test_skills_validation.py +57 -0
  91. agent_efficiency-1.4.2/tests/test_smoke.py +30 -0
  92. agent_efficiency-1.4.2/tests/test_top5_upgrades.py +415 -0
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "agent-efficiency-marketplace",
3
+ "owner": {
4
+ "name": "Jeager070"
5
+ },
6
+ "metadata": {
7
+ "description": "Zero-dependency token efficiency, log compression, session memory, and context-bloat auditing for AI coding agents."
8
+ },
9
+ "plugins": [
10
+ {
11
+ "name": "agent-efficiency",
12
+ "source": "./",
13
+ "description": "Core IDE efficiency bundle (local-context-index + adaptive-orchestration-handoff + ae CLI + doctor + audit)."
14
+ }
15
+ ]
16
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "agent-efficiency",
3
+ "version": "1.4.2",
4
+ "description": "Cut AI coding-agent token waste by 60–95%: local SQLite FTS5 symbol index & multi-slice, 80–95% test/build log compression with auto-sliced stacktraces, session checkpoints, context doctor, and IDE transcript waste audit.",
5
+ "author": {
6
+ "name": "Jeager070"
7
+ },
8
+ "homepage": "https://github.com/Jeager070/agent-efficiency-skills",
9
+ "repository": "https://github.com/Jeager070/agent-efficiency-skills",
10
+ "license": "MIT",
11
+ "keywords": ["tokens", "efficiency", "context", "fts5", "logs", "checkpoint", "audit", "doctor"],
12
+ "skills": [
13
+ "./skills/local-context-index",
14
+ "./skills/adaptive-orchestration-handoff"
15
+ ]
16
+ }
@@ -0,0 +1,43 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ verify:
10
+ runs-on: ${{ matrix.os }}
11
+ strategy:
12
+ fail-fast: false
13
+ matrix:
14
+ include:
15
+ - os: ubuntu-24.04
16
+ python-version: "3.9"
17
+ - os: ubuntu-latest
18
+ python-version: "3.11"
19
+ - os: ubuntu-latest
20
+ python-version: "3.13"
21
+ - os: macos-latest
22
+ python-version: "3.12"
23
+ - os: windows-latest
24
+ python-version: "3.12"
25
+ steps:
26
+ - uses: actions/checkout@v4
27
+ - uses: actions/setup-python@v5
28
+ with:
29
+ python-version: ${{ matrix.python-version }}
30
+ - name: Check shared core sync across skills
31
+ run: python scripts/sync_shared.py --check
32
+ - name: Run unit, security, concurrency, hook & MCP tests
33
+ run: python -m unittest discover -s tests -v
34
+ - name: Validate skill pack compliance
35
+ run: python scripts/validate_skills.py
36
+ - name: Verify MCP server core and full tool manifests
37
+ run: |
38
+ python mcp/server.py --profile core --list-tools
39
+ python mcp/server.py --profile full --list-tools
40
+ - name: Run synthetic & real-repo efficiency benchmarks
41
+ run: |
42
+ python benchmarks/benchmark_efficiency.py
43
+ python benchmarks/benchmark_efficiency.py --repo . --format md
@@ -0,0 +1,53 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ permissions:
9
+ contents: write
10
+ id-token: write
11
+
12
+ jobs:
13
+ verify:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - uses: actions/setup-python@v5
18
+ with:
19
+ python-version: "3.12"
20
+ - name: Verify shared core sync, unit tests, skills, and benchmarks
21
+ run: |
22
+ python scripts/sync_shared.py --check
23
+ python -m unittest discover -s tests -v
24
+ python scripts/validate_skills.py
25
+ python mcp/server.py --profile core --list-tools
26
+ python benchmarks/benchmark_efficiency.py --repo . --format md
27
+ python benchmarks/eval_llm_ab.py --mode mock --format md
28
+
29
+ build-and-publish:
30
+ needs: verify
31
+ runs-on: ubuntu-latest
32
+ environment:
33
+ name: pypi
34
+ url: https://pypi.org/p/agent-efficiency
35
+ steps:
36
+ - uses: actions/checkout@v4
37
+ - uses: actions/setup-python@v5
38
+ with:
39
+ python-version: "3.12"
40
+ - name: Build sdist & wheel and verify metadata
41
+ run: |
42
+ python -m pip install --upgrade build twine
43
+ python -m build
44
+ python -m twine check dist/*.whl dist/*.tar.gz
45
+ - name: Publish to PyPI via Trusted Publishing (OIDC)
46
+ uses: pypa/gh-action-pypi-publish@release/v1
47
+ - name: Create GitHub Release
48
+ uses: softprops/action-gh-release@v2
49
+ with:
50
+ files: |
51
+ dist/*.whl
52
+ dist/*.tar.gz
53
+ generate_release_notes: true
@@ -0,0 +1,12 @@
1
+ .agent-index/
2
+ .agent-state/
3
+ __pycache__/
4
+ *.pyc
5
+ *.pyo
6
+ .pytest_cache/
7
+ .env
8
+ .env.*
9
+ !.env.example
10
+ !.env.template
11
+ .DS_Store
12
+ dist/
@@ -0,0 +1,26 @@
1
+ # Changelog
2
+
3
+ All notable changes to **AgentEfficiency Skills (`ae`)** are documented in this file.
4
+
5
+ ## [1.4.2] - 2026-11-27
6
+
7
+ ### Added
8
+ - **Real `SessionStart` auto-resume trigger:** Claude Code and Gemini CLI `SessionStart` hooks generated by `ae init --hooks` / `setup_hooks.py` now invoke `agent_state.py session-start --auto-index --format claude-hook|gemini-hook` so `PROJECT_MAP.md`, recent git activity, and checkpoints are automatically injected at turn 0.
9
+ - **Actionable `ae doctor`:** Displays the Top 10 always-on skill token consumers with exact file paths, fixes ASCII card header overflow on long repository names, and adds `ae doctor --prune` (dry-run by default; `--apply` safely archives heavy non-AE skills into `~/.agent-efficiency/archived-skills/` with `--restore`).
10
+ - **Trust & rollback CLI + docs:** Added `ae install-status` / `ae status --setup`, `ae uninstall` (clean non-destructive removal of AE skills, rules marker blocks, runtime hooks, Git hooks, CLI/MCP, and optional `--purge-repo-state`), `SECURITY.md`, `CHANGELOG.md`, and `.github/workflows/release.yml`.
11
+ - **Anti-tunnel-vision hardening:** Added fixture/setup warning retention + `--verbose` in `ae run`, `--with-header` (imports, module constants, enclosing class & constructor signature) in `ae slice`, asymmetric pre-crash windows in `ae trace-pack`, dynamic `@`-include detection in `ae doctor` / `ae cache lint`, and `ae audit` schema-drift warnings with Tier-1/Tier-2 classification.
12
+ - **End-to-end A/B harness & semantic resolution:** Added `benchmarks/eval_llm_ab.py` (Python + TypeScript tasks), optional stdio LSP bridge (`idx_lsp.py` / `ae callgraph --lsp`), and explicit `resolution_mode` (`ast-syntax-name-matched` vs `type-checked-lsp` vs `heuristic-regex-name-matched`).
13
+
14
+ ### Fixed
15
+ - **Audit metric consistency & ASCII layout (`ae audit`):** Unified `Before vs After Trend` cache-hit calculation to use the same token-weighted formula as `overall_cache_hit_rate_pct`, separated unique files read vs total/repeated reads, clarified raw tool-output tokens vs cumulative multi-turn API input tokens, and prevented ASCII box overflow across `ae audit`, `ae doctor`, `ae init`, and `ae savings`.
16
+
17
+ ## [1.4.1] - 2026-11-27
18
+
19
+ ### Added
20
+ - `ae resume` (`session-start --auto-index`) 1-call new-window startup dossier combining checkpoint/brief, recent git delta, and budgeted `PROJECT_MAP.md`.
21
+ - Windows CI compatibility (UTF-8 stdio reconfiguration, `cmd.exe` quoting, `.cmd` CLI shim, safe corrupt SQLite DB replacement).
22
+
23
+ ## [1.4.0] - 2026-11-27
24
+
25
+ ### Added
26
+ - `ae init` 1-command multi-runtime setup wizard, `ae doctor`, visual `ae audit` card, `ae savings --statusline`, opt-in `PreToolUse` / `BeforeTool` hook, and lean 7-tool `--profile core` MCP server.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jeager070
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.
@@ -0,0 +1,267 @@
1
+ Metadata-Version: 2.5
2
+ Name: agent-efficiency
3
+ Version: 1.4.2
4
+ Summary: Zero-dependency local context index, log compression, session memory, context doctor, and lean MCP server for AI coding agents.
5
+ Project-URL: Homepage, https://github.com/Jeager070/agent-efficiency-skills
6
+ Project-URL: Repository, https://github.com/Jeager070/agent-efficiency-skills
7
+ Project-URL: Issues, https://github.com/Jeager070/agent-efficiency-skills/issues
8
+ Author: Jeager070
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Keywords: ai,claude-code,codex,coding-agent,cursor,fts5,gemini,mcp,skills,tokens
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Software Development :: Quality Assurance
22
+ Requires-Python: >=3.9
23
+ Provides-Extra: all
24
+ Requires-Dist: litellm>=1.40.0; extra == 'all'
25
+ Requires-Dist: tree-sitter-language-pack>=0.7.0; extra == 'all'
26
+ Requires-Dist: watchdog>=4.0.0; extra == 'all'
27
+ Provides-Extra: ast
28
+ Requires-Dist: tree-sitter-language-pack>=0.7.0; extra == 'ast'
29
+ Provides-Extra: llm
30
+ Requires-Dist: litellm>=1.40.0; extra == 'llm'
31
+ Provides-Extra: watch
32
+ Requires-Dist: watchdog>=4.0.0; extra == 'watch'
33
+ Description-Content-Type: text/markdown
34
+
35
+ # Agent Efficiency Skills (`ae`)
36
+
37
+ **Stop paying your AI coding agent to re-read the same files and paste 3,000-line test logs into every turn.**
38
+
39
+ [![CI](https://github.com/Jeager070/agent-efficiency-skills/actions/workflows/ci.yml/badge.svg)](https://github.com/Jeager070/agent-efficiency-skills/actions/workflows/ci.yml)
40
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
41
+ ![Python 3.9+](https://img.shields.io/badge/python-3.9%2B-blue)
42
+ ![Dependencies: none](https://img.shields.io/badge/core%20deps-stdlib%20only-brightgreen)
43
+
44
+ Cut noisy test-log & session-resume overhead by **up to 94–97%**, trim code-reading tokens by **20–80%** even against disciplined `rg` + range-read agents, and audit your real IDE token waste & always-on context bloat in 3 seconds.
45
+
46
+ Works with **Claude Code**, **Cursor**, **Codex**, **Gemini CLI**, **Antigravity**, **OpenCode**, **Windsurf**, **Copilot**, and custom LLM pipelines. Runs 100% locally on **Python 3.9+ standard library + SQLite FTS5** (zero required packages, ~16–21 MB peak RAM, no background daemon).
47
+
48
+ ![Before and after comparison of pytest output vs ae run](docs/assets/before-after-run.svg)
49
+
50
+ ---
51
+
52
+ ## 10-Second Try-It-Now (Zero Repo Changes, Read-Only)
53
+
54
+ See what your coding agents actually burned last week — and how many always-on tokens your rules, skills, and MCP servers tax every single turn:
55
+
56
+ ```bash
57
+ # Run directly from GitHub via uvx (zero install, strictly read-only):
58
+ uvx --from git+https://github.com/Jeager070/agent-efficiency-skills.git ae audit
59
+ uvx --from git+https://github.com/Jeager070/agent-efficiency-skills.git ae doctor
60
+ ```
61
+
62
+ > *(Once published to PyPI, the short form `uvx agent-efficiency audit` works directly too.)*
63
+
64
+ ![ae audit visual session receipt and ae doctor context bloat analyzer](docs/assets/audit-doctor-card.svg)
65
+
66
+ ---
67
+
68
+ ## 1-Command Setup (`ae init`)
69
+
70
+ ### Option A — Install via `pipx` / `pip` + `ae init` (Recommended)
71
+ ```bash
72
+ pipx install git+https://github.com/Jeager070/agent-efficiency-skills.git
73
+ # Optional native tree-sitter AST upgrade for JS/TS/Go/Rust/Java:
74
+ # pipx install "agent-efficiency[ast] @ git+https://github.com/Jeager070/agent-efficiency-skills.git"
75
+
76
+ # Auto-detects Claude Code, Cursor, Codex, Gemini, OpenCode, Windsurf & Copilot:
77
+ ae init # Skills (--profile ide) + ae CLI + 6-line rules + repo index
78
+ ae init --hooks # + Non-destructive hooks (PreToolUse in safe hint-only mode)
79
+ ae init --hooks --auto-wrap # + Explicit opt-in: auto-wrap simple pipe-free test/build cmds
80
+ ae init --mcp # + Standalone lean MCP server (--profile core: 7 tools, ~622 tok)
81
+ ```
82
+
83
+ ### Option B — From a Local Clone (No `pipx`/`uvx` Needed)
84
+ ```bash
85
+ git clone https://github.com/Jeager070/agent-efficiency-skills.git
86
+ cd agent-efficiency-skills
87
+
88
+ python3 scripts/ae_init.py . --hooks
89
+ # Or target a single runtime explicitly:
90
+ python3 scripts/install.py --runtime claude --profile ide --install-cli --install-rules --force
91
+ python3 scripts/install.py --runtime cursor --profile ide --install-cli --install-rules --force
92
+ ```
93
+
94
+ ### Option C — Claude Code Plugin Marketplace
95
+ This repository ships `.claude-plugin/plugin.json` and `.claude-plugin/marketplace.json`:
96
+ ```text
97
+ /plugin marketplace add Jeager070/agent-efficiency-skills
98
+ /plugin install agent-efficiency
99
+ ```
100
+
101
+ ---
102
+
103
+ ## Why It Actually Gets Used (Not Forgotten Like Normal Skills)
104
+
105
+ 1. **Real `SessionStart` trigger (Claude Code & Gemini CLI) + Hookless-IDE setup:**
106
+ - **Hook-capable clients (`ae init --hooks`):** `SessionStart` runs `agent_state.py session-start --auto-index` automatically at turn 0, injecting `PROJECT_MAP.md`, recent git activity, and active checkpoints/handoffs directly into the starting context so the agent skips `ls`/`find` without relying on prompt memory.
107
+ - **Hookless IDEs (Antigravity, Cursor, Codex, Windsurf, Copilot):** `ae init` installs the short workflow block ([rules/AGENT_RULES.md](rules/AGENT_RULES.md)) into `GEMINI.md` / `.cursor/rules/agent-efficiency.mdc` (`alwaysApply: true`) / `AGENTS.md` / `copilot-instructions.md` — kick off a fresh window with `ae resume` (or bind it as your first prompt/workflow).
108
+ 2. **Safe-by-default `PreToolUse` / `BeforeTool` hook** ([scripts/pretool_hook.py](scripts/pretool_hook.py)):
109
+ - **Default (`--mode hint`):** Never rewrites commands silently. Adds a concise non-blocking tip on noisy test/build runs and nudges when the agent is about to re-read an unchanged >150-line file in full.
110
+ - **Explicit opt-in (`ae init --auto-wrap` / `--mode rewrite`):** Transparently wraps *only* simple, pipe-free, non-interactive test/build commands (`pytest`, `npm test`, `cargo test`, `go test`, `vitest`, `tsc`, etc.) through `ae run`. Commands with pipes (`|`), redirects (`>`), chains (`&&`/`;`), subshells, complex env prefixes, or interactive/watch flags (`-i`, `--pdb`, `--watch`, `-w`) are **never** touched.
111
+ 3. **Lean 7-tool MCP Core Profile (`--profile core`):** Full 39-tool MCP servers cost **~3,274 schema tokens every turn**. `ae init --mcp` and `setup_hooks.py mcp-config` default to `--profile core` (**7 tools, ~622–637 tokens — −81% schema tax**).
112
+ 4. **Live Savings Counter, Actionable Doctor & Clean Rollback:** Every `ae run`, `ae slice`, and `ae outline` logs gross local I/O savings (`ae savings --statusline`); `ae doctor` lists the **Top 10 heaviest skills with exact paths** and archives unused bloat safely (`ae doctor --prune --apply`); `ae install-status` and `ae uninstall` inspect and cleanly remove every installed component.
113
+ ```text
114
+ ae: -142.3k tok (-86%, ~$0.43 saved / 7d)
115
+ ```
116
+
117
+ ---
118
+
119
+ ## Core IDE Skills vs. Optional Pipeline Skill
120
+
121
+ | Bundle | Skills | Always-On Load | Who Needs It |
122
+ |---|---|---:|---|
123
+ | **`--profile ide` (default)** | `local-context-index` + `adaptive-orchestration-handoff` | **~119 tok** | Everyday coding in Claude Code, Cursor, Codex, Gemini CLI, Antigravity, OpenCode, Windsurf, Copilot |
124
+ | **`--profile full`** | Adds `prompt-cache-manager` | **~170 tok** | Custom Anthropic / OpenAI / Gemini / Bedrock API pipeline builders |
125
+
126
+ - **`local-context-index`**: Incremental SQLite FTS5 index (schema v5, CamelCase/snake_case/kebab-case splitting), static symbol **call graph**, monorepo alias resolution (`tsconfig.json`, `package.json` workspaces, `go.mod`), multi-target live `slice` (`a.py:foo b.py:10-40`), `diff-pack`, `trace-pack`, `tests-for`, and `run` (80–95% log compression + auto-sliced failing stacktraces).
127
+ - **`adaptive-orchestration-handoff`**: Zero-friction `checkpoint` (`CHECKPOINT.md`), 1-call `session-start`/`brief` with live SHA drift detection, ADRs (`DECISIONS.md`), anti-duplication dead-end memory, read-only IDE `audit` (Claude Code, Antigravity, Codex, Gemini, Cursor, OpenCode, Cline), and `doctor` (always-on context bloat, MCP schema tax, cache-busters & secret leaks). Optional subagent/pipeline routing in `route_task.py`.
128
+ - **`prompt-cache-manager`** *(optional)*: L0/L1 prefix linting, provider cache payload builders (Anthropic, OpenAI Chat & Responses API, Gemini, Bedrock), and verified telemetry tracking.
129
+
130
+ ---
131
+
132
+ ## Reproducible Benchmarks & End-to-End LLM A/B Eval
133
+
134
+ ### 1. Deterministic Token & Signal-Preservation Benchmarks (Zero API Cost)
135
+
136
+ Run on **any** local or open-source repository (non-destructive copy in a temp dir) — measures token reduction against both naive reads **and** a disciplined `rg` + 90-line range-read baseline, and verifies **deterministic diagnostic & fixture-warning preservation** (target symbol definitions, `AssertionError`, fixture warning 35+ lines above the traceback, and exact `>>>` crash line preserved):
137
+
138
+ > **Scope note:** These zero-API-cost benchmarks measure *token reduction and deterministic signal preservation*, not LLM solve rate. To measure end-to-end Pass@1 solve rate, turn count, and net cached API cost with real models, run the A/B harness below.
139
+
140
+ ```bash
141
+ python3 benchmarks/benchmark_efficiency.py --repo . --format md
142
+ # Benchmark multiple OSS repos side by side (e.g. local clones of Flask & a TS app):
143
+ python3 benchmarks/benchmark_efficiency.py --repo /path/to/flask --repo /path/to/ts-app --format md
144
+ ```
145
+
146
+ ### 2. End-to-End LLM A/B Evaluation (`benchmarks/eval_llm_ab.py`)
147
+
148
+ Evaluates 6 realistic multi-file bugfix tasks across **Python & TypeScript** — including deliberate **tunnel-vision stress cases** (fixture warning 35+ lines before traceback, module-level constant side effects, enclosing class `__init__` regressions, TypeScript interface/DI defaults) — comparing a `baseline` arm (`grep` + `read_file` + raw tests) against an `ae` arm (`ae search`/`slice --with-header`/`run --verbose` + full-read escape hatch) on **Pass@1 solve rate, turns, context escalations, cache hit rate, and USD cost**:
149
+
150
+ ```bash
151
+ # Offline deterministic harness check (0 API cost — verifies all 6 bugs fail & patches pass):
152
+ python3 benchmarks/eval_llm_ab.py --mode mock --format md
153
+
154
+ # Live end-to-end A/B evaluation against real LLMs (requires ANTHROPIC_API_KEY, GEMINI_API_KEY, OPENAI_API_KEY, or litellm):
155
+ python3 benchmarks/eval_llm_ab.py --mode live --model claude-sonnet-4-20250514 --format md
156
+ python3 benchmarks/eval_llm_ab.py --mode live --model gemini-2.5-flash --format md
157
+ python3 benchmarks/eval_llm_ab.py --mode live --model gpt-4o --format md
158
+ ```
159
+
160
+ > **Live API benchmark policy:** No live API numbers are hardcoded here until executed against live provider keys; run `--mode live` locally to record verified model-specific Pass@1, turn, cache-hit, and USD results.
161
+
162
+ ### Measured on `agent-efficiency-skills` (78 files, 617 symbols, Apple Silicon, Python 3.9 stdlib)
163
+
164
+ | Task | Naive Baseline | Disciplined (`rg` + 90L) | With `ae` | Reduction | Fidelity |
165
+ |---|---:|---:|---:|---:|:---:|
166
+ | Read 3 symbols across 3 files (`ae slice`) | 27,410 tok | 2,897 tok | **562 tok** | **-97.9%** vs naive · **-80.6%** vs `rg` | PASS |
167
+ | Debug 181-test failure + failing file (`ae run` + `trace-pack`) | 11,110 tok | — | **271 tok** | **-97.6%** *(stops noise repeating every turn)* | PASS |
168
+ | Index speed (78 files) | — | — | **960 ms** cold · **34 ms** inc · **4.9 ms** search | — | — |
169
+
170
+ ### Synthetic 35-File Multi-Language Suite & 1,000-File Scaling (`python3 benchmarks/benchmark_efficiency.py`)
171
+
172
+ | Scenario | Naive Baseline | Disciplined Baseline | AgentEfficiency | Reduction |
173
+ |---|---:|---:|---:|---|
174
+ | Exploration (`map`+`search`+`outline`+`slice` / warm `search`+`slice`) | 16,354 tok | 2,456 tok | **2,156 tok** cold / **559 tok** warm | **-86.8%** vs naive · **-77.2%** vs `rg` |
175
+ | Session resume (`checkpoint` + `brief`) | 1,636 tok | — | **96 tok** | **-94.1%** |
176
+ | Persistent state (decision + dead-end memory) | 6,104 tok | — | **285 tok** | **-95.3%** |
177
+ | Subagent handoff (`brief` + `slice`) | 16,354 tok | — | **463 tok** | **-97.2%** |
178
+ | *Custom pipelines:* Adaptive routing (5 steps) | \$0.5625 | — | **\$0.1575** | **-72.0%** |
179
+ | *Custom pipelines:* Prompt caching (10 turns, Anthropic) | 19,490 billable tok | — | **8,900 tok** | **-54.3%** |
180
+
181
+ **Scaling (1,000 files / 10,000 symbols, Apple Silicon):** cold index **1.05 s**, incremental edit **166 ms**, FTS5 search **3.3 ms**, call-graph **3.0 ms**, SQLite DB **6.2 MB**.
182
+
183
+ > **Honest scope:** Against an already disciplined agent using `rg` + tight line-range reads, typical everyday code-reading savings are **20–50%** on medium/large repos (and higher on multi-file symbol lookups). The largest universal savings come from `ae run`, `ae tests-for`, `ae doctor` (cutting always-on MCP/rules tax), and `ae checkpoint`/`brief` across compactions. On tiny `<15`-file single-file edits, read directly.
184
+
185
+ ---
186
+
187
+ ## Daily CLI Reference (`ae`)
188
+
189
+ `<repo>` defaults to the current working directory (override with `ae -C /other/repo ...`):
190
+
191
+ ```bash
192
+ # Onboarding, Waste Audit, Diagnostics & Clean Rollback
193
+ ae init [--hooks] [--auto-wrap] [--mcp] # Auto-detect IDEs & install skills/CLI/rules/hooks
194
+ ae install-status [--format card|json] # Inspect active skills, rules, hooks, MCP & repo state (also `ae status --setup`)
195
+ ae uninstall [--dry-run] [--purge-repo-state] # Non-destructively remove AE rules blocks, hooks, skills & CLI
196
+ ae audit [--limit 6 --format card|compact|json] # Visual IDE transcript waste, USD cost & weighted trends
197
+ ae doctor [--prune [--apply]] [--format card] # Always-on bloat, top-10 skill offenders, cache-busters & safe archive
198
+ ae savings [--days 7] [--statusline] # Gross I/O token & USD savings receipt / statusline string
199
+
200
+ # Minimal Code Context, Logs & Affected Tests
201
+ ae index # Incremental FTS5 + call-graph index (.git/info/exclude)
202
+ ae search "token refresh" # Finds refreshAccessToken via identifier splitting
203
+ ae outline src/auth.py # Imports + symbol signatures & line ranges
204
+ ae slice a.py:foo b.py:Service.bar --with-header --max-tokens 1200
205
+ ae deps src/auth.py --depth 2 # Import blast radius (tsconfig / workspaces / go.mod)
206
+ ae callgraph verify_token --depth 2 [--lsp] # Symbol callers/callees (syntax name-matched, or type-checked via `--lsp`)
207
+ ae tests-for # Minimal affected test files + suggested runner cmd
208
+ ae run [--verbose] -- pytest -q # Compress logs, keep fixture warnings & auto-slice crashes
209
+ ae trace-pack --file err.log # Raw stacktrace -> exact in-repo failing slices
210
+ ae diff-pack --base HEAD --budget-tokens 2500 # Budgeted diff + touched symbols + callers
211
+
212
+ # Session Memory & Handoff
213
+ ae resume # 1-call new-window resume (auto-index + PROJECT_MAP + git + brief)
214
+ ae checkpoint --note "Ready for review" # Zero-friction checkpoint (CHECKPOINT.md)
215
+ ae brief # 1-call state/checkpoint brief with live SHA drift check
216
+ ae handoff --summary "..." --next "..." # Zero-reexploration HANDOFF.md
217
+ ```
218
+
219
+ ### Optional Hooks & Lean MCP Setup
220
+ ```bash
221
+ # Auto-reindex on git commit/checkout/merge (worktree-aware; preserves existing hooks):
222
+ python3 scripts/setup_hooks.py git /path/to/repo
223
+
224
+ # Merge Claude Code or Gemini CLI hooks (safe hint-only PreToolUse by default; pass --auto-wrap to opt in):
225
+ python3 scripts/setup_hooks.py runtime /path/to/repo --client claude --write
226
+ python3 scripts/setup_hooks.py runtime /path/to/repo --client claude --auto-wrap --write
227
+
228
+ # Print lean 7-tool MCP config (~622 schema tok vs ~3,274 for --profile full):
229
+ python3 scripts/setup_hooks.py mcp-config --client claude --profile core
230
+ python3 mcp/server.py --profile core --list-tools
231
+ ```
232
+
233
+ ---
234
+
235
+ ## Guardrails, Prompt-Cache Hygiene & Runtime Support Tiers
236
+
237
+ - **Anti-Tunnel-Vision Safeguards:**
238
+ - `ae run` preserves fixture/setup warnings above errors, emits an explicit omission notice if warnings exceed budget, archives the complete redacted `full_log`, and supports `--verbose` for wider pre-error context.
239
+ - `ae slice --with-header` prepends compact file imports, module-level constants, and the enclosing class header within the token budget; `ae trace-pack` uses an asymmetric pre-crash window (`-6/+3`) on long functions.
240
+ - [rules/AGENT_RULES.md](rules/AGENT_RULES.md) enforces an explicit escalation rule: if root cause is unclear or a fix fails once, widen context (`--with-header`, `--verbose`, `full_log`, or full file read) instead of burning extra turns.
241
+ - **Prompt-Cache Golden Rule:** Never `@import` mutable `.agent-state/*` files (`CHECKPOINT.md`, `HANDOFF.md`, `CURRENT_STATE.md`) into always-on `CLAUDE.md` / `AGENTS.md` / `.cursor/rules/`. `ae doctor` and `ae cache lint` flag dynamic state includes automatically, and `ae brief` omits ticking TTL countdowns so repeated briefs stay byte-stable. (`ae savings` tracks gross local I/O reduction; verify net provider cache hit rate via `ae audit`.)
242
+ - **Core vs. Runtime Support Tiers (Maintenance Boundary):**
243
+ - **Core engine (runtime-agnostic):** `ae index`, `search`, `outline`, `slice`, `deps`, `callgraph`, `tests-for`, `run`, `trace-pack`, `diff-pack`, `doctor`, `checkpoint`, `brief` depend only on local files + Git and never break from IDE format changes.
244
+ - **Tier 1 (CI fixture-verified adapters):** Transcript parsers & hooks for **Claude Code**, **Gemini CLI / Antigravity**, and **Codex**.
245
+ - **Tier 2 (Best-effort / community adapters):** **Cursor**, **OpenCode**, **Windsurf**, **Copilot**, **Cline** (path mappings + best-effort `ae audit` parsers). If any client changes its log schema, `ae audit` surfaces an explicit **Schema-Drift Warning** instead of silently reporting zero usage.
246
+
247
+ ## Parser Fidelity, Trust & Safety Guarantees
248
+
249
+ - **Python (`.py`, `.pyi`):** Full stdlib `ast` parsing (`analysis_confidence: "ast"`, `resolution_mode: "ast-syntax-name-matched"`) including decorators, base classes, module-level wiring, and DI/callback arguments (`Depends(verify_token)`).
250
+ - **JS/TS/TSX/Go/Rust/Java/Kotlin/Swift/C/C++/Ruby:** Zero-dependency default uses comment/string-aware brace matching + dynamic `import()` + JSX + `@Decorator` heuristics (`analysis_confidence: "heuristic"`). Install optional `pip install "agent-efficiency[ast]"` (`tree-sitter-language-pack`) for native `tree-sitter` syntax ASTs, and pass `ae callgraph --lsp` when a local LSP server (`typescript-language-server`, `pyright-langserver`, `rust-analyzer`, `gopls`) is installed for type-checked references (`resolution_mode: "type-checked-lsp"`).
251
+ - **Zero code execution during indexing & local privacy:** Strictly static parsing with `PRAGMA trusted_schema=OFF`; zero telemetry or outbound network calls (`ae audit` reads local transcripts strictly read-only). See [SECURITY.md](SECURITY.md) and [CHANGELOG.md](CHANGELOG.md).
252
+ - **Smart secret exclusion & code-safe redaction:** skips `.env*` (except `.example`/`.sample`/`.template`), private keys, `*.tfvars.json`, `*.tfstate*`, secret config files, binaries, nested `.gitignore` (`!` negation supported), and symlinks pointing to secrets — redacting hardcoded literals without corrupting code.
253
+ - **Prompt-injection isolation & atomic locking:** repository snippets are framed inside `<untrusted_repo_data>`; cross-platform locks use `fcntl.flock` (POSIX) + `msvcrt.locking` (Windows) + `os.replace()`.
254
+
255
+ ## Verification
256
+
257
+ ```bash
258
+ python3 scripts/sync_shared.py --check
259
+ python3 scripts/validate_skills.py
260
+ python3 -m unittest discover -s tests -v
261
+ python3 mcp/server.py --profile core --list-tools
262
+ python3 benchmarks/benchmark_efficiency.py --repo . --format md
263
+ ```
264
+
265
+ ## License
266
+
267
+ [MIT](LICENSE) © 2026 Jeager070