agentpack-cli 0.3.4__tar.gz → 0.3.8__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.
- agentpack_cli-0.3.4/README.md → agentpack_cli-0.3.8/PKG-INFO +161 -10
- agentpack_cli-0.3.4/PKG-INFO → agentpack_cli-0.3.8/README.md +122 -49
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/pyproject.toml +2 -2
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/__init__.py +1 -1
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/analysis/ranking.py +6 -4
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/application/pack_service.py +88 -25
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/cli.py +6 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/commands/doctor.py +34 -0
- agentpack_cli-0.3.8/src/agentpack/commands/guard.py +129 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/commands/hook_cmd.py +77 -25
- agentpack_cli-0.3.8/src/agentpack/commands/ignore_cmd.py +51 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/commands/init.py +31 -8
- agentpack_cli-0.3.8/src/agentpack/commands/migrate.py +182 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/commands/pack.py +45 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/commands/stats.py +3 -2
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/commands/status.py +11 -17
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/core/config.py +3 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/core/context_pack.py +36 -0
- agentpack_cli-0.3.8/src/agentpack/core/ignore.py +448 -0
- agentpack_cli-0.3.8/src/agentpack/core/task_freshness.py +79 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/data/agentpack.md +5 -5
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/installers/antigravity.py +5 -4
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/installers/claude.py +15 -1
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/installers/codex.py +5 -4
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/installers/cursor.py +12 -10
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/installers/windsurf.py +6 -5
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/integrations/agents.py +85 -9
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/integrations/vscode_tasks.py +11 -2
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/mcp_server.py +36 -29
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/renderers/markdown.py +38 -0
- agentpack_cli-0.3.4/src/agentpack/core/ignore.py +0 -90
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/.gitignore +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/LICENSE +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/adapters/__init__.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/adapters/antigravity.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/adapters/base.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/adapters/claude.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/adapters/codex.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/adapters/cursor.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/adapters/detect.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/adapters/generic.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/adapters/windsurf.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/analysis/__init__.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/analysis/dependency_graph.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/analysis/go_imports.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/analysis/java_imports.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/analysis/js_ts_imports.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/analysis/monorepo.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/analysis/naming_signals.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/analysis/python_imports.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/analysis/repo_map.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/analysis/role_inference.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/analysis/rust_imports.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/analysis/symbols.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/analysis/task_classifier.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/analysis/tests.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/application/__init__.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/commands/__init__.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/commands/_shared.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/commands/benchmark.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/commands/claude_cmd.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/commands/diff.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/commands/explain.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/commands/install.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/commands/mcp_cmd.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/commands/monitor.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/commands/quickstart.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/commands/repair.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/commands/scan.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/commands/summarize.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/commands/tune.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/commands/watch.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/core/__init__.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/core/bootstrap.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/core/cache.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/core/diff.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/core/git.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/core/git_hooks.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/core/global_install.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/core/merkle.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/core/models.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/core/redactor.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/core/scanner.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/core/snapshot.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/core/token_estimator.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/core/vscode_tasks.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/installers/__init__.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/integrations/__init__.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/integrations/git_hooks.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/integrations/global_install.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/integrations/platform.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/renderers/__init__.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/renderers/compact.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/renderers/receipts.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/session/__init__.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/session/state.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/summaries/__init__.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/summaries/base.py +0 -0
- {agentpack_cli-0.3.4 → agentpack_cli-0.3.8}/src/agentpack/summaries/offline.py +0 -0
|
@@ -1,3 +1,42 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agentpack-cli
|
|
3
|
+
Version: 0.3.8
|
|
4
|
+
Summary: Local context engine for AI coding agents that ranks relevant files and builds task-focused context packs.
|
|
5
|
+
License: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Keywords: ai,ai-coding-agents,antigravity,ci,codex,context,context-engine,context-packing,cursor,developer-tools,llm,mcp,packing,prompt-context,repo-analysis,windsurf
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Requires-Dist: pathspec>=0.12.1
|
|
19
|
+
Requires-Dist: pydantic>=2.0.0
|
|
20
|
+
Requires-Dist: rich>=13.0.0
|
|
21
|
+
Requires-Dist: tiktoken>=0.7.0
|
|
22
|
+
Requires-Dist: tomli-w>=1.0.0
|
|
23
|
+
Requires-Dist: tomli>=2.0.0; python_version < '3.11'
|
|
24
|
+
Requires-Dist: typer>=0.12.0
|
|
25
|
+
Provides-Extra: all
|
|
26
|
+
Requires-Dist: mcp>=1.0.0; extra == 'all'
|
|
27
|
+
Requires-Dist: watchdog>=4.0.0; extra == 'all'
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: mypy; extra == 'dev'
|
|
30
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
31
|
+
Requires-Dist: pytest-cov; extra == 'dev'
|
|
32
|
+
Requires-Dist: ruff; extra == 'dev'
|
|
33
|
+
Requires-Dist: tomli>=2.0.0; (python_version < '3.11') and extra == 'dev'
|
|
34
|
+
Provides-Extra: mcp
|
|
35
|
+
Requires-Dist: mcp>=1.0.0; extra == 'mcp'
|
|
36
|
+
Provides-Extra: watch
|
|
37
|
+
Requires-Dist: watchdog>=4.0.0; extra == 'watch'
|
|
38
|
+
Description-Content-Type: text/markdown
|
|
39
|
+
|
|
1
40
|
# AgentPack
|
|
2
41
|
|
|
3
42
|
[](https://pypi.org/project/agentpack-cli/)
|
|
@@ -7,7 +46,7 @@
|
|
|
7
46
|
[](https://opensource.org/licenses/MIT)
|
|
8
47
|
[](https://github.com/vishal2612200/agentpack/actions/workflows/ci.yml)
|
|
9
48
|
|
|
10
|
-
> **Status: alpha (v0.3.
|
|
49
|
+
> **Status: alpha (v0.3.8).** Works, tested, used in real sessions. Python and JavaScript/TypeScript are the best-supported languages. Public benchmark proof exists for the current suite, but broader repo coverage is still growing. API may change before 1.0.
|
|
11
50
|
>
|
|
12
51
|
> **Platform note:** macOS, Linux, and Windows are supported. Windows support targets PowerShell plus Git for Windows. `cmd.exe` and bare Git setups are not a supported path yet.
|
|
13
52
|
|
|
@@ -38,7 +77,7 @@ Use AgentPack when a repo is too large to paste and you want faster, more consis
|
|
|
38
77
|
- **Budget-aware compression**: emits `full`, `diff`, `symbols`, `skeleton`, or `summary` views instead of all-or-nothing file dumps.
|
|
39
78
|
- **Local code intelligence**: extracts roles, domains, entrypoints, definitions, dependencies, env reads, side effects, and external systems using static analysis.
|
|
40
79
|
- **Semantic repo map**: adds a compact module-level map before file context so agents orient faster.
|
|
41
|
-
- **Freshness and deltas**: records task source, git state, snapshot hashes, selected-file deltas,
|
|
80
|
+
- **Freshness and deltas**: records task source, git state, snapshot hashes, selected-file deltas, stale-context warnings, MCP auto-refresh signals, and a machine-readable `agentpack:freshness` block in markdown fallback artifacts.
|
|
42
81
|
- **Agent integrations**: installs Claude Code, Cursor, Windsurf, Codex, Antigravity, VS Code tasks, git hooks, and MCP configuration.
|
|
43
82
|
- **Local and measurable**: no API calls for scan, summarize, rank, pack, stats, or benchmark; quality is measured with expected-file evals.
|
|
44
83
|
|
|
@@ -109,7 +148,19 @@ printf '%s\n' "fix auth token expiry" > .agentpack/task.md
|
|
|
109
148
|
agentpack pack
|
|
110
149
|
```
|
|
111
150
|
|
|
112
|
-
This creates `.agentpack/` state, installs the requested agent integration, generates a ranked context pack, and writes the adapter output for that agent.
|
|
151
|
+
This creates `.agentpack/` state, installs the requested agent integration, seeds `.agentignore` with safe defaults, imports obvious generated/noisy rules from git ignore sources, generates a ranked context pack, and writes the adapter output for that agent.
|
|
152
|
+
|
|
153
|
+
Task text matters. Good task text names the concrete feature, route, service, or file you are about to change. Bad task text uses repo-meta words like `improve context`, `pack quality`, `stats`, or `ignore`, which can pull README or tool internals by keyword.
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
# good
|
|
157
|
+
printf '%s\n' "fix billing webhook retry handling in app/api/billing/route.ts" > .agentpack/task.md
|
|
158
|
+
|
|
159
|
+
# too broad
|
|
160
|
+
printf '%s\n' "improve context pack quality from stats" > .agentpack/task.md
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
For active local work, keep context fresh with:
|
|
113
164
|
|
|
114
165
|
```bash
|
|
115
166
|
agentpack watch
|
|
@@ -149,7 +200,7 @@ AgentPack is best treated as a **ranked starting map**. It should reduce repeate
|
|
|
149
200
|
| Pack time | Seconds on a warm cache; first summarize pass is slower |
|
|
150
201
|
| Recall | Expected files appear near the top; validate with `agentpack benchmark --misses` |
|
|
151
202
|
| Precision | Good enough to reduce exploration; summaries and repo maps may still include noise |
|
|
152
|
-
| Freshness |
|
|
203
|
+
| Freshness | Task or repo-stale MCP reads auto-refresh; static packs are clearly marked by task, git, and snapshot checks |
|
|
153
204
|
|
|
154
205
|
Use real repo evals instead of trusting compression numbers:
|
|
155
206
|
|
|
@@ -202,17 +253,44 @@ agentpack explain --task "fix billing webhook" --budget-plan
|
|
|
202
253
|
|
|
203
254
|
This is the core reliability loop: pack, measure recall, inspect misses, then tune task wording, `.agentignore`, or scoring weights.
|
|
204
255
|
|
|
256
|
+
If top includes look noisy:
|
|
257
|
+
|
|
258
|
+
1. Rewrite `.agentpack/task.md` with concrete domain nouns, entrypoints, or filenames.
|
|
259
|
+
2. Re-pack and re-check `agentpack stats`.
|
|
260
|
+
3. If generated output still dominates, add that path to `.agentignore` or run `agentpack ignore sync`.
|
|
261
|
+
4. Use `agentpack explain --file <path>` on repeat offenders before changing scoring.
|
|
262
|
+
|
|
263
|
+
`.agentignore` is for AgentPack ranking noise, not general git hygiene. `agentpack init` seeds it with safe defaults and imports obvious generated/noisy entries from the root `.gitignore`, nested `.gitignore` files, `.git/info/exclude`, and your global git ignore when they look safe to carry over. You should still add repo-specific outputs such as deploy artifacts, exports, or generated SDK folders when they are not useful context.
|
|
264
|
+
|
|
265
|
+
When ignore sources change later, re-sync with:
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
agentpack ignore sync
|
|
269
|
+
agentpack ignore sync --dry-run
|
|
270
|
+
agentpack ignore sync --check
|
|
271
|
+
```
|
|
272
|
+
|
|
205
273
|
## MCP-First Workflow
|
|
206
274
|
|
|
207
275
|
For MCP-capable agents, the preferred workflow is pull-based:
|
|
208
276
|
|
|
209
277
|
1. Call `start_task(task)` when a new task begins. AgentPack writes `.agentpack/task.md`, packs context, and returns ranked markdown.
|
|
210
|
-
2. Call `get_context()` when you need the latest
|
|
278
|
+
2. Call `get_context()` when you need the latest pack. It blocks for one refresh if `.agentpack/task.md` or the repo snapshot changed since the last pack, and otherwise prepends a freshness header.
|
|
211
279
|
3. Call `get_delta_context()` after edits or hook hints to see what changed without loading the full pack.
|
|
212
280
|
4. Call `explain_file(path)` or `get_related_files(path)` when a file looks relevant or suspicious.
|
|
213
281
|
|
|
214
282
|
The CLI remains the setup/debug/release path. MCP is the best interactive path because the agent can ask for only the context it needs instead of relying on one static startup blob.
|
|
215
283
|
|
|
284
|
+
Markdown context files are fallback artifacts for CI, logs, manual review, and non-MCP agents. Every rendered pack includes a machine-readable `agentpack:freshness` comment; agents should treat `active_context: mcp` as the preferred path and refresh before using markdown when `refresh_required: true`.
|
|
285
|
+
|
|
286
|
+
For non-MCP agents, use the executable guard before editing:
|
|
287
|
+
|
|
288
|
+
```bash
|
|
289
|
+
agentpack guard --agent auto --repair-stale --refresh-context
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
`guard` checks pack freshness, task freshness, repo snapshot freshness, and installed agent rules/hooks. With `--repair-stale --refresh-context`, it repairs stale AgentPack rule files and refreshes missing or stale context before returning success. `agentpack pack` also self-heals stale AgentPack rule blocks for the active agent, so older installs that still run `pack` get upgraded opportunistically.
|
|
293
|
+
|
|
216
294
|
## Before / After Agent Behavior
|
|
217
295
|
|
|
218
296
|
Without AgentPack:
|
|
@@ -326,7 +404,7 @@ _*`--agent generic` outputs standard markdown. Claude adapter has richer instruc
|
|
|
326
404
|
|
|
327
405
|
- AgentPack cannot intercept prompts inside IDEs — Cursor/Windsurf rely on rules being followed.
|
|
328
406
|
- Claude wrapper (`agentpack claude`) is the most deterministic integration.
|
|
329
|
-
- If the task changes drastically mid-session,
|
|
407
|
+
- If the task changes drastically mid-session, Claude hooks update `.agentpack/task.md` and block once for fresh hints; plain repo edits still use background repack to keep prompts fast.
|
|
330
408
|
- AgentPack-selected files are ranked starting points, not absolute truth.
|
|
331
409
|
|
|
332
410
|
---
|
|
@@ -694,6 +772,36 @@ agentpack repair --agent all # repair every supported integration
|
|
|
694
772
|
|
|
695
773
|
---
|
|
696
774
|
|
|
775
|
+
### `agentpack guard`
|
|
776
|
+
|
|
777
|
+
Run the pre-edit safety gate an agent can execute instead of only reading instructions.
|
|
778
|
+
|
|
779
|
+
```bash
|
|
780
|
+
agentpack guard # check current agent + context
|
|
781
|
+
agentpack guard --refresh-context # refresh stale/missing context
|
|
782
|
+
agentpack guard --agent codex --repair-stale # repair stale Codex rules/hooks
|
|
783
|
+
agentpack guard --agent auto --repair-stale --refresh-context
|
|
784
|
+
```
|
|
785
|
+
|
|
786
|
+
This is the strongest non-native enforcement AgentPack can provide: tools that run commands get a failing exit code when context is unsafe, and an automatic repair/refresh path when allowed.
|
|
787
|
+
|
|
788
|
+
---
|
|
789
|
+
|
|
790
|
+
### `agentpack migrate`
|
|
791
|
+
|
|
792
|
+
Repair stale AgentPack integrations across existing repos after upgrading.
|
|
793
|
+
|
|
794
|
+
```bash
|
|
795
|
+
agentpack migrate --path . --agent auto
|
|
796
|
+
agentpack migrate --path ~/src --discover --agent all
|
|
797
|
+
agentpack migrate --path ~/src --discover --agent codex --refresh-context
|
|
798
|
+
agentpack migrate --path ~/src --discover --dry-run
|
|
799
|
+
```
|
|
800
|
+
|
|
801
|
+
Use this when older repos still have stale `.cursorrules`, `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, `.windsurfrules`, VS Code tasks, or hook files. `--discover` scans nested repo folders, `--dry-run` reports without writing, and `--refresh-context` regenerates packs after repair.
|
|
802
|
+
|
|
803
|
+
---
|
|
804
|
+
|
|
697
805
|
### `agentpack summarize`
|
|
698
806
|
|
|
699
807
|
Build or refresh the offline summary cache. **No API calls, ever.**
|
|
@@ -777,6 +885,20 @@ agentpack quickstart --task "fix auth token expiry" --write
|
|
|
777
885
|
|
|
778
886
|
---
|
|
779
887
|
|
|
888
|
+
### `agentpack ignore sync`
|
|
889
|
+
|
|
890
|
+
Refresh imported generated/noisy rules inside `.agentignore` without touching your manual entries.
|
|
891
|
+
|
|
892
|
+
```bash
|
|
893
|
+
agentpack ignore sync
|
|
894
|
+
agentpack ignore sync --dry-run
|
|
895
|
+
agentpack ignore sync --check
|
|
896
|
+
```
|
|
897
|
+
|
|
898
|
+
Use this after editing `.gitignore`, nested workspace ignores, or `.git/info/exclude`. `doctor` also warns when the imported `.agentignore` block is stale.
|
|
899
|
+
|
|
900
|
+
---
|
|
901
|
+
|
|
780
902
|
### `agentpack watch`
|
|
781
903
|
|
|
782
904
|
Watch for file and task changes, refresh context automatically.
|
|
@@ -842,18 +964,38 @@ Register in Claude Code settings (`~/.claude/settings.json`):
|
|
|
842
964
|
|---|---|
|
|
843
965
|
| `start_task(task, mode, budget, max_tokens)` | Recommended MCP-first entry point. Writes `.agentpack/task.md`, generates a ranked pack, and returns packed markdown. |
|
|
844
966
|
| `pack_context(task, mode, budget, max_tokens)` | Generate a ranked context pack. If `task` is provided, writes it to `.agentpack/task.md`; if omitted, reads `task.md` or infers from git. |
|
|
845
|
-
| `get_context()` | Return the latest
|
|
967
|
+
| `get_context()` | Return the latest pack. If `.agentpack/task.md` or the repo snapshot differs from the packed metadata, it auto-refreshes before returning; otherwise it prepends a freshness header. |
|
|
846
968
|
| `refresh()` | Refresh using the current `task.md` or git-inferred task. |
|
|
847
969
|
| `explain_file(path, task)` | Show score, inclusion mode, reasons, symbols, imports, and importers for one file. |
|
|
848
970
|
| `get_related_files(path, depth)` | Return import-graph neighbours and related tests for a file. |
|
|
849
971
|
| `get_delta_context(max_files)` | Return the latest selected-file delta plus top current selected files. Useful for cheap prompt-time refresh checks. |
|
|
850
972
|
| `get_stats()` | Return latest pack stats, savings, selection quality, excluded files, and benchmark-style signals. |
|
|
851
973
|
|
|
852
|
-
**Staleness detection:** `get_context()` compares the snapshot hash
|
|
974
|
+
**Staleness detection:** `get_context()` compares the current task file, snapshot hash, and git state against the latest pack metadata. If `.agentpack/task.md` or the repo snapshot changed, it blocks for a fresh pack and prepends:
|
|
975
|
+
|
|
853
976
|
```
|
|
854
|
-
>
|
|
977
|
+
> Context auto-refreshed because .agentpack/task.md differs from the packed task ...
|
|
855
978
|
```
|
|
856
979
|
|
|
980
|
+
If auto-refresh fails, it falls back to the cached context with a loud stale warning and asks the agent to call `pack_context()` again.
|
|
981
|
+
|
|
982
|
+
Static markdown cannot refresh itself, so rendered packs include a machine-readable fallback header:
|
|
983
|
+
|
|
984
|
+
```text
|
|
985
|
+
<!-- agentpack:freshness
|
|
986
|
+
{
|
|
987
|
+
"active_context": "mcp",
|
|
988
|
+
"fallback_context": "markdown",
|
|
989
|
+
"refresh_required": false,
|
|
990
|
+
"mcp_refresh_tool": "agentpack_get_context",
|
|
991
|
+
"cli_refresh_command": "agentpack pack --task auto",
|
|
992
|
+
"guard_command": "agentpack guard --agent auto --repair-stale --refresh-context"
|
|
993
|
+
}
|
|
994
|
+
-->
|
|
995
|
+
```
|
|
996
|
+
|
|
997
|
+
Claude prompt hooks also block once on clear task switches so first-turn hints are fresh. Non-MCP rule files and VS Code folder-open tasks use `agentpack guard --repair-stale --refresh-context` as the executable fallback. To prefer lower latency over first-turn freshness, set `blocking_task_refresh = false` under `[hooks]` in `.agentpack/config.toml`.
|
|
998
|
+
|
|
857
999
|
**Smart truncation:** `start_task()` and `pack_context()` keep headers intact and trim file content blocks to fit the token budget, appending a note about how many files were omitted.
|
|
858
1000
|
|
|
859
1001
|
Zero API calls — all analysis is offline. Summary cache keyed by file hash: cold run parallelises AST parsing across CPU cores; warm cache hits are instant.
|
|
@@ -1405,6 +1547,13 @@ src/agentpack/
|
|
|
1405
1547
|
vscode_tasks.py # install/remove .vscode/tasks.json entries
|
|
1406
1548
|
global_install.py # global: git template hooks + shell rc hook
|
|
1407
1549
|
|
|
1550
|
+
../native-integrations/ # tracked native-enforcement skeletons and blocked-status stubs
|
|
1551
|
+
status.json # machine-readable native host enforcement status
|
|
1552
|
+
cursor-extension/ # VS Code-style Cursor guard skeleton
|
|
1553
|
+
windsurf-extension/ # VS Code-style Windsurf guard skeleton
|
|
1554
|
+
claude-native/ # blocked native stub pending mandatory host API
|
|
1555
|
+
codex-native/ # blocked native stub pending mandatory host API
|
|
1556
|
+
|
|
1408
1557
|
renderers/
|
|
1409
1558
|
markdown.py # renders pre-redacted ContextPack to markdown, including freshness/map/delta
|
|
1410
1559
|
compact.py # compact protocol format for session context files
|
|
@@ -1457,7 +1606,8 @@ src/agentpack/
|
|
|
1457
1606
|
- **`integrations/` vs `core/`**: git hooks, shell rc patching, and VS Code tasks are infrastructure concerns — they live in `integrations/`, not `core/`. `core/` is pure domain logic.
|
|
1458
1607
|
- **Adapters render; installers configure**: `adapters/` knows how to write a context file for an agent. `installers/` knows how to configure the agent's tool (CLAUDE.md, .cursorrules, settings.json). They are separate concerns and separate classes.
|
|
1459
1608
|
- **Agent integration contract is shared**: `integrations/agents.py` defines install, audit, and repair behavior for Claude, Cursor, Windsurf, Codex, Antigravity, and Generic. `install`, `repair`, `doctor --agent all`, and release verification use the same contract.
|
|
1460
|
-
- **MCP is the interactive path**: `start_task()` writes task state and returns a fresh pack, while `get_context()
|
|
1609
|
+
- **MCP is the interactive path**: `start_task()` writes task state and returns a fresh pack, while `get_context()` auto-refreshes stale task or repo-snapshot context and `get_delta_context()`, `explain_file()`, and `get_related_files()` let agents pull follow-up context on demand.
|
|
1610
|
+
- **Native enforcement status is explicit**: `native-integrations/status.json` tracks host skeletons and blockers. Entries stay `guarded`, not `enforced`, until a host exposes mandatory pre-edit/pre-tool hooks that can block failed guard checks.
|
|
1461
1611
|
|
|
1462
1612
|
---
|
|
1463
1613
|
|
|
@@ -1482,6 +1632,7 @@ src/agentpack/
|
|
|
1482
1632
|
- **Secret redaction**: covers AWS keys, GitHub tokens, OpenAI/Anthropic keys, JWTs, and private key blocks. Not a substitute for a dedicated secrets scanner on sensitive repos.
|
|
1483
1633
|
- **Token estimates**: uses tiktoken `cl100k_base` — approximate, not exact for Claude's billing.
|
|
1484
1634
|
- **Large repos (>5k files)**: global auto-bootstrap is skipped for repos over 5,000 files to avoid hangs. Run `agentpack init` explicitly in large codebases.
|
|
1635
|
+
- **Native hard enforcement**: tracked skeletons exist under `native-integrations/`, but all hosts remain `guarded` until their native APIs can guarantee mandatory pre-edit/pre-tool execution and block failed guard checks.
|
|
1485
1636
|
|
|
1486
1637
|
---
|
|
1487
1638
|
|
|
@@ -1,42 +1,3 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: agentpack-cli
|
|
3
|
-
Version: 0.3.4
|
|
4
|
-
Summary: Local context engine for AI coding agents that ranks relevant files and builds task-focused context packs.
|
|
5
|
-
License: MIT
|
|
6
|
-
License-File: LICENSE
|
|
7
|
-
Keywords: ai,ai-coding-agents,antigravity,ci,claude,claude-code,codex,context,context-engine,context-packing,cursor,developer-tools,llm,mcp,packing,prompt-context,repo-analysis,windsurf
|
|
8
|
-
Classifier: Development Status :: 3 - Alpha
|
|
9
|
-
Classifier: Intended Audience :: Developers
|
|
10
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
-
Classifier: Topic :: Software Development :: Build Tools
|
|
16
|
-
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
17
|
-
Requires-Python: >=3.10
|
|
18
|
-
Requires-Dist: pathspec>=0.12.1
|
|
19
|
-
Requires-Dist: pydantic>=2.0.0
|
|
20
|
-
Requires-Dist: rich>=13.0.0
|
|
21
|
-
Requires-Dist: tiktoken>=0.7.0
|
|
22
|
-
Requires-Dist: tomli-w>=1.0.0
|
|
23
|
-
Requires-Dist: tomli>=2.0.0; python_version < '3.11'
|
|
24
|
-
Requires-Dist: typer>=0.12.0
|
|
25
|
-
Provides-Extra: all
|
|
26
|
-
Requires-Dist: mcp>=1.0.0; extra == 'all'
|
|
27
|
-
Requires-Dist: watchdog>=4.0.0; extra == 'all'
|
|
28
|
-
Provides-Extra: dev
|
|
29
|
-
Requires-Dist: mypy; extra == 'dev'
|
|
30
|
-
Requires-Dist: pytest; extra == 'dev'
|
|
31
|
-
Requires-Dist: pytest-cov; extra == 'dev'
|
|
32
|
-
Requires-Dist: ruff; extra == 'dev'
|
|
33
|
-
Requires-Dist: tomli>=2.0.0; (python_version < '3.11') and extra == 'dev'
|
|
34
|
-
Provides-Extra: mcp
|
|
35
|
-
Requires-Dist: mcp>=1.0.0; extra == 'mcp'
|
|
36
|
-
Provides-Extra: watch
|
|
37
|
-
Requires-Dist: watchdog>=4.0.0; extra == 'watch'
|
|
38
|
-
Description-Content-Type: text/markdown
|
|
39
|
-
|
|
40
1
|
# AgentPack
|
|
41
2
|
|
|
42
3
|
[](https://pypi.org/project/agentpack-cli/)
|
|
@@ -46,7 +7,7 @@ Description-Content-Type: text/markdown
|
|
|
46
7
|
[](https://opensource.org/licenses/MIT)
|
|
47
8
|
[](https://github.com/vishal2612200/agentpack/actions/workflows/ci.yml)
|
|
48
9
|
|
|
49
|
-
> **Status: alpha (v0.3.
|
|
10
|
+
> **Status: alpha (v0.3.8).** Works, tested, used in real sessions. Python and JavaScript/TypeScript are the best-supported languages. Public benchmark proof exists for the current suite, but broader repo coverage is still growing. API may change before 1.0.
|
|
50
11
|
>
|
|
51
12
|
> **Platform note:** macOS, Linux, and Windows are supported. Windows support targets PowerShell plus Git for Windows. `cmd.exe` and bare Git setups are not a supported path yet.
|
|
52
13
|
|
|
@@ -77,7 +38,7 @@ Use AgentPack when a repo is too large to paste and you want faster, more consis
|
|
|
77
38
|
- **Budget-aware compression**: emits `full`, `diff`, `symbols`, `skeleton`, or `summary` views instead of all-or-nothing file dumps.
|
|
78
39
|
- **Local code intelligence**: extracts roles, domains, entrypoints, definitions, dependencies, env reads, side effects, and external systems using static analysis.
|
|
79
40
|
- **Semantic repo map**: adds a compact module-level map before file context so agents orient faster.
|
|
80
|
-
- **Freshness and deltas**: records task source, git state, snapshot hashes, selected-file deltas,
|
|
41
|
+
- **Freshness and deltas**: records task source, git state, snapshot hashes, selected-file deltas, stale-context warnings, MCP auto-refresh signals, and a machine-readable `agentpack:freshness` block in markdown fallback artifacts.
|
|
81
42
|
- **Agent integrations**: installs Claude Code, Cursor, Windsurf, Codex, Antigravity, VS Code tasks, git hooks, and MCP configuration.
|
|
82
43
|
- **Local and measurable**: no API calls for scan, summarize, rank, pack, stats, or benchmark; quality is measured with expected-file evals.
|
|
83
44
|
|
|
@@ -148,7 +109,19 @@ printf '%s\n' "fix auth token expiry" > .agentpack/task.md
|
|
|
148
109
|
agentpack pack
|
|
149
110
|
```
|
|
150
111
|
|
|
151
|
-
This creates `.agentpack/` state, installs the requested agent integration, generates a ranked context pack, and writes the adapter output for that agent.
|
|
112
|
+
This creates `.agentpack/` state, installs the requested agent integration, seeds `.agentignore` with safe defaults, imports obvious generated/noisy rules from git ignore sources, generates a ranked context pack, and writes the adapter output for that agent.
|
|
113
|
+
|
|
114
|
+
Task text matters. Good task text names the concrete feature, route, service, or file you are about to change. Bad task text uses repo-meta words like `improve context`, `pack quality`, `stats`, or `ignore`, which can pull README or tool internals by keyword.
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# good
|
|
118
|
+
printf '%s\n' "fix billing webhook retry handling in app/api/billing/route.ts" > .agentpack/task.md
|
|
119
|
+
|
|
120
|
+
# too broad
|
|
121
|
+
printf '%s\n' "improve context pack quality from stats" > .agentpack/task.md
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
For active local work, keep context fresh with:
|
|
152
125
|
|
|
153
126
|
```bash
|
|
154
127
|
agentpack watch
|
|
@@ -188,7 +161,7 @@ AgentPack is best treated as a **ranked starting map**. It should reduce repeate
|
|
|
188
161
|
| Pack time | Seconds on a warm cache; first summarize pass is slower |
|
|
189
162
|
| Recall | Expected files appear near the top; validate with `agentpack benchmark --misses` |
|
|
190
163
|
| Precision | Good enough to reduce exploration; summaries and repo maps may still include noise |
|
|
191
|
-
| Freshness |
|
|
164
|
+
| Freshness | Task or repo-stale MCP reads auto-refresh; static packs are clearly marked by task, git, and snapshot checks |
|
|
192
165
|
|
|
193
166
|
Use real repo evals instead of trusting compression numbers:
|
|
194
167
|
|
|
@@ -241,17 +214,44 @@ agentpack explain --task "fix billing webhook" --budget-plan
|
|
|
241
214
|
|
|
242
215
|
This is the core reliability loop: pack, measure recall, inspect misses, then tune task wording, `.agentignore`, or scoring weights.
|
|
243
216
|
|
|
217
|
+
If top includes look noisy:
|
|
218
|
+
|
|
219
|
+
1. Rewrite `.agentpack/task.md` with concrete domain nouns, entrypoints, or filenames.
|
|
220
|
+
2. Re-pack and re-check `agentpack stats`.
|
|
221
|
+
3. If generated output still dominates, add that path to `.agentignore` or run `agentpack ignore sync`.
|
|
222
|
+
4. Use `agentpack explain --file <path>` on repeat offenders before changing scoring.
|
|
223
|
+
|
|
224
|
+
`.agentignore` is for AgentPack ranking noise, not general git hygiene. `agentpack init` seeds it with safe defaults and imports obvious generated/noisy entries from the root `.gitignore`, nested `.gitignore` files, `.git/info/exclude`, and your global git ignore when they look safe to carry over. You should still add repo-specific outputs such as deploy artifacts, exports, or generated SDK folders when they are not useful context.
|
|
225
|
+
|
|
226
|
+
When ignore sources change later, re-sync with:
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
agentpack ignore sync
|
|
230
|
+
agentpack ignore sync --dry-run
|
|
231
|
+
agentpack ignore sync --check
|
|
232
|
+
```
|
|
233
|
+
|
|
244
234
|
## MCP-First Workflow
|
|
245
235
|
|
|
246
236
|
For MCP-capable agents, the preferred workflow is pull-based:
|
|
247
237
|
|
|
248
238
|
1. Call `start_task(task)` when a new task begins. AgentPack writes `.agentpack/task.md`, packs context, and returns ranked markdown.
|
|
249
|
-
2. Call `get_context()` when you need the latest
|
|
239
|
+
2. Call `get_context()` when you need the latest pack. It blocks for one refresh if `.agentpack/task.md` or the repo snapshot changed since the last pack, and otherwise prepends a freshness header.
|
|
250
240
|
3. Call `get_delta_context()` after edits or hook hints to see what changed without loading the full pack.
|
|
251
241
|
4. Call `explain_file(path)` or `get_related_files(path)` when a file looks relevant or suspicious.
|
|
252
242
|
|
|
253
243
|
The CLI remains the setup/debug/release path. MCP is the best interactive path because the agent can ask for only the context it needs instead of relying on one static startup blob.
|
|
254
244
|
|
|
245
|
+
Markdown context files are fallback artifacts for CI, logs, manual review, and non-MCP agents. Every rendered pack includes a machine-readable `agentpack:freshness` comment; agents should treat `active_context: mcp` as the preferred path and refresh before using markdown when `refresh_required: true`.
|
|
246
|
+
|
|
247
|
+
For non-MCP agents, use the executable guard before editing:
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
agentpack guard --agent auto --repair-stale --refresh-context
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
`guard` checks pack freshness, task freshness, repo snapshot freshness, and installed agent rules/hooks. With `--repair-stale --refresh-context`, it repairs stale AgentPack rule files and refreshes missing or stale context before returning success. `agentpack pack` also self-heals stale AgentPack rule blocks for the active agent, so older installs that still run `pack` get upgraded opportunistically.
|
|
254
|
+
|
|
255
255
|
## Before / After Agent Behavior
|
|
256
256
|
|
|
257
257
|
Without AgentPack:
|
|
@@ -365,7 +365,7 @@ _*`--agent generic` outputs standard markdown. Claude adapter has richer instruc
|
|
|
365
365
|
|
|
366
366
|
- AgentPack cannot intercept prompts inside IDEs — Cursor/Windsurf rely on rules being followed.
|
|
367
367
|
- Claude wrapper (`agentpack claude`) is the most deterministic integration.
|
|
368
|
-
- If the task changes drastically mid-session,
|
|
368
|
+
- If the task changes drastically mid-session, Claude hooks update `.agentpack/task.md` and block once for fresh hints; plain repo edits still use background repack to keep prompts fast.
|
|
369
369
|
- AgentPack-selected files are ranked starting points, not absolute truth.
|
|
370
370
|
|
|
371
371
|
---
|
|
@@ -733,6 +733,36 @@ agentpack repair --agent all # repair every supported integration
|
|
|
733
733
|
|
|
734
734
|
---
|
|
735
735
|
|
|
736
|
+
### `agentpack guard`
|
|
737
|
+
|
|
738
|
+
Run the pre-edit safety gate an agent can execute instead of only reading instructions.
|
|
739
|
+
|
|
740
|
+
```bash
|
|
741
|
+
agentpack guard # check current agent + context
|
|
742
|
+
agentpack guard --refresh-context # refresh stale/missing context
|
|
743
|
+
agentpack guard --agent codex --repair-stale # repair stale Codex rules/hooks
|
|
744
|
+
agentpack guard --agent auto --repair-stale --refresh-context
|
|
745
|
+
```
|
|
746
|
+
|
|
747
|
+
This is the strongest non-native enforcement AgentPack can provide: tools that run commands get a failing exit code when context is unsafe, and an automatic repair/refresh path when allowed.
|
|
748
|
+
|
|
749
|
+
---
|
|
750
|
+
|
|
751
|
+
### `agentpack migrate`
|
|
752
|
+
|
|
753
|
+
Repair stale AgentPack integrations across existing repos after upgrading.
|
|
754
|
+
|
|
755
|
+
```bash
|
|
756
|
+
agentpack migrate --path . --agent auto
|
|
757
|
+
agentpack migrate --path ~/src --discover --agent all
|
|
758
|
+
agentpack migrate --path ~/src --discover --agent codex --refresh-context
|
|
759
|
+
agentpack migrate --path ~/src --discover --dry-run
|
|
760
|
+
```
|
|
761
|
+
|
|
762
|
+
Use this when older repos still have stale `.cursorrules`, `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, `.windsurfrules`, VS Code tasks, or hook files. `--discover` scans nested repo folders, `--dry-run` reports without writing, and `--refresh-context` regenerates packs after repair.
|
|
763
|
+
|
|
764
|
+
---
|
|
765
|
+
|
|
736
766
|
### `agentpack summarize`
|
|
737
767
|
|
|
738
768
|
Build or refresh the offline summary cache. **No API calls, ever.**
|
|
@@ -816,6 +846,20 @@ agentpack quickstart --task "fix auth token expiry" --write
|
|
|
816
846
|
|
|
817
847
|
---
|
|
818
848
|
|
|
849
|
+
### `agentpack ignore sync`
|
|
850
|
+
|
|
851
|
+
Refresh imported generated/noisy rules inside `.agentignore` without touching your manual entries.
|
|
852
|
+
|
|
853
|
+
```bash
|
|
854
|
+
agentpack ignore sync
|
|
855
|
+
agentpack ignore sync --dry-run
|
|
856
|
+
agentpack ignore sync --check
|
|
857
|
+
```
|
|
858
|
+
|
|
859
|
+
Use this after editing `.gitignore`, nested workspace ignores, or `.git/info/exclude`. `doctor` also warns when the imported `.agentignore` block is stale.
|
|
860
|
+
|
|
861
|
+
---
|
|
862
|
+
|
|
819
863
|
### `agentpack watch`
|
|
820
864
|
|
|
821
865
|
Watch for file and task changes, refresh context automatically.
|
|
@@ -881,18 +925,38 @@ Register in Claude Code settings (`~/.claude/settings.json`):
|
|
|
881
925
|
|---|---|
|
|
882
926
|
| `start_task(task, mode, budget, max_tokens)` | Recommended MCP-first entry point. Writes `.agentpack/task.md`, generates a ranked pack, and returns packed markdown. |
|
|
883
927
|
| `pack_context(task, mode, budget, max_tokens)` | Generate a ranked context pack. If `task` is provided, writes it to `.agentpack/task.md`; if omitted, reads `task.md` or infers from git. |
|
|
884
|
-
| `get_context()` | Return the latest
|
|
928
|
+
| `get_context()` | Return the latest pack. If `.agentpack/task.md` or the repo snapshot differs from the packed metadata, it auto-refreshes before returning; otherwise it prepends a freshness header. |
|
|
885
929
|
| `refresh()` | Refresh using the current `task.md` or git-inferred task. |
|
|
886
930
|
| `explain_file(path, task)` | Show score, inclusion mode, reasons, symbols, imports, and importers for one file. |
|
|
887
931
|
| `get_related_files(path, depth)` | Return import-graph neighbours and related tests for a file. |
|
|
888
932
|
| `get_delta_context(max_files)` | Return the latest selected-file delta plus top current selected files. Useful for cheap prompt-time refresh checks. |
|
|
889
933
|
| `get_stats()` | Return latest pack stats, savings, selection quality, excluded files, and benchmark-style signals. |
|
|
890
934
|
|
|
891
|
-
**Staleness detection:** `get_context()` compares the snapshot hash
|
|
935
|
+
**Staleness detection:** `get_context()` compares the current task file, snapshot hash, and git state against the latest pack metadata. If `.agentpack/task.md` or the repo snapshot changed, it blocks for a fresh pack and prepends:
|
|
936
|
+
|
|
892
937
|
```
|
|
893
|
-
>
|
|
938
|
+
> Context auto-refreshed because .agentpack/task.md differs from the packed task ...
|
|
894
939
|
```
|
|
895
940
|
|
|
941
|
+
If auto-refresh fails, it falls back to the cached context with a loud stale warning and asks the agent to call `pack_context()` again.
|
|
942
|
+
|
|
943
|
+
Static markdown cannot refresh itself, so rendered packs include a machine-readable fallback header:
|
|
944
|
+
|
|
945
|
+
```text
|
|
946
|
+
<!-- agentpack:freshness
|
|
947
|
+
{
|
|
948
|
+
"active_context": "mcp",
|
|
949
|
+
"fallback_context": "markdown",
|
|
950
|
+
"refresh_required": false,
|
|
951
|
+
"mcp_refresh_tool": "agentpack_get_context",
|
|
952
|
+
"cli_refresh_command": "agentpack pack --task auto",
|
|
953
|
+
"guard_command": "agentpack guard --agent auto --repair-stale --refresh-context"
|
|
954
|
+
}
|
|
955
|
+
-->
|
|
956
|
+
```
|
|
957
|
+
|
|
958
|
+
Claude prompt hooks also block once on clear task switches so first-turn hints are fresh. Non-MCP rule files and VS Code folder-open tasks use `agentpack guard --repair-stale --refresh-context` as the executable fallback. To prefer lower latency over first-turn freshness, set `blocking_task_refresh = false` under `[hooks]` in `.agentpack/config.toml`.
|
|
959
|
+
|
|
896
960
|
**Smart truncation:** `start_task()` and `pack_context()` keep headers intact and trim file content blocks to fit the token budget, appending a note about how many files were omitted.
|
|
897
961
|
|
|
898
962
|
Zero API calls — all analysis is offline. Summary cache keyed by file hash: cold run parallelises AST parsing across CPU cores; warm cache hits are instant.
|
|
@@ -1444,6 +1508,13 @@ src/agentpack/
|
|
|
1444
1508
|
vscode_tasks.py # install/remove .vscode/tasks.json entries
|
|
1445
1509
|
global_install.py # global: git template hooks + shell rc hook
|
|
1446
1510
|
|
|
1511
|
+
../native-integrations/ # tracked native-enforcement skeletons and blocked-status stubs
|
|
1512
|
+
status.json # machine-readable native host enforcement status
|
|
1513
|
+
cursor-extension/ # VS Code-style Cursor guard skeleton
|
|
1514
|
+
windsurf-extension/ # VS Code-style Windsurf guard skeleton
|
|
1515
|
+
claude-native/ # blocked native stub pending mandatory host API
|
|
1516
|
+
codex-native/ # blocked native stub pending mandatory host API
|
|
1517
|
+
|
|
1447
1518
|
renderers/
|
|
1448
1519
|
markdown.py # renders pre-redacted ContextPack to markdown, including freshness/map/delta
|
|
1449
1520
|
compact.py # compact protocol format for session context files
|
|
@@ -1496,7 +1567,8 @@ src/agentpack/
|
|
|
1496
1567
|
- **`integrations/` vs `core/`**: git hooks, shell rc patching, and VS Code tasks are infrastructure concerns — they live in `integrations/`, not `core/`. `core/` is pure domain logic.
|
|
1497
1568
|
- **Adapters render; installers configure**: `adapters/` knows how to write a context file for an agent. `installers/` knows how to configure the agent's tool (CLAUDE.md, .cursorrules, settings.json). They are separate concerns and separate classes.
|
|
1498
1569
|
- **Agent integration contract is shared**: `integrations/agents.py` defines install, audit, and repair behavior for Claude, Cursor, Windsurf, Codex, Antigravity, and Generic. `install`, `repair`, `doctor --agent all`, and release verification use the same contract.
|
|
1499
|
-
- **MCP is the interactive path**: `start_task()` writes task state and returns a fresh pack, while `get_context()
|
|
1570
|
+
- **MCP is the interactive path**: `start_task()` writes task state and returns a fresh pack, while `get_context()` auto-refreshes stale task or repo-snapshot context and `get_delta_context()`, `explain_file()`, and `get_related_files()` let agents pull follow-up context on demand.
|
|
1571
|
+
- **Native enforcement status is explicit**: `native-integrations/status.json` tracks host skeletons and blockers. Entries stay `guarded`, not `enforced`, until a host exposes mandatory pre-edit/pre-tool hooks that can block failed guard checks.
|
|
1500
1572
|
|
|
1501
1573
|
---
|
|
1502
1574
|
|
|
@@ -1521,6 +1593,7 @@ src/agentpack/
|
|
|
1521
1593
|
- **Secret redaction**: covers AWS keys, GitHub tokens, OpenAI/Anthropic keys, JWTs, and private key blocks. Not a substitute for a dedicated secrets scanner on sensitive repos.
|
|
1522
1594
|
- **Token estimates**: uses tiktoken `cl100k_base` — approximate, not exact for Claude's billing.
|
|
1523
1595
|
- **Large repos (>5k files)**: global auto-bootstrap is skipped for repos over 5,000 files to avoid hangs. Run `agentpack init` explicitly in large codebases.
|
|
1596
|
+
- **Native hard enforcement**: tracked skeletons exist under `native-integrations/`, but all hosts remain `guarded` until their native APIs can guarantee mandatory pre-edit/pre-tool execution and block failed guard checks.
|
|
1524
1597
|
|
|
1525
1598
|
---
|
|
1526
1599
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "agentpack-cli"
|
|
3
|
-
version = "0.3.
|
|
3
|
+
version = "0.3.8"
|
|
4
4
|
description = "Local context engine for AI coding agents that ranks relevant files and builds task-focused context packs."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.10"
|
|
7
7
|
license = {text = "MIT"}
|
|
8
|
-
keywords = ["ai-coding-agents", "developer-tools", "repo-analysis", "context-engine", "context-packing", "prompt-context", "mcp", "ci", "
|
|
8
|
+
keywords = ["ai-coding-agents", "developer-tools", "repo-analysis", "context-engine", "context-packing", "prompt-context", "mcp", "ci", "codex", "cursor", "windsurf", "antigravity", "ai", "llm", "context", "packing"]
|
|
9
9
|
classifiers = [
|
|
10
10
|
"Development Status :: 3 - Alpha",
|
|
11
11
|
"Intended Audience :: Developers",
|
|
@@ -21,10 +21,12 @@ _GENERIC_TASK_TERMS = {
|
|
|
21
21
|
"add", "added", "change", "changed", "changes", "clean", "cleanup",
|
|
22
22
|
"code", "commit", "context", "debug", "dev", "development", "doc",
|
|
23
23
|
"docs", "eval", "evals", "feature", "fix", "freshness", "general",
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
24
|
+
"gap", "gaps", "generic", "impl", "implement", "implementation", "improve",
|
|
25
|
+
"issue", "metric", "metrics", "noise", "noisy", "package", "pack", "packs",
|
|
26
|
+
"quality", "release", "remaining", "repo", "root", "rule", "rules",
|
|
27
|
+
"source", "stat", "stats", "sync", "task", "tasks", "test", "tests",
|
|
28
|
+
"text", "update", "use", "useful", "usefulness", "version", "visibility",
|
|
29
|
+
"workflow", "workflows", "wording",
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
_CONCEPT_MAP: dict[str, frozenset[str]] = {
|