agentpack-cli 0.3.10__tar.gz → 0.3.11__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 (109) hide show
  1. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/PKG-INFO +70 -2
  2. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/README.md +69 -1
  3. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/pyproject.toml +1 -1
  4. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/__init__.py +1 -1
  5. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/cli.py +4 -0
  6. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/commands/mcp_cmd.py +1 -1
  7. agentpack_cli-0.3.11/src/agentpack/commands/route.py +29 -0
  8. agentpack_cli-0.3.11/src/agentpack/commands/skills.py +46 -0
  9. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/core/config.py +20 -0
  10. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/installers/antigravity.py +4 -3
  11. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/installers/claude.py +3 -2
  12. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/installers/codex.py +4 -3
  13. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/installers/cursor.py +8 -6
  14. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/mcp_server.py +46 -0
  15. agentpack_cli-0.3.11/src/agentpack/router/__init__.py +23 -0
  16. agentpack_cli-0.3.11/src/agentpack/router/discovery.py +106 -0
  17. agentpack_cli-0.3.11/src/agentpack/router/models.py +67 -0
  18. agentpack_cli-0.3.11/src/agentpack/router/parser.py +240 -0
  19. agentpack_cli-0.3.11/src/agentpack/router/prompt_builder.py +87 -0
  20. agentpack_cli-0.3.11/src/agentpack/router/scoring.py +110 -0
  21. agentpack_cli-0.3.11/src/agentpack/router/service.py +156 -0
  22. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/.gitignore +0 -0
  23. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/LICENSE +0 -0
  24. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/adapters/__init__.py +0 -0
  25. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/adapters/antigravity.py +0 -0
  26. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/adapters/base.py +0 -0
  27. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/adapters/claude.py +0 -0
  28. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/adapters/codex.py +0 -0
  29. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/adapters/cursor.py +0 -0
  30. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/adapters/detect.py +0 -0
  31. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/adapters/generic.py +0 -0
  32. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/adapters/windsurf.py +0 -0
  33. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/analysis/__init__.py +0 -0
  34. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/analysis/dependency_graph.py +0 -0
  35. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/analysis/go_imports.py +0 -0
  36. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/analysis/java_imports.py +0 -0
  37. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/analysis/js_ts_imports.py +0 -0
  38. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/analysis/monorepo.py +0 -0
  39. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/analysis/naming_signals.py +0 -0
  40. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/analysis/python_imports.py +0 -0
  41. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/analysis/ranking.py +0 -0
  42. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/analysis/repo_map.py +0 -0
  43. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/analysis/role_inference.py +0 -0
  44. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/analysis/rust_imports.py +0 -0
  45. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/analysis/symbols.py +0 -0
  46. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/analysis/task_classifier.py +0 -0
  47. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/analysis/tests.py +0 -0
  48. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/application/__init__.py +0 -0
  49. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/application/pack_service.py +0 -0
  50. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/commands/__init__.py +0 -0
  51. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/commands/_shared.py +0 -0
  52. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/commands/benchmark.py +0 -0
  53. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/commands/claude_cmd.py +0 -0
  54. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/commands/diff.py +0 -0
  55. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/commands/doctor.py +0 -0
  56. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/commands/eval_cmd.py +0 -0
  57. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/commands/explain.py +0 -0
  58. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/commands/guard.py +0 -0
  59. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/commands/hook_cmd.py +0 -0
  60. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/commands/ignore_cmd.py +0 -0
  61. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/commands/init.py +0 -0
  62. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/commands/install.py +0 -0
  63. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/commands/migrate.py +0 -0
  64. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/commands/monitor.py +0 -0
  65. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/commands/pack.py +0 -0
  66. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/commands/quickstart.py +0 -0
  67. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/commands/repair.py +0 -0
  68. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/commands/scan.py +0 -0
  69. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/commands/stats.py +0 -0
  70. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/commands/status.py +0 -0
  71. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/commands/summarize.py +0 -0
  72. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/commands/tune.py +0 -0
  73. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/commands/watch.py +0 -0
  74. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/core/__init__.py +0 -0
  75. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/core/bootstrap.py +0 -0
  76. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/core/cache.py +0 -0
  77. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/core/context_pack.py +0 -0
  78. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/core/diff.py +0 -0
  79. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/core/evals.py +0 -0
  80. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/core/git.py +0 -0
  81. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/core/git_hooks.py +0 -0
  82. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/core/global_install.py +0 -0
  83. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/core/ignore.py +0 -0
  84. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/core/merkle.py +0 -0
  85. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/core/models.py +0 -0
  86. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/core/redactor.py +0 -0
  87. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/core/scanner.py +0 -0
  88. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/core/snapshot.py +0 -0
  89. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/core/task_freshness.py +0 -0
  90. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/core/token_estimator.py +0 -0
  91. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/core/vscode_tasks.py +0 -0
  92. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/data/agentpack.md +0 -0
  93. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/installers/__init__.py +0 -0
  94. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/installers/windsurf.py +0 -0
  95. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/integrations/__init__.py +0 -0
  96. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/integrations/agents.py +0 -0
  97. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/integrations/git_hooks.py +0 -0
  98. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/integrations/global_install.py +0 -0
  99. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/integrations/platform.py +0 -0
  100. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/integrations/vscode_tasks.py +0 -0
  101. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/renderers/__init__.py +0 -0
  102. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/renderers/compact.py +0 -0
  103. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/renderers/markdown.py +0 -0
  104. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/renderers/receipts.py +0 -0
  105. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/session/__init__.py +0 -0
  106. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/session/state.py +0 -0
  107. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/summaries/__init__.py +0 -0
  108. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/summaries/base.py +0 -0
  109. {agentpack_cli-0.3.10 → agentpack_cli-0.3.11}/src/agentpack/summaries/offline.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agentpack-cli
3
- Version: 0.3.10
3
+ Version: 0.3.11
4
4
  Summary: Local context engine for AI coding agents that ranks relevant files and builds task-focused context packs.
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -47,7 +47,7 @@ Description-Content-Type: text/markdown
47
47
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
48
48
  [![CI](https://github.com/vishal2612200/agentpack/actions/workflows/ci.yml/badge.svg)](https://github.com/vishal2612200/agentpack/actions/workflows/ci.yml)
49
49
 
50
- > **Status: alpha (v0.3.10).** 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
+ > **Status: alpha (v0.3.11).** 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.
51
51
  >
52
52
  > **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.
53
53
 
@@ -65,6 +65,7 @@ Use AgentPack when a repo is too large to paste and you want faster, more consis
65
65
  - [Quality Bar](#quality-bar)
66
66
  - [Download Stats](#download-stats)
67
67
  - [Debugging Selection](#debugging-selection)
68
+ - [Task Router](#task-router)
68
69
  - [Supported Integrations](#supported-integrations)
69
70
  - [Commands](#commands)
70
71
  - [Architecture](#architecture)
@@ -79,6 +80,7 @@ Use AgentPack when a repo is too large to paste and you want faster, more consis
79
80
  - **Local code intelligence**: extracts roles, domains, entrypoints, definitions, dependencies, env reads, side effects, and external systems using static analysis.
80
81
  - **Semantic repo map**: adds a compact module-level map before file context so agents orient faster.
81
82
  - **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.
83
+ - **Task router**: MCP and CLI surfaces route a task to relevant files, scoped rules, installed skills, suggested commands, and safety warnings without executing skills automatically.
82
84
  - **Agent integrations**: installs Claude Code, Cursor, Windsurf, Codex, Antigravity, VS Code tasks, git hooks, and MCP configuration.
83
85
  - **Local and measurable**: no API calls for scan, summarize, rank, pack, stats, or benchmark; quality is measured with expected-file evals.
84
86
 
@@ -292,6 +294,40 @@ agentpack guard --agent auto --repair-stale --refresh-context
292
294
 
293
295
  `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.
294
296
 
297
+ ## Task Router
298
+
299
+ AgentPack Router is the MCP-first path for agents that need a task map before loading full context. It returns:
300
+
301
+ - files to read first
302
+ - repo and tool rules to apply
303
+ - installed skills to consider
304
+ - commands to consider, never execute automatically
305
+ - safety warnings for external side-effect skills
306
+ - an agent-ready prompt block
307
+
308
+ Use MCP when available:
309
+
310
+ ```text
311
+ route_task("fix flaky payment webhook test")
312
+ ```
313
+
314
+ Use CLI for inspection or scripting:
315
+
316
+ ```bash
317
+ agentpack skills scan
318
+ agentpack skills index
319
+ agentpack route --task "fix flaky payment webhook test"
320
+ agentpack route --task "fix flaky payment webhook test" --format json
321
+ ```
322
+
323
+ Router reads skills and rules from `.claude/skills/`, `~/.claude/skills/`, `~/.codex/skills/`, `~/.agents/skills/`, `.agentpack/skills/`, `.cursor/rules/`, `AGENTS.md`, `CLAUDE.md`, and `GEMINI.md`. Rules are mandatory scoped instructions; skills are optional recommendations. The local `.agentpack/skills_index.json` stores metadata only and omits raw skill/rule bodies.
324
+
325
+ Safety defaults:
326
+
327
+ - skills are recommended, not executed
328
+ - suggested commands are returned as strings with reasons
329
+ - external side-effect skills, such as deploy or cloud mutation checklists, are warned and not selected unless explicitly allowed in config
330
+
295
331
  ## Before / After Agent Behavior
296
332
 
297
333
  Without AgentPack:
@@ -598,6 +634,9 @@ Command map:
598
634
  | `agentpack install` | Refresh or add an agent integration without changing project state |
599
635
  | `agentpack repair` | Restore missing or drifted integration files |
600
636
  | `agentpack pack` | Generate a ranked context pack for one task |
637
+ | `agentpack route` | Route a task to files, rules, skills, commands, and safety warnings |
638
+ | `agentpack skills scan` | Print discovered local/global skills and rules |
639
+ | `agentpack skills index` | Write `.agentpack/skills_index.json` metadata for faster routing |
601
640
  | `agentpack watch` | Keep the context pack fresh while you work |
602
641
  | `agentpack doctor` | Audit hooks, agent files, CLI path, and repo health |
603
642
  | `agentpack explain` | Understand why a file was selected or omitted |
@@ -895,6 +934,32 @@ This keeps unrelated dirty files from consuming the whole context budget while p
895
934
 
896
935
  ---
897
936
 
937
+ ### `agentpack route`
938
+
939
+ Route a task without writing context files. This is the CLI debug/admin surface for the same router used by MCP `route_task`.
940
+
941
+ ```bash
942
+ agentpack route --task "fix flaky payment webhook test"
943
+ agentpack route --task "fix flaky payment webhook test" --format json
944
+ ```
945
+
946
+ Output includes relevant files, applied rules, recommended skills, suggested commands, safety warnings, and an agent prompt. It uses the existing AgentPack file ranker in memory and does not write `.agentpack/context.md`.
947
+
948
+ ---
949
+
950
+ ### `agentpack skills`
951
+
952
+ Inspect or index installed skills and rule files.
953
+
954
+ ```bash
955
+ agentpack skills scan
956
+ agentpack skills index
957
+ ```
958
+
959
+ `scan` prints discovered artifacts. `index` writes `.agentpack/skills_index.json` with metadata only; raw skill and rule bodies are omitted from the index.
960
+
961
+ ---
962
+
898
963
  ### `agentpack quickstart`
899
964
 
900
965
  Show the shortest useful path for the current repo.
@@ -986,6 +1051,9 @@ Register in Claude Code settings (`~/.claude/settings.json`):
986
1051
 
987
1052
  | Tool | Description |
988
1053
  |---|---|
1054
+ | `route_task(task)` | Read-only task router. Returns relevant files, applied rules, recommended skills, suggested commands, safety warnings, and an agent prompt as JSON. |
1055
+ | `get_skills()` | Return discovered skill/rule inventory as JSON. |
1056
+ | `explain_route(task)` | Return route JSON with positive skill score reasons for debugging router choices. |
989
1057
  | `start_task(task, mode, budget, max_tokens)` | Recommended MCP-first entry point. Writes `.agentpack/task.md`, generates a ranked pack, and returns packed markdown. |
990
1058
  | `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. |
991
1059
  | `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. |
@@ -8,7 +8,7 @@
8
8
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
9
9
  [![CI](https://github.com/vishal2612200/agentpack/actions/workflows/ci.yml/badge.svg)](https://github.com/vishal2612200/agentpack/actions/workflows/ci.yml)
10
10
 
11
- > **Status: alpha (v0.3.10).** 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
+ > **Status: alpha (v0.3.11).** 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.
12
12
  >
13
13
  > **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.
14
14
 
@@ -26,6 +26,7 @@ Use AgentPack when a repo is too large to paste and you want faster, more consis
26
26
  - [Quality Bar](#quality-bar)
27
27
  - [Download Stats](#download-stats)
28
28
  - [Debugging Selection](#debugging-selection)
29
+ - [Task Router](#task-router)
29
30
  - [Supported Integrations](#supported-integrations)
30
31
  - [Commands](#commands)
31
32
  - [Architecture](#architecture)
@@ -40,6 +41,7 @@ Use AgentPack when a repo is too large to paste and you want faster, more consis
40
41
  - **Local code intelligence**: extracts roles, domains, entrypoints, definitions, dependencies, env reads, side effects, and external systems using static analysis.
41
42
  - **Semantic repo map**: adds a compact module-level map before file context so agents orient faster.
42
43
  - **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.
44
+ - **Task router**: MCP and CLI surfaces route a task to relevant files, scoped rules, installed skills, suggested commands, and safety warnings without executing skills automatically.
43
45
  - **Agent integrations**: installs Claude Code, Cursor, Windsurf, Codex, Antigravity, VS Code tasks, git hooks, and MCP configuration.
44
46
  - **Local and measurable**: no API calls for scan, summarize, rank, pack, stats, or benchmark; quality is measured with expected-file evals.
45
47
 
@@ -253,6 +255,40 @@ agentpack guard --agent auto --repair-stale --refresh-context
253
255
 
254
256
  `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.
255
257
 
258
+ ## Task Router
259
+
260
+ AgentPack Router is the MCP-first path for agents that need a task map before loading full context. It returns:
261
+
262
+ - files to read first
263
+ - repo and tool rules to apply
264
+ - installed skills to consider
265
+ - commands to consider, never execute automatically
266
+ - safety warnings for external side-effect skills
267
+ - an agent-ready prompt block
268
+
269
+ Use MCP when available:
270
+
271
+ ```text
272
+ route_task("fix flaky payment webhook test")
273
+ ```
274
+
275
+ Use CLI for inspection or scripting:
276
+
277
+ ```bash
278
+ agentpack skills scan
279
+ agentpack skills index
280
+ agentpack route --task "fix flaky payment webhook test"
281
+ agentpack route --task "fix flaky payment webhook test" --format json
282
+ ```
283
+
284
+ Router reads skills and rules from `.claude/skills/`, `~/.claude/skills/`, `~/.codex/skills/`, `~/.agents/skills/`, `.agentpack/skills/`, `.cursor/rules/`, `AGENTS.md`, `CLAUDE.md`, and `GEMINI.md`. Rules are mandatory scoped instructions; skills are optional recommendations. The local `.agentpack/skills_index.json` stores metadata only and omits raw skill/rule bodies.
285
+
286
+ Safety defaults:
287
+
288
+ - skills are recommended, not executed
289
+ - suggested commands are returned as strings with reasons
290
+ - external side-effect skills, such as deploy or cloud mutation checklists, are warned and not selected unless explicitly allowed in config
291
+
256
292
  ## Before / After Agent Behavior
257
293
 
258
294
  Without AgentPack:
@@ -559,6 +595,9 @@ Command map:
559
595
  | `agentpack install` | Refresh or add an agent integration without changing project state |
560
596
  | `agentpack repair` | Restore missing or drifted integration files |
561
597
  | `agentpack pack` | Generate a ranked context pack for one task |
598
+ | `agentpack route` | Route a task to files, rules, skills, commands, and safety warnings |
599
+ | `agentpack skills scan` | Print discovered local/global skills and rules |
600
+ | `agentpack skills index` | Write `.agentpack/skills_index.json` metadata for faster routing |
562
601
  | `agentpack watch` | Keep the context pack fresh while you work |
563
602
  | `agentpack doctor` | Audit hooks, agent files, CLI path, and repo health |
564
603
  | `agentpack explain` | Understand why a file was selected or omitted |
@@ -856,6 +895,32 @@ This keeps unrelated dirty files from consuming the whole context budget while p
856
895
 
857
896
  ---
858
897
 
898
+ ### `agentpack route`
899
+
900
+ Route a task without writing context files. This is the CLI debug/admin surface for the same router used by MCP `route_task`.
901
+
902
+ ```bash
903
+ agentpack route --task "fix flaky payment webhook test"
904
+ agentpack route --task "fix flaky payment webhook test" --format json
905
+ ```
906
+
907
+ Output includes relevant files, applied rules, recommended skills, suggested commands, safety warnings, and an agent prompt. It uses the existing AgentPack file ranker in memory and does not write `.agentpack/context.md`.
908
+
909
+ ---
910
+
911
+ ### `agentpack skills`
912
+
913
+ Inspect or index installed skills and rule files.
914
+
915
+ ```bash
916
+ agentpack skills scan
917
+ agentpack skills index
918
+ ```
919
+
920
+ `scan` prints discovered artifacts. `index` writes `.agentpack/skills_index.json` with metadata only; raw skill and rule bodies are omitted from the index.
921
+
922
+ ---
923
+
859
924
  ### `agentpack quickstart`
860
925
 
861
926
  Show the shortest useful path for the current repo.
@@ -947,6 +1012,9 @@ Register in Claude Code settings (`~/.claude/settings.json`):
947
1012
 
948
1013
  | Tool | Description |
949
1014
  |---|---|
1015
+ | `route_task(task)` | Read-only task router. Returns relevant files, applied rules, recommended skills, suggested commands, safety warnings, and an agent prompt as JSON. |
1016
+ | `get_skills()` | Return discovered skill/rule inventory as JSON. |
1017
+ | `explain_route(task)` | Return route JSON with positive skill score reasons for debugging router choices. |
950
1018
  | `start_task(task, mode, budget, max_tokens)` | Recommended MCP-first entry point. Writes `.agentpack/task.md`, generates a ranked pack, and returns packed markdown. |
951
1019
  | `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. |
952
1020
  | `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. |
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "agentpack-cli"
3
- version = "0.3.10"
3
+ version = "0.3.11"
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"
@@ -1,3 +1,3 @@
1
1
  """AgentPack — task-aware context packing for AI coding agents."""
2
2
 
3
- __version__ = "0.3.10"
3
+ __version__ = "0.3.11"
@@ -19,7 +19,9 @@ from agentpack.commands import (
19
19
  pack,
20
20
  quickstart,
21
21
  repair,
22
+ route,
22
23
  scan,
24
+ skills,
23
25
  stats,
24
26
  status,
25
27
  summarize,
@@ -56,6 +58,7 @@ for mod in [
56
58
  pack,
57
59
  install,
58
60
  repair,
61
+ route,
59
62
  migrate,
60
63
  monitor,
61
64
  explain,
@@ -69,6 +72,7 @@ for mod in [
69
72
  mcp_cmd,
70
73
  hook_cmd,
71
74
  quickstart,
75
+ skills,
72
76
  ]:
73
77
  mod.register(app)
74
78
 
@@ -7,6 +7,6 @@ import typer
7
7
  def register(app: typer.Typer) -> None:
8
8
  @app.command("mcp")
9
9
  def mcp_server() -> None:
10
- """Start the AgentPack MCP server (tools: pack_context, get_context, refresh)."""
10
+ """Start the AgentPack MCP server (tools: route_task, pack_context, get_context, refresh)."""
11
11
  from agentpack.mcp_server import serve
12
12
  serve()
@@ -0,0 +1,29 @@
1
+ from __future__ import annotations
2
+
3
+ import typer
4
+
5
+ from agentpack.commands._shared import _root, console
6
+ from agentpack.router.prompt_builder import render_plain
7
+ from agentpack.router.service import RouteService
8
+
9
+
10
+ def register(app: typer.Typer) -> None:
11
+ @app.command("route")
12
+ def route_task(
13
+ task: str = typer.Option(..., "--task", help="Developer task to route."),
14
+ output_format: str = typer.Option("plain", "--format", help="Output format: plain|json."),
15
+ ) -> None:
16
+ """Route a task to relevant files, rules, skills, and command suggestions."""
17
+ if output_format not in {"plain", "json"}:
18
+ console.print("[red]Invalid format. Use plain|json.[/]")
19
+ raise typer.Exit(1)
20
+ try:
21
+ result = RouteService().route_task(_root(), task)
22
+ except ValueError as exc:
23
+ console.print(f"[red]{exc}[/]")
24
+ raise typer.Exit(1) from exc
25
+
26
+ if output_format == "json":
27
+ typer.echo(result.model_dump_json(indent=2))
28
+ else:
29
+ console.print(render_plain(result))
@@ -0,0 +1,46 @@
1
+ from __future__ import annotations
2
+
3
+ import typer
4
+ from rich.table import Table
5
+
6
+ from agentpack.commands._shared import _root, console
7
+ from agentpack.core.config import load_config
8
+ from agentpack.router.discovery import discover_inventory, write_inventory_index
9
+
10
+ skills_app = typer.Typer(help="Inspect and index local agent skills and rules.")
11
+
12
+
13
+ def register(app: typer.Typer) -> None:
14
+ app.add_typer(skills_app, name="skills")
15
+
16
+
17
+ @skills_app.command("scan")
18
+ def scan_skills() -> None:
19
+ """Print discovered skills and rules without writing an index."""
20
+ root = _root()
21
+ cfg = load_config(root)
22
+ inventory = discover_inventory(root, cfg.skills.paths)
23
+ console.print(f"Found {len(inventory.skills)} skills and {len(inventory.rules)} rules")
24
+
25
+ table = Table(show_header=True)
26
+ table.add_column("type")
27
+ table.add_column("name")
28
+ table.add_column("source")
29
+ table.add_column("description")
30
+ for skill in inventory.skills:
31
+ table.add_row("skill", skill.name, skill.path, skill.description[:80])
32
+ for rule in inventory.rules:
33
+ table.add_row("rule", rule.name, rule.path, rule.description[:80])
34
+ console.print(table)
35
+
36
+
37
+ @skills_app.command("index")
38
+ def index_skills() -> None:
39
+ """Write .agentpack/skills_index.json."""
40
+ root = _root()
41
+ cfg = load_config(root)
42
+ inventory = discover_inventory(root, cfg.skills.paths)
43
+ path = write_inventory_index(root, inventory)
44
+ console.print(
45
+ f"Indexed {len(inventory.skills)} skills and {len(inventory.rules)} rules at {path}"
46
+ )
@@ -42,6 +42,19 @@ class HooksConfig(BaseModel):
42
42
  blocking_task_refresh: bool = True
43
43
 
44
44
 
45
+ class SkillsConfig(BaseModel):
46
+ paths: list[str] = Field(default_factory=lambda: [
47
+ ".claude/skills",
48
+ "~/.claude/skills",
49
+ "~/.codex/skills",
50
+ "~/.agents/skills",
51
+ ".agentpack/skills",
52
+ ".cursor/rules",
53
+ ])
54
+ max_selected: int = 3
55
+ allow_external_side_effects: bool = False
56
+
57
+
45
58
  class AgentConfig(BaseModel):
46
59
  output: str
47
60
  patch_claude_md: bool = False
@@ -89,6 +102,7 @@ class Config(BaseModel):
89
102
  context: ContextConfig = Field(default_factory=ContextConfig)
90
103
  summary: SummaryConfig = Field(default_factory=SummaryConfig)
91
104
  hooks: HooksConfig = Field(default_factory=HooksConfig)
105
+ skills: SkillsConfig = Field(default_factory=SkillsConfig)
92
106
  agents: AgentsConfig = Field(default_factory=AgentsConfig)
93
107
  scoring: ScoringWeights = Field(default_factory=ScoringWeights)
94
108
 
@@ -128,6 +142,12 @@ task_switch_min_terms = 1
128
142
  # Block once on task switches so the first prompt sees fresh top-file hints.
129
143
  blocking_task_refresh = true
130
144
 
145
+ [skills]
146
+ # Skill/rule sources used by `agentpack route` and MCP `route_task`.
147
+ paths = [".claude/skills", "~/.claude/skills", "~/.codex/skills", "~/.agents/skills", ".agentpack/skills", ".cursor/rules"]
148
+ max_selected = 3
149
+ allow_external_side_effects = false
150
+
131
151
  [scoring]
132
152
  # Scoring weights — higher wins budget allocation.
133
153
  # Tune these to make agentpack favour your team's file layout.
@@ -14,9 +14,10 @@ skills:
14
14
  At the start of every coding task:
15
15
  1. Write a one-line task summary to `.agentpack/task.md` (overwrite the whole file).
16
16
  2. Run `agentpack guard --agent antigravity --repair-stale --refresh-context`. This is the executable pre-edit gate for non-MCP paths.
17
- 3. Prefer AgentPack MCP if available. Call `agentpack_get_context()` for current context, or `agentpack_pack_context(task="<task>")` for a new task. MCP is the active path because it auto-refreshes stale task/repo context.
18
- 4. If MCP is unavailable, read `.agent/skills/agentpack/SKILL.md`. Treat it as fallback; if its `agentpack:freshness` block says `refresh_required: true` or the task does not match, rerun the guard command before using selected files.
19
- 5. Use files listed in context as starting points, but verify with actual code before editing.
17
+ 3. Prefer AgentPack MCP if available. MCP is the active path. Call `agentpack_route_task(task="<task>")` first to get files, rules, skills, commands, and safety warnings.
18
+ 4. Call `agentpack_pack_context(task="<task>")` only when full packed context is needed, or `agentpack_get_context()` for current context.
19
+ 5. If MCP is unavailable, read `.agent/skills/agentpack/SKILL.md`. Treat it as fallback; if its `agentpack:freshness` block says `refresh_required: true` or the task does not match, rerun the guard command before using selected files.
20
+ 6. Use files listed in context as starting points, but verify with actual code before editing.
20
21
 
21
22
  When the user switches to a different coding task, update `.agentpack/task.md`, then call MCP again or rerun the guard command before editing.
22
23
  <!-- agentpack:block:end -->"""
@@ -14,10 +14,10 @@ Prefer MCP over reading `.agentpack/context*.md` directly because MCP auto-refre
14
14
  and repo-snapshot context before returning.
15
15
 
16
16
  ```
17
- mcp__agentpack__get_context()
17
+ mcp__agentpack__route_task(task="<what you're working on>")
18
18
  ```
19
19
 
20
- For a brand-new task, call:
20
+ When full packed context is needed, call:
21
21
 
22
22
  ```
23
23
  mcp__agentpack__pack_context(task="<what you're working on>", budget=4000)
@@ -30,6 +30,7 @@ agentpack guard --agent claude --repair-stale --refresh-context
30
30
  ```
31
31
 
32
32
  Other tools:
33
+ - `mcp__agentpack__route_task(task)` — files, rules, skills, commands, and safety warnings
33
34
  - `mcp__agentpack__explain_file(path)` — score breakdown + symbols for a file
34
35
  - `mcp__agentpack__get_related_files(path)` — import-graph neighbours
35
36
  - `mcp__agentpack__get_stats()` — token/saving stats for the latest pack
@@ -14,9 +14,10 @@ At the start of every coding task:
14
14
 
15
15
  1. Write a one-line task summary to `.agentpack/task.md` (overwrite the whole file).
16
16
  2. Run `agentpack guard --agent codex --repair-stale --refresh-context`. This is the executable pre-edit gate for non-MCP paths.
17
- 3. Prefer AgentPack MCP if available. Call `agentpack_get_context()` for existing task context, or `agentpack_pack_context(task="<task>")` for a new task. MCP is the active path because it auto-refreshes stale task/repo context.
18
- 4. If MCP is unavailable, read `.agentpack/context.md`. Treat it as a fallback artifact; if its `agentpack:freshness` block says `refresh_required: true` or the task does not match, rerun the guard command before using selected files.
19
- 5. Use selected files as starting points, but verify with actual code before editing.
17
+ 3. Prefer AgentPack MCP if available. MCP is the active path. Call `agentpack_route_task(task="<task>")` first to get files, rules, skills, commands, and safety warnings.
18
+ 4. Call `agentpack_pack_context(task="<task>")` only when full packed context is needed, or `agentpack_get_context()` for existing task context.
19
+ 5. If MCP is unavailable, read `.agentpack/context.md`. Treat it as a fallback artifact; if its `agentpack:freshness` block says `refresh_required: true` or the task does not match, rerun the guard command before using selected files.
20
+ 6. Use selected files as starting points, but verify with actual code before editing.
20
21
 
21
22
  When the user switches to a different coding task, update `.agentpack/task.md`, then call MCP again or rerun the guard command before editing.
22
23
  <!-- agentpack:end -->"""
@@ -11,9 +11,10 @@ _CURSOR_RULE = """\
11
11
  At the start of every coding task:
12
12
  1. Write a one-line task summary to `.agentpack/task.md` (overwrite the whole file).
13
13
  2. Run `agentpack guard --agent cursor --repair-stale --refresh-context`. This is the executable pre-edit gate for non-MCP paths.
14
- 3. Prefer AgentPack MCP if available. Call `agentpack_get_context()` for current context, or `agentpack_pack_context(task="<task>")` for a new task. MCP is the active path because it auto-refreshes stale task/repo context.
15
- 4. If MCP is unavailable, read `.agentpack/context.md`. Treat it as fallback; if its `agentpack:freshness` block says `refresh_required: true` or the task does not match, rerun the guard command before using selected files.
16
- 5. Use files listed in context as starting points, but verify with actual code before editing.
14
+ 3. Prefer AgentPack MCP if available. MCP is the active path. Call `agentpack_route_task(task="<task>")` first to get files, rules, skills, commands, and safety warnings.
15
+ 4. Call `agentpack_pack_context(task="<task>")` only when full packed context is needed, or `agentpack_get_context()` for current context.
16
+ 5. If MCP is unavailable, read `.agentpack/context.md`. Treat it as fallback; if its `agentpack:freshness` block says `refresh_required: true` or the task does not match, rerun the guard command before using selected files.
17
+ 6. Use files listed in context as starting points, but verify with actual code before editing.
17
18
  When the user switches to a different coding task, update `.agentpack/task.md`, then call MCP again or rerun the guard command before editing.
18
19
  If context is missing: write `.agentpack/task.md`, then run `agentpack guard --agent cursor --repair-stale --refresh-context`.
19
20
  <!-- agentpack:rule:end -->"""
@@ -62,9 +63,10 @@ At the start of every coding task:
62
63
 
63
64
  1. Write a one-line task summary to `.agentpack/task.md` (overwrite the whole file).
64
65
  2. Run `agentpack guard --agent cursor --repair-stale --refresh-context`. This is the executable pre-edit gate for non-MCP paths.
65
- 3. Prefer AgentPack MCP if available. Call `agentpack_get_context()` for current context, or `agentpack_pack_context(task="<task>")` for a new task. MCP is the active path because it auto-refreshes stale task/repo context.
66
- 4. If MCP is unavailable, read `.agentpack/context.md`. Treat it as fallback; if its `agentpack:freshness` block says `refresh_required: true` or the task does not match, rerun the guard command before using selected files.
67
- 5. Use files listed in context as starting points, but verify with actual code before editing.
66
+ 3. Prefer AgentPack MCP if available. MCP is the active path. Call `agentpack_route_task(task="<task>")` first to get files, rules, skills, commands, and safety warnings.
67
+ 4. Call `agentpack_pack_context(task="<task>")` only when full packed context is needed, or `agentpack_get_context()` for current context.
68
+ 5. If MCP is unavailable, read `.agentpack/context.md`. Treat it as fallback; if its `agentpack:freshness` block says `refresh_required: true` or the task does not match, rerun the guard command before using selected files.
69
+ 6. Use files listed in context as starting points, but verify with actual code before editing.
68
70
 
69
71
  When the user switches to a different coding task, update `.agentpack/task.md`, then call MCP again or rerun the guard command before editing.
70
72
 
@@ -16,6 +16,9 @@ Or register in Claude Code settings:
16
16
  Tools exposed:
17
17
  start_task — write task.md and return a fresh context pack
18
18
  pack_context — generate/refresh a context pack for a task
19
+ route_task — read-only route: files + rules + skills + commands
20
+ get_skills — read-only skill/rule inventory
21
+ explain_route — read-only route with skill score reasons
19
22
  get_context — read latest context pack; auto-refreshes when task.md changed
20
23
  refresh — refresh using the current task.md
21
24
  explain_file — show score breakdown + symbols for a specific file
@@ -420,6 +423,30 @@ def _get_delta_context_impl(root: Path, max_files: int = 12) -> str:
420
423
  return "\n".join(lines)
421
424
 
422
425
 
426
+ def _route_task_impl(root: Path, task: str) -> str:
427
+ """Return read-only task route JSON; does not write task/context files."""
428
+ from agentpack.router.service import RouteService
429
+
430
+ result = RouteService().route_task(root, task)
431
+ return result.model_dump_json(indent=2)
432
+
433
+
434
+ def _get_skills_impl(root: Path) -> str:
435
+ """Return discovered skill/rule inventory JSON."""
436
+ from agentpack.router.service import RouteService
437
+
438
+ inventory = RouteService().inventory(root)
439
+ return inventory.model_dump_json(indent=2)
440
+
441
+
442
+ def _explain_route_impl(root: Path, task: str) -> str:
443
+ """Return task route JSON including all positive skill scores."""
444
+ from agentpack.router.service import RouteService
445
+
446
+ result = RouteService().explain_route(root, task)
447
+ return result.model_dump_json(indent=2)
448
+
449
+
423
450
  def serve() -> None:
424
451
  try:
425
452
  from mcp.server.fastmcp import FastMCP
@@ -468,6 +495,25 @@ def serve() -> None:
468
495
  max_tokens=max_tokens,
469
496
  )
470
497
 
498
+ @mcp.tool()
499
+ def route_task(task: str) -> str:
500
+ """Route a task to files, rules, skills, command suggestions, and safety warnings.
501
+
502
+ Read-only: does not write task.md or context files. Use pack_context when full
503
+ context content is needed.
504
+ """
505
+ return _route_task_impl(_repo_root(), task)
506
+
507
+ @mcp.tool()
508
+ def get_skills() -> str:
509
+ """Return the discovered Agentpack skill/rule inventory as JSON."""
510
+ return _get_skills_impl(_repo_root())
511
+
512
+ @mcp.tool()
513
+ def explain_route(task: str) -> str:
514
+ """Return a route_task-style JSON result with skill scoring reasons."""
515
+ return _explain_route_impl(_repo_root(), task)
516
+
471
517
  @mcp.tool()
472
518
  def get_context() -> str:
473
519
  """Return the latest context pack, auto-refreshing when task.md changed.
@@ -0,0 +1,23 @@
1
+ from agentpack.router.models import (
2
+ AppliedRule,
3
+ CommandSuggestion,
4
+ RouteExplanation,
5
+ RouteResult,
6
+ SelectedSkill,
7
+ SkillArtifact,
8
+ SkillInventory,
9
+ RuleArtifact,
10
+ )
11
+ from agentpack.router.service import RouteService
12
+
13
+ __all__ = [
14
+ "AppliedRule",
15
+ "CommandSuggestion",
16
+ "RouteExplanation",
17
+ "RouteResult",
18
+ "RouteService",
19
+ "SelectedSkill",
20
+ "SkillArtifact",
21
+ "SkillInventory",
22
+ "RuleArtifact",
23
+ ]