@chankov/agent-fleet 2.0.21 → 2.0.22

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 (633) hide show
  1. package/.pi/harnesses/agent-hub/README.md +10 -0
  2. package/.pi/harnesses/agent-hub/acceptance.ts +2 -1
  3. package/.pi/harnesses/agent-hub/damage-guard-hub.ts +7 -2
  4. package/.pi/harnesses/agent-hub/dispatch-native-spawn.ts +3 -1
  5. package/.pi/harnesses/agent-hub/external-blocker.js +9 -2
  6. package/.pi/harnesses/agent-hub/no-progress.ts +4 -2
  7. package/.pi/harnesses/agent-hub/package.json +1 -1
  8. package/.pi/harnesses/agent-hub/runtime-test-check.ts +16 -2
  9. package/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +3 -2
  10. package/.pi/harnesses/coms/package.json +1 -1
  11. package/.pi/harnesses/damage-control-continue/index.ts +2 -2
  12. package/.pi/harnesses/damage-control-continue/package.json +1 -1
  13. package/.pi/harnesses/damage-control-continue/system1-child.ts +16 -6
  14. package/.pi/harnesses/lib/bash-policy-analysis.ts +31 -1
  15. package/.versions/2.0.22/.pi/agent-fleet/hermes/README.md +347 -0
  16. package/.versions/2.0.22/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
  17. package/.versions/2.0.22/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
  18. package/.versions/2.0.22/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
  19. package/.versions/2.0.22/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
  20. package/.versions/2.0.22/.pi/agent-fleet/hermes/gates/gate-o-capability.md +8 -0
  21. package/.versions/2.0.22/.pi/agent-fleet/hermes/gates/gate-o-validator-fixtures.json +1 -0
  22. package/.versions/2.0.22/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +773 -0
  23. package/.versions/2.0.22/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
  24. package/.versions/2.0.22/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
  25. package/.versions/2.0.22/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
  26. package/.versions/2.0.22/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
  27. package/.versions/2.0.22/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
  28. package/.versions/2.0.22/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
  29. package/.versions/2.0.22/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
  30. package/.versions/2.0.22/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
  31. package/.versions/2.0.22/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
  32. package/.versions/2.0.22/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
  33. package/.versions/2.0.22/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
  34. package/.versions/2.0.22/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
  35. package/.versions/2.0.22/.pi/agent-fleet/hermes/skills/hub-conductor/SKILL.md +84 -0
  36. package/.versions/2.0.22/.pi/agent-fleet/hermes/skills/hub-liaison/SKILL.md +84 -0
  37. package/.versions/2.0.22/.pi/agent-fleet/hermes/skills/hub-watchdog/SKILL.md +76 -0
  38. package/.versions/2.0.22/.pi/agent-fleet/hermes/skills/hub-watchdog/manifest.json +1 -0
  39. package/.versions/2.0.22/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
  40. package/.versions/2.0.22/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
  41. package/.versions/2.0.22/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
  42. package/.versions/2.0.22/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
  43. package/.versions/2.0.22/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
  44. package/.versions/2.0.22/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
  45. package/.versions/2.0.22/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
  46. package/.versions/2.0.22/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
  47. package/.versions/2.0.22/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
  48. package/.versions/2.0.22/.pi/agent-fleet/hermes/watchdog-tests/__init__.py +0 -0
  49. package/.versions/2.0.22/.pi/agent-fleet/hooks/coms-stop-hook.mjs +84 -0
  50. package/.versions/2.0.22/.pi/agent-fleet/scripts/claude-code-preflight.ts +70 -0
  51. package/.versions/2.0.22/.pi/agent-fleet/scripts/coms-claude-bridge.ts +437 -0
  52. package/.versions/2.0.22/.pi/agent-fleet/scripts/coms-cli.ts +425 -0
  53. package/.versions/2.0.22/.pi/agent-fleet/scripts/coms-hermes-bridge.ts +413 -0
  54. package/.versions/2.0.22/.pi/agent-fleet/scripts/fleet-codex-client.ts +69 -0
  55. package/.versions/2.0.22/.pi/agent-fleet/scripts/fleet-codex-read.py +148 -0
  56. package/.versions/2.0.22/.pi/agent-fleet/scripts/fleet.ts +217 -0
  57. package/.versions/2.0.22/.pi/agent-fleet/scripts/flow.ts +157 -0
  58. package/.versions/2.0.22/.pi/agent-fleet/scripts/hermes-monitor-capability-runner.ts +25 -0
  59. package/.versions/2.0.22/.pi/agent-fleet/scripts/hermes-monitor-scenario.ts +474 -0
  60. package/.versions/2.0.22/.pi/agent-fleet/scripts/hermes-watchdog-capability-probe.ts +45 -0
  61. package/.versions/2.0.22/.pi/agent-fleet/scripts/install-hermes-plugin.sh +180 -0
  62. package/.versions/2.0.22/.pi/agent-fleet/scripts/lib/claude-bridge-core.ts +208 -0
  63. package/.versions/2.0.22/.pi/agent-fleet/scripts/lib/coms-envelope.ts +582 -0
  64. package/.versions/2.0.22/.pi/agent-fleet/scripts/lib/fake-herdr-server.ts +88 -0
  65. package/.versions/2.0.22/.pi/agent-fleet/scripts/lib/fleet-codex-catalog.ts +63 -0
  66. package/.versions/2.0.22/.pi/agent-fleet/scripts/lib/fleet-codex-operations.ts +190 -0
  67. package/.versions/2.0.22/.pi/agent-fleet/scripts/lib/fleet-codex-session.ts +166 -0
  68. package/.versions/2.0.22/.pi/agent-fleet/scripts/lib/fleet-codex-transport.ts +124 -0
  69. package/.versions/2.0.22/.pi/agent-fleet/scripts/lib/fleet-command.ts +252 -0
  70. package/.versions/2.0.22/.pi/agent-fleet/scripts/lib/flow-command.ts +98 -0
  71. package/.versions/2.0.22/.pi/agent-fleet/scripts/lib/flow-maintenance.ts +230 -0
  72. package/.versions/2.0.22/.pi/agent-fleet/scripts/lib/herdr-layout.ts +281 -0
  73. package/.versions/2.0.22/.pi/agent-fleet/scripts/lib/hermes-bridge-core.ts +241 -0
  74. package/.versions/2.0.22/.pi/agent-fleet/scripts/lib/hermes-monitor-events.ts +1 -0
  75. package/.versions/2.0.22/.pi/agent-fleet/scripts/lib/hermes-monitor-herdr.ts +2 -0
  76. package/.versions/2.0.22/.pi/agent-fleet/scripts/lib/hermes-monitor-model.ts +3 -0
  77. package/.versions/2.0.22/.pi/agent-fleet/scripts/lib/hermes-monitor-registry.ts +2 -0
  78. package/.versions/2.0.22/.pi/agent-fleet/scripts/lib/hermes-monitor-socket.ts +2 -0
  79. package/.versions/2.0.22/.pi/agent-fleet/scripts/lib/hermes-monitor-store.ts +2 -0
  80. package/.versions/2.0.22/.pi/agent-fleet/scripts/lib/monitor-env.ts +146 -0
  81. package/.versions/2.0.22/.pi/agent-fleet/scripts/lib/peer-launch.ts +318 -0
  82. package/.versions/2.0.22/.pi/agent-fleet/scripts/lib/persona-banner.ts +62 -0
  83. package/.versions/2.0.22/.pi/agent-fleet/scripts/lib/persona-dirs.ts +25 -0
  84. package/.versions/2.0.22/.pi/agent-fleet/scripts/lib/runtime-dependencies.js +124 -0
  85. package/.versions/2.0.22/.pi/agent-fleet/scripts/lib/spawn-stagger.ts +101 -0
  86. package/.versions/2.0.22/.pi/agent-fleet/scripts/lib/team-project.ts +178 -0
  87. package/.versions/2.0.22/.pi/agent-fleet/scripts/lib/team-snapshot.ts +147 -0
  88. package/.versions/2.0.22/.pi/agent-fleet/scripts/package-lock.json +35 -0
  89. package/.versions/2.0.22/.pi/agent-fleet/scripts/package.json +9 -0
  90. package/.versions/2.0.22/.pi/agent-fleet/scripts/peer-banner.ts +41 -0
  91. package/.versions/2.0.22/.pi/agent-fleet/scripts/peer-launch.ts +283 -0
  92. package/.versions/2.0.22/.pi/agent-fleet/scripts/team-snapshot.ts +237 -0
  93. package/.versions/2.0.22/.pi/agent-fleet/scripts/team-up.ts +378 -0
  94. package/.versions/2.0.22/.pi/agent-fleet/scripts/workflows/lib/agent-phase.ts +179 -0
  95. package/.versions/2.0.22/.pi/agent-fleet/scripts/workflows/lib/changes.ts +61 -0
  96. package/.versions/2.0.22/.pi/agent-fleet/scripts/workflows/lib/debate.ts +149 -0
  97. package/.versions/2.0.22/.pi/agent-fleet/scripts/workflows/lib/env.ts +34 -0
  98. package/.versions/2.0.22/.pi/agent-fleet/scripts/workflows/lib/envelopes.ts +169 -0
  99. package/.versions/2.0.22/.pi/agent-fleet/scripts/workflows/lib/gates.ts +81 -0
  100. package/.versions/2.0.22/.pi/agent-fleet/scripts/workflows/lib/git.ts +96 -0
  101. package/.versions/2.0.22/.pi/agent-fleet/scripts/workflows/lib/isolated-snapshot.ts +125 -0
  102. package/.versions/2.0.22/.pi/agent-fleet/scripts/workflows/lib/merge.ts +95 -0
  103. package/.versions/2.0.22/.pi/agent-fleet/scripts/workflows/lib/model-profile.ts +22 -0
  104. package/.versions/2.0.22/.pi/agent-fleet/scripts/workflows/lib/model-visibility.ts +92 -0
  105. package/.versions/2.0.22/.pi/agent-fleet/scripts/workflows/lib/permissions.ts +130 -0
  106. package/.versions/2.0.22/.pi/agent-fleet/scripts/workflows/lib/personas.ts +57 -0
  107. package/.versions/2.0.22/.pi/agent-fleet/scripts/workflows/lib/poll.ts +86 -0
  108. package/.versions/2.0.22/.pi/agent-fleet/scripts/workflows/lib/project-policy.ts +36 -0
  109. package/.versions/2.0.22/.pi/agent-fleet/scripts/workflows/lib/quality.ts +64 -0
  110. package/.versions/2.0.22/.pi/agent-fleet/scripts/workflows/lib/run.ts +108 -0
  111. package/.versions/2.0.22/.pi/agent-fleet/scripts/workflows/lib/scout-data-boundary.ts +55 -0
  112. package/.versions/2.0.22/.pi/agent-fleet/scripts/workflows/lib/trace.ts +34 -0
  113. package/.versions/2.0.22/.pi/agent-fleet/scripts/workflows/lib/voices.ts +128 -0
  114. package/.versions/2.0.22/.pi/agent-fleet/scripts/workflows/lib/writer-lease.ts +112 -0
  115. package/.versions/2.0.22/.pi/agent-fleet/scripts/workflows/tsconfig.json +22 -0
  116. package/.versions/2.0.22/.pi/agent-fleet/scripts/workflows/wf-build-test.ts +61 -0
  117. package/.versions/2.0.22/.pi/agent-fleet/scripts/workflows/wf-debate.ts +87 -0
  118. package/.versions/2.0.22/.pi/agent-fleet/scripts/workflows/wf-document.ts +50 -0
  119. package/.versions/2.0.22/.pi/agent-fleet/scripts/workflows/wf-poll.ts +95 -0
  120. package/.versions/2.0.22/.pi/agent-fleet/scripts/workflows/wf-quality.ts +20 -0
  121. package/.versions/2.0.22/.pi/agent-fleet/scripts/workflows/wf-scout.ts +40 -0
  122. package/.versions/2.0.22/.pi/agents/dispatch-policy.yaml +32 -0
  123. package/.versions/2.0.22/.pi/agents/model-profiles.yaml +134 -0
  124. package/.versions/2.0.22/.pi/agents/peers.yaml +147 -0
  125. package/.versions/2.0.22/.pi/agents/teams.yaml +41 -0
  126. package/.versions/2.0.22/.pi/agents/voices.yaml +13 -0
  127. package/.versions/2.0.22/.pi/damage-control-rules.yaml +297 -0
  128. package/.versions/2.0.22/.pi/extensions/btw/README.md +120 -0
  129. package/.versions/2.0.22/.pi/extensions/btw/index.ts +914 -0
  130. package/.versions/2.0.22/.pi/extensions/btw/package.json +6 -0
  131. package/.versions/2.0.22/.pi/extensions/btw/state.js +179 -0
  132. package/.versions/2.0.22/.pi/extensions/chrome-devtools-mcp/README.md +55 -0
  133. package/.versions/2.0.22/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
  134. package/.versions/2.0.22/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
  135. package/.versions/2.0.22/.pi/extensions/compact-and-continue/README.md +42 -0
  136. package/.versions/2.0.22/.pi/extensions/compact-and-continue/index.ts +136 -0
  137. package/.versions/2.0.22/.pi/extensions/compact-and-continue/package.json +6 -0
  138. package/.versions/2.0.22/.pi/extensions/mcp-bridge/README.md +46 -0
  139. package/.versions/2.0.22/.pi/extensions/mcp-bridge/index.ts +206 -0
  140. package/.versions/2.0.22/.pi/extensions/mcp-bridge/package.json +6 -0
  141. package/.versions/2.0.22/.pi/extensions/package-lock.json +1175 -0
  142. package/.versions/2.0.22/.pi/extensions/package.json +9 -0
  143. package/.versions/2.0.22/.pi/extensions/pi-voice-stt/README.md +224 -0
  144. package/.versions/2.0.22/.pi/extensions/pi-voice-stt/config.ts +198 -0
  145. package/.versions/2.0.22/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
  146. package/.versions/2.0.22/.pi/extensions/pi-voice-stt/index.ts +248 -0
  147. package/.versions/2.0.22/.pi/extensions/pi-voice-stt/package.json +6 -0
  148. package/.versions/2.0.22/.pi/extensions/pi-voice-stt/providers.ts +214 -0
  149. package/.versions/2.0.22/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
  150. package/.versions/2.0.22/.pi/harnesses/agent-hub/README.md +1527 -0
  151. package/.versions/2.0.22/.pi/harnesses/agent-hub/acceptance.ts +200 -0
  152. package/.versions/2.0.22/.pi/harnesses/agent-hub/access-approval.ts +141 -0
  153. package/.versions/2.0.22/.pi/harnesses/agent-hub/action-authorization.ts +10 -0
  154. package/.versions/2.0.22/.pi/harnesses/agent-hub/agentic-contract.ts +43 -0
  155. package/.versions/2.0.22/.pi/harnesses/agent-hub/agentic-evidence.ts +64 -0
  156. package/.versions/2.0.22/.pi/harnesses/agent-hub/agentic-hub.ts +54 -0
  157. package/.versions/2.0.22/.pi/harnesses/agent-hub/agentic-runtime.ts +56 -0
  158. package/.versions/2.0.22/.pi/harnesses/agent-hub/agentic-sources-worker.mjs +4 -0
  159. package/.versions/2.0.22/.pi/harnesses/agent-hub/agentic-sources.ts +74 -0
  160. package/.versions/2.0.22/.pi/harnesses/agent-hub/agentic-state.ts +23 -0
  161. package/.versions/2.0.22/.pi/harnesses/agent-hub/approval-wait.ts +1 -0
  162. package/.versions/2.0.22/.pi/harnesses/agent-hub/artifacts.js +146 -0
  163. package/.versions/2.0.22/.pi/harnesses/agent-hub/assertion-ledger.js +67 -0
  164. package/.versions/2.0.22/.pi/harnesses/agent-hub/assist-profile.ts +19 -0
  165. package/.versions/2.0.22/.pi/harnesses/agent-hub/backend-policy.js +174 -0
  166. package/.versions/2.0.22/.pi/harnesses/agent-hub/bounded-output.ts +26 -0
  167. package/.versions/2.0.22/.pi/harnesses/agent-hub/budget-recovery.ts +123 -0
  168. package/.versions/2.0.22/.pi/harnesses/agent-hub/capability-confirmation.ts +47 -0
  169. package/.versions/2.0.22/.pi/harnesses/agent-hub/capability-packs.ts +184 -0
  170. package/.versions/2.0.22/.pi/harnesses/agent-hub/commands/agent-model-thinking.ts +10 -0
  171. package/.versions/2.0.22/.pi/harnesses/agent-hub/commands/agent-model.ts +10 -0
  172. package/.versions/2.0.22/.pi/harnesses/agent-hub/commands/agent-models-substitute.ts +10 -0
  173. package/.versions/2.0.22/.pi/harnesses/agent-hub/commands/agents-add.ts +9 -0
  174. package/.versions/2.0.22/.pi/harnesses/agent-hub/commands/agents-drop.ts +9 -0
  175. package/.versions/2.0.22/.pi/harnesses/agent-hub/commands/agents-history.ts +9 -0
  176. package/.versions/2.0.22/.pi/harnesses/agent-hub/commands/agents-kill.ts +10 -0
  177. package/.versions/2.0.22/.pi/harnesses/agent-hub/commands/agents-list.ts +9 -0
  178. package/.versions/2.0.22/.pi/harnesses/agent-hub/commands/agents-restart.ts +10 -0
  179. package/.versions/2.0.22/.pi/harnesses/agent-hub/commands/agents-save.ts +9 -0
  180. package/.versions/2.0.22/.pi/harnesses/agent-hub/commands/agents-team.ts +9 -0
  181. package/.versions/2.0.22/.pi/harnesses/agent-hub/commands/audit.ts +9 -0
  182. package/.versions/2.0.22/.pi/harnesses/agent-hub/commands/compound.ts +9 -0
  183. package/.versions/2.0.22/.pi/harnesses/agent-hub/commands/coms.ts +9 -0
  184. package/.versions/2.0.22/.pi/harnesses/agent-hub/commands/context-command.ts +9 -0
  185. package/.versions/2.0.22/.pi/harnesses/agent-hub/commands/context.ts +46 -0
  186. package/.versions/2.0.22/.pi/harnesses/agent-hub/commands/debate.ts +9 -0
  187. package/.versions/2.0.22/.pi/harnesses/agent-hub/commands/dispatch-policy.ts +9 -0
  188. package/.versions/2.0.22/.pi/harnesses/agent-hub/commands/handoff.ts +10 -0
  189. package/.versions/2.0.22/.pi/harnesses/agent-hub/commands/hub-report.ts +9 -0
  190. package/.versions/2.0.22/.pi/harnesses/agent-hub/commands/models.ts +10 -0
  191. package/.versions/2.0.22/.pi/harnesses/agent-hub/commands/poll.ts +9 -0
  192. package/.versions/2.0.22/.pi/harnesses/agent-hub/commands/recover.ts +61 -0
  193. package/.versions/2.0.22/.pi/harnesses/agent-hub/commands/retry.ts +10 -0
  194. package/.versions/2.0.22/.pi/harnesses/agent-hub/commands/task-triage-recover.ts +12 -0
  195. package/.versions/2.0.22/.pi/harnesses/agent-hub/commands/task-triage-waive.ts +12 -0
  196. package/.versions/2.0.22/.pi/harnesses/agent-hub/commands/watchdog.ts +9 -0
  197. package/.versions/2.0.22/.pi/harnesses/agent-hub/commands/work-mode.ts +29 -0
  198. package/.versions/2.0.22/.pi/harnesses/agent-hub/commands/zoom.ts +10 -0
  199. package/.versions/2.0.22/.pi/harnesses/agent-hub/config/agents.ts +178 -0
  200. package/.versions/2.0.22/.pi/harnesses/agent-hub/config/model-profiles.ts +237 -0
  201. package/.versions/2.0.22/.pi/harnesses/agent-hub/config/overrides.ts +165 -0
  202. package/.versions/2.0.22/.pi/harnesses/agent-hub/context/agent-state.ts +30 -0
  203. package/.versions/2.0.22/.pi/harnesses/agent-hub/context/assertions-artifacts.ts +221 -0
  204. package/.versions/2.0.22/.pi/harnesses/agent-hub/context/budgets.ts +152 -0
  205. package/.versions/2.0.22/.pi/harnesses/agent-hub/context/hub-state.ts +40 -0
  206. package/.versions/2.0.22/.pi/harnesses/agent-hub/context-budget-snapshot.ts +105 -0
  207. package/.versions/2.0.22/.pi/harnesses/agent-hub/context-compaction-monitor.ts +35 -0
  208. package/.versions/2.0.22/.pi/harnesses/agent-hub/context-compaction-preflight.ts +21 -0
  209. package/.versions/2.0.22/.pi/harnesses/agent-hub/context-compaction-runtime.ts +69 -0
  210. package/.versions/2.0.22/.pi/harnesses/agent-hub/context-compaction.ts +34 -0
  211. package/.versions/2.0.22/.pi/harnesses/agent-hub/context-continuity-broker.ts +42 -0
  212. package/.versions/2.0.22/.pi/harnesses/agent-hub/context-continuity-child.ts +83 -0
  213. package/.versions/2.0.22/.pi/harnesses/agent-hub/context-continuity-client.ts +19 -0
  214. package/.versions/2.0.22/.pi/harnesses/agent-hub/context-continuity-compat.ts +30 -0
  215. package/.versions/2.0.22/.pi/harnesses/agent-hub/context-continuity-owners.ts +15 -0
  216. package/.versions/2.0.22/.pi/harnesses/agent-hub/context-continuity-registry.ts +8 -0
  217. package/.versions/2.0.22/.pi/harnesses/agent-hub/context-continuity.ts +82 -0
  218. package/.versions/2.0.22/.pi/harnesses/agent-hub/context-pressure.ts +222 -0
  219. package/.versions/2.0.22/.pi/harnesses/agent-hub/context-window.js +108 -0
  220. package/.versions/2.0.22/.pi/harnesses/agent-hub/damage-guard-approval.ts +59 -0
  221. package/.versions/2.0.22/.pi/harnesses/agent-hub/damage-guard-broker.ts +125 -0
  222. package/.versions/2.0.22/.pi/harnesses/agent-hub/damage-guard-contract.ts +22 -0
  223. package/.versions/2.0.22/.pi/harnesses/agent-hub/damage-guard-descendant.ts +76 -0
  224. package/.versions/2.0.22/.pi/harnesses/agent-hub/damage-guard-hub.ts +254 -0
  225. package/.versions/2.0.22/.pi/harnesses/agent-hub/damage-guard-identity.ts +12 -0
  226. package/.versions/2.0.22/.pi/harnesses/agent-hub/damage-guard-owners.ts +54 -0
  227. package/.versions/2.0.22/.pi/harnesses/agent-hub/damage-guard-state.ts +43 -0
  228. package/.versions/2.0.22/.pi/harnesses/agent-hub/damage-guard-test-tsconfig.json +19 -0
  229. package/.versions/2.0.22/.pi/harnesses/agent-hub/debate-command.ts +176 -0
  230. package/.versions/2.0.22/.pi/harnesses/agent-hub/delegate.ts +478 -0
  231. package/.versions/2.0.22/.pi/harnesses/agent-hub/deterministic-fs.ts +195 -0
  232. package/.versions/2.0.22/.pi/harnesses/agent-hub/diagnostic-probe-extension.ts +26 -0
  233. package/.versions/2.0.22/.pi/harnesses/agent-hub/diagnostic-series-budget.ts +178 -0
  234. package/.versions/2.0.22/.pi/harnesses/agent-hub/dispatch-coms.ts +253 -0
  235. package/.versions/2.0.22/.pi/harnesses/agent-hub/dispatch-core.ts +27 -0
  236. package/.versions/2.0.22/.pi/harnesses/agent-hub/dispatch-native-complete.ts +173 -0
  237. package/.versions/2.0.22/.pi/harnesses/agent-hub/dispatch-native-prepare.ts +295 -0
  238. package/.versions/2.0.22/.pi/harnesses/agent-hub/dispatch-native-spawn.ts +255 -0
  239. package/.versions/2.0.22/.pi/harnesses/agent-hub/dispatch-native-types.ts +293 -0
  240. package/.versions/2.0.22/.pi/harnesses/agent-hub/dispatch-native.ts +236 -0
  241. package/.versions/2.0.22/.pi/harnesses/agent-hub/dispatch-observability.ts +225 -0
  242. package/.versions/2.0.22/.pi/harnesses/agent-hub/dispatch-triage-contract.ts +27 -0
  243. package/.versions/2.0.22/.pi/harnesses/agent-hub/dispatch-triage-eval.ts +77 -0
  244. package/.versions/2.0.22/.pi/harnesses/agent-hub/dispatch-triage-policy.ts +29 -0
  245. package/.versions/2.0.22/.pi/harnesses/agent-hub/dispatch-triage-runtime.ts +55 -0
  246. package/.versions/2.0.22/.pi/harnesses/agent-hub/dispatch-triage-state.ts +33 -0
  247. package/.versions/2.0.22/.pi/harnesses/agent-hub/docs-lane.js +123 -0
  248. package/.versions/2.0.22/.pi/harnesses/agent-hub/drift-judge.ts +352 -0
  249. package/.versions/2.0.22/.pi/harnesses/agent-hub/drift-runtime.ts +480 -0
  250. package/.versions/2.0.22/.pi/harnesses/agent-hub/drift-system1-policy.ts +39 -0
  251. package/.versions/2.0.22/.pi/harnesses/agent-hub/drift-system1.ts +469 -0
  252. package/.versions/2.0.22/.pi/harnesses/agent-hub/drift-watchdog.js +349 -0
  253. package/.versions/2.0.22/.pi/harnesses/agent-hub/evidence-manifest.ts +51 -0
  254. package/.versions/2.0.22/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
  255. package/.versions/2.0.22/.pi/harnesses/agent-hub/execution-evidence.ts +80 -0
  256. package/.versions/2.0.22/.pi/harnesses/agent-hub/execution-trace.ts +241 -0
  257. package/.versions/2.0.22/.pi/harnesses/agent-hub/external-blocker.js +92 -0
  258. package/.versions/2.0.22/.pi/harnesses/agent-hub/file-discovery/adapters.ts +88 -0
  259. package/.versions/2.0.22/.pi/harnesses/agent-hub/file-discovery/broker-client.ts +62 -0
  260. package/.versions/2.0.22/.pi/harnesses/agent-hub/file-discovery/broker.ts +128 -0
  261. package/.versions/2.0.22/.pi/harnesses/agent-hub/file-discovery/child-extension.ts +42 -0
  262. package/.versions/2.0.22/.pi/harnesses/agent-hub/file-discovery/descendant.ts +67 -0
  263. package/.versions/2.0.22/.pi/harnesses/agent-hub/file-discovery/discovery-worker.mjs +15 -0
  264. package/.versions/2.0.22/.pi/harnesses/agent-hub/file-discovery/discovery.ts +126 -0
  265. package/.versions/2.0.22/.pi/harnesses/agent-hub/file-discovery/evaluate.ts +57 -0
  266. package/.versions/2.0.22/.pi/harnesses/agent-hub/file-discovery/hub.ts +169 -0
  267. package/.versions/2.0.22/.pi/harnesses/agent-hub/file-discovery/native-context.ts +8 -0
  268. package/.versions/2.0.22/.pi/harnesses/agent-hub/file-discovery/native-fixture.test-support.ts +108 -0
  269. package/.versions/2.0.22/.pi/harnesses/agent-hub/file-discovery/owners.ts +96 -0
  270. package/.versions/2.0.22/.pi/harnesses/agent-hub/file-discovery/results.ts +55 -0
  271. package/.versions/2.0.22/.pi/harnesses/agent-hub/file-discovery/runtime.ts +130 -0
  272. package/.versions/2.0.22/.pi/harnesses/agent-hub/file-discovery/semantic-profiles.ts +18 -0
  273. package/.versions/2.0.22/.pi/harnesses/agent-hub/file-discovery/sources.ts +69 -0
  274. package/.versions/2.0.22/.pi/harnesses/agent-hub/file-discovery/state.ts +22 -0
  275. package/.versions/2.0.22/.pi/harnesses/agent-hub/filesystem-tool.ts +166 -0
  276. package/.versions/2.0.22/.pi/harnesses/agent-hub/fixtures/registration-surface.json +66 -0
  277. package/.versions/2.0.22/.pi/harnesses/agent-hub/fixtures/t0a-synthetic/catalog.ts +189 -0
  278. package/.versions/2.0.22/.pi/harnesses/agent-hub/footer.ts +30 -0
  279. package/.versions/2.0.22/.pi/harnesses/agent-hub/helpers.ts +270 -0
  280. package/.versions/2.0.22/.pi/harnesses/agent-hub/history-projection.ts +116 -0
  281. package/.versions/2.0.22/.pi/harnesses/agent-hub/hub-state-audit.js +41 -0
  282. package/.versions/2.0.22/.pi/harnesses/agent-hub/index.ts +2616 -0
  283. package/.versions/2.0.22/.pi/harnesses/agent-hub/input/completions.ts +82 -0
  284. package/.versions/2.0.22/.pi/harnesses/agent-hub/input/shortcuts.ts +20 -0
  285. package/.versions/2.0.22/.pi/harnesses/agent-hub/lifecycle/context-pressure.ts +231 -0
  286. package/.versions/2.0.22/.pi/harnesses/agent-hub/lifecycle/monitor-session.ts +104 -0
  287. package/.versions/2.0.22/.pi/harnesses/agent-hub/lifecycle/session-orchestration.ts +144 -0
  288. package/.versions/2.0.22/.pi/harnesses/agent-hub/lifecycle/turn-handlers.ts +90 -0
  289. package/.versions/2.0.22/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
  290. package/.versions/2.0.22/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
  291. package/.versions/2.0.22/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
  292. package/.versions/2.0.22/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
  293. package/.versions/2.0.22/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
  294. package/.versions/2.0.22/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
  295. package/.versions/2.0.22/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
  296. package/.versions/2.0.22/.pi/harnesses/agent-hub/monitor-session-bridge.ts +266 -0
  297. package/.versions/2.0.22/.pi/harnesses/agent-hub/no-progress.ts +622 -0
  298. package/.versions/2.0.22/.pi/harnesses/agent-hub/operator-watchdog.ts +97 -0
  299. package/.versions/2.0.22/.pi/harnesses/agent-hub/orchestration-activation.ts +109 -0
  300. package/.versions/2.0.22/.pi/harnesses/agent-hub/orchestration-metrics.ts +78 -0
  301. package/.versions/2.0.22/.pi/harnesses/agent-hub/orchestration-route.ts +68 -0
  302. package/.versions/2.0.22/.pi/harnesses/agent-hub/package.json +7 -0
  303. package/.versions/2.0.22/.pi/harnesses/agent-hub/peer-spawn-plan.ts +116 -0
  304. package/.versions/2.0.22/.pi/harnesses/agent-hub/policy/models.ts +153 -0
  305. package/.versions/2.0.22/.pi/harnesses/agent-hub/policy/profile-activation.ts +62 -0
  306. package/.versions/2.0.22/.pi/harnesses/agent-hub/policy/profile-runtime.ts +120 -0
  307. package/.versions/2.0.22/.pi/harnesses/agent-hub/policy/roster.ts +94 -0
  308. package/.versions/2.0.22/.pi/harnesses/agent-hub/policy/work-mode.ts +142 -0
  309. package/.versions/2.0.22/.pi/harnesses/agent-hub/poll-command.ts +176 -0
  310. package/.versions/2.0.22/.pi/harnesses/agent-hub/presentation.ts +48 -0
  311. package/.versions/2.0.22/.pi/harnesses/agent-hub/proactive-config.ts +21 -0
  312. package/.versions/2.0.22/.pi/harnesses/agent-hub/proactive-evaluate.ts +138 -0
  313. package/.versions/2.0.22/.pi/harnesses/agent-hub/proactive-external-git.ts +82 -0
  314. package/.versions/2.0.22/.pi/harnesses/agent-hub/proactive-external.ts +142 -0
  315. package/.versions/2.0.22/.pi/harnesses/agent-hub/proactive-feedback.ts +104 -0
  316. package/.versions/2.0.22/.pi/harnesses/agent-hub/proactive-findings.ts +115 -0
  317. package/.versions/2.0.22/.pi/harnesses/agent-hub/proactive-local.ts +89 -0
  318. package/.versions/2.0.22/.pi/harnesses/agent-hub/proactive-observer.ts +106 -0
  319. package/.versions/2.0.22/.pi/harnesses/agent-hub/proactive-rules.ts +171 -0
  320. package/.versions/2.0.22/.pi/harnesses/agent-hub/proactive-runtime.ts +318 -0
  321. package/.versions/2.0.22/.pi/harnesses/agent-hub/proactive-selection.ts +68 -0
  322. package/.versions/2.0.22/.pi/harnesses/agent-hub/proactive-snapshot-worker.mjs +12 -0
  323. package/.versions/2.0.22/.pi/harnesses/agent-hub/proactive-snapshot.ts +271 -0
  324. package/.versions/2.0.22/.pi/harnesses/agent-hub/proactive-types.ts +67 -0
  325. package/.versions/2.0.22/.pi/harnesses/agent-hub/process-obligations.ts +159 -0
  326. package/.versions/2.0.22/.pi/harnesses/agent-hub/prompts/context.ts +55 -0
  327. package/.versions/2.0.22/.pi/harnesses/agent-hub/prompts/fragments.ts +86 -0
  328. package/.versions/2.0.22/.pi/harnesses/agent-hub/prompts/session-start.ts +90 -0
  329. package/.versions/2.0.22/.pi/harnesses/agent-hub/prompts/system-prompt.ts +125 -0
  330. package/.versions/2.0.22/.pi/harnesses/agent-hub/provider-semaphore.js +138 -0
  331. package/.versions/2.0.22/.pi/harnesses/agent-hub/reconcile.ts +26 -0
  332. package/.versions/2.0.22/.pi/harnesses/agent-hub/recover-policy.ts +44 -0
  333. package/.versions/2.0.22/.pi/harnesses/agent-hub/recover-state.ts +104 -0
  334. package/.versions/2.0.22/.pi/harnesses/agent-hub/recovery-contract.ts +151 -0
  335. package/.versions/2.0.22/.pi/harnesses/agent-hub/rerun-policy.ts +40 -0
  336. package/.versions/2.0.22/.pi/harnesses/agent-hub/research/controls.ts +74 -0
  337. package/.versions/2.0.22/.pi/harnesses/agent-hub/research/runtime.ts +215 -0
  338. package/.versions/2.0.22/.pi/harnesses/agent-hub/research/spawn-run.ts +221 -0
  339. package/.versions/2.0.22/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
  340. package/.versions/2.0.22/.pi/harnesses/agent-hub/return-contract.js +349 -0
  341. package/.versions/2.0.22/.pi/harnesses/agent-hub/return-extract.js +77 -0
  342. package/.versions/2.0.22/.pi/harnesses/agent-hub/review-closure.ts +43 -0
  343. package/.versions/2.0.22/.pi/harnesses/agent-hub/review-continuity.ts +73 -0
  344. package/.versions/2.0.22/.pi/harnesses/agent-hub/review-findings.js +96 -0
  345. package/.versions/2.0.22/.pi/harnesses/agent-hub/review-reuse.ts +47 -0
  346. package/.versions/2.0.22/.pi/harnesses/agent-hub/routing-observation.ts +41 -0
  347. package/.versions/2.0.22/.pi/harnesses/agent-hub/routing-proposal.ts +46 -0
  348. package/.versions/2.0.22/.pi/harnesses/agent-hub/run-budget.js +342 -0
  349. package/.versions/2.0.22/.pi/harnesses/agent-hub/run-namespace.js +93 -0
  350. package/.versions/2.0.22/.pi/harnesses/agent-hub/runtime-test-check.ts +68 -0
  351. package/.versions/2.0.22/.pi/harnesses/agent-hub/safety-routing.ts +22 -0
  352. package/.versions/2.0.22/.pi/harnesses/agent-hub/scope-gate.js +228 -0
  353. package/.versions/2.0.22/.pi/harnesses/agent-hub/session-audit.ts +331 -0
  354. package/.versions/2.0.22/.pi/harnesses/agent-hub/session-health.js +110 -0
  355. package/.versions/2.0.22/.pi/harnesses/agent-hub/session-start.ts +42 -0
  356. package/.versions/2.0.22/.pi/harnesses/agent-hub/spawn.ts +639 -0
  357. package/.versions/2.0.22/.pi/harnesses/agent-hub/specialist-result-receipt.ts +13 -0
  358. package/.versions/2.0.22/.pi/harnesses/agent-hub/specialist-result.ts +69 -0
  359. package/.versions/2.0.22/.pi/harnesses/agent-hub/system1-activity.ts +625 -0
  360. package/.versions/2.0.22/.pi/harnesses/agent-hub/system1-communication-store.ts +217 -0
  361. package/.versions/2.0.22/.pi/harnesses/agent-hub/system1-report.ts +275 -0
  362. package/.versions/2.0.22/.pi/harnesses/agent-hub/system1-runtime.ts +265 -0
  363. package/.versions/2.0.22/.pi/harnesses/agent-hub/task-continuation.ts +4 -0
  364. package/.versions/2.0.22/.pi/harnesses/agent-hub/task-resume-contract.ts +70 -0
  365. package/.versions/2.0.22/.pi/harnesses/agent-hub/task-triage-authorization.ts +151 -0
  366. package/.versions/2.0.22/.pi/harnesses/agent-hub/task-triage-config.ts +20 -0
  367. package/.versions/2.0.22/.pi/harnesses/agent-hub/task-triage-contract.ts +14 -0
  368. package/.versions/2.0.22/.pi/harnesses/agent-hub/task-triage-live-stage-boundary.mjs +49 -0
  369. package/.versions/2.0.22/.pi/harnesses/agent-hub/task-triage-obligations.ts +120 -0
  370. package/.versions/2.0.22/.pi/harnesses/agent-hub/task-triage-policy.ts +16 -0
  371. package/.versions/2.0.22/.pi/harnesses/agent-hub/task-triage-review-contract.mjs +43 -0
  372. package/.versions/2.0.22/.pi/harnesses/agent-hub/task-triage-reviewer-only-contract.mjs +156 -0
  373. package/.versions/2.0.22/.pi/harnesses/agent-hub/task-triage-reviewer-only-diagnostics.mjs +112 -0
  374. package/.versions/2.0.22/.pi/harnesses/agent-hub/task-triage-runtime.ts +130 -0
  375. package/.versions/2.0.22/.pi/harnesses/agent-hub/task-triage-stage-guard.ts +21 -0
  376. package/.versions/2.0.22/.pi/harnesses/agent-hub/task-triage-state.ts +46 -0
  377. package/.versions/2.0.22/.pi/harnesses/agent-hub/timeline.ts +72 -0
  378. package/.versions/2.0.22/.pi/harnesses/agent-hub/tool-catalog-runtime.ts +79 -0
  379. package/.versions/2.0.22/.pi/harnesses/agent-hub/tool-catalog-state.ts +123 -0
  380. package/.versions/2.0.22/.pi/harnesses/agent-hub/tool-protocol.ts +134 -0
  381. package/.versions/2.0.22/.pi/harnesses/agent-hub/tools/action-executors.ts +214 -0
  382. package/.versions/2.0.22/.pi/harnesses/agent-hub/tools/ask-system1-files.ts +15 -0
  383. package/.versions/2.0.22/.pi/harnesses/agent-hub/tools/ask-system1.ts +25 -0
  384. package/.versions/2.0.22/.pi/harnesses/agent-hub/tools/coms-tools.ts +139 -0
  385. package/.versions/2.0.22/.pi/harnesses/agent-hub/tools/context.ts +144 -0
  386. package/.versions/2.0.22/.pi/harnesses/agent-hub/tools/dispatch-agent.ts +88 -0
  387. package/.versions/2.0.22/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +641 -0
  388. package/.versions/2.0.22/.pi/harnesses/agent-hub/tools/dispatch-triage.ts +16 -0
  389. package/.versions/2.0.22/.pi/harnesses/agent-hub/tools/execution-orchestration.ts +22 -0
  390. package/.versions/2.0.22/.pi/harnesses/agent-hub/tools/fleet-tools.ts +200 -0
  391. package/.versions/2.0.22/.pi/harnesses/agent-hub/tools/herdr-executors.ts +95 -0
  392. package/.versions/2.0.22/.pi/harnesses/agent-hub/tools/run-flow.ts +136 -0
  393. package/.versions/2.0.22/.pi/harnesses/agent-hub/tools/set-task-tier.ts +31 -0
  394. package/.versions/2.0.22/.pi/harnesses/agent-hub/tools/spawn-research.ts +67 -0
  395. package/.versions/2.0.22/.pi/harnesses/agent-hub/tools/team-adjust.ts +29 -0
  396. package/.versions/2.0.22/.pi/harnesses/agent-hub/tools/verification-contract.ts +80 -0
  397. package/.versions/2.0.22/.pi/harnesses/agent-hub/tsconfig.json +22 -0
  398. package/.versions/2.0.22/.pi/harnesses/agent-hub/types.ts +66 -0
  399. package/.versions/2.0.22/.pi/harnesses/agent-hub/ui/activity-dots.ts +25 -0
  400. package/.versions/2.0.22/.pi/harnesses/agent-hub/ui/context-budget.ts +89 -0
  401. package/.versions/2.0.22/.pi/harnesses/agent-hub/ui/detail-panel.ts +192 -0
  402. package/.versions/2.0.22/.pi/harnesses/agent-hub/ui/fleet-actions.ts +78 -0
  403. package/.versions/2.0.22/.pi/harnesses/agent-hub/ui/fleet-dashboard.ts +155 -0
  404. package/.versions/2.0.22/.pi/harnesses/agent-hub/ui/fleet-editor.ts +44 -0
  405. package/.versions/2.0.22/.pi/harnesses/agent-hub/ui/fleet-source.ts +179 -0
  406. package/.versions/2.0.22/.pi/harnesses/agent-hub/ui/grid.ts +159 -0
  407. package/.versions/2.0.22/.pi/harnesses/agent-hub/ui/history-store.ts +137 -0
  408. package/.versions/2.0.22/.pi/harnesses/agent-hub/ui/history.ts +234 -0
  409. package/.versions/2.0.22/.pi/harnesses/agent-hub/ui/pool.ts +103 -0
  410. package/.versions/2.0.22/.pi/harnesses/agent-hub/ui/running-strip.ts +2 -0
  411. package/.versions/2.0.22/.pi/harnesses/agent-hub/ui/system1-communication.ts +59 -0
  412. package/.versions/2.0.22/.pi/harnesses/agent-hub/ui/zoom.ts +206 -0
  413. package/.versions/2.0.22/.pi/harnesses/agent-hub/unknown-tool-counter.ts +116 -0
  414. package/.versions/2.0.22/.pi/harnesses/agent-hub/version.ts +42 -0
  415. package/.versions/2.0.22/.pi/harnesses/agent-hub/watchdog-evaluation.ts +110 -0
  416. package/.versions/2.0.22/.pi/harnesses/agent-hub/work-mode-controls.ts +56 -0
  417. package/.versions/2.0.22/.pi/harnesses/agent-hub/work-mode.ts +186 -0
  418. package/.versions/2.0.22/.pi/harnesses/agent-hub/write-isolation.ts +187 -0
  419. package/.versions/2.0.22/.pi/harnesses/ask-user-remote/README.md +59 -0
  420. package/.versions/2.0.22/.pi/harnesses/ask-user-remote/index.ts +569 -0
  421. package/.versions/2.0.22/.pi/harnesses/ask-user-remote/questions.ts +159 -0
  422. package/.versions/2.0.22/.pi/harnesses/ask-user-remote/race-core.js +124 -0
  423. package/.versions/2.0.22/.pi/harnesses/ask-user-remote/runtime-ask.ts +83 -0
  424. package/.versions/2.0.22/.pi/harnesses/coms/README.md +100 -0
  425. package/.versions/2.0.22/.pi/harnesses/coms/index.ts +285 -0
  426. package/.versions/2.0.22/.pi/harnesses/coms/package.json +7 -0
  427. package/.versions/2.0.22/.pi/harnesses/coms/version.ts +42 -0
  428. package/.versions/2.0.22/.pi/harnesses/damage-control-continue/README.md +161 -0
  429. package/.versions/2.0.22/.pi/harnesses/damage-control-continue/index.ts +600 -0
  430. package/.versions/2.0.22/.pi/harnesses/damage-control-continue/package.json +7 -0
  431. package/.versions/2.0.22/.pi/harnesses/damage-control-continue/result-screen.ts +98 -0
  432. package/.versions/2.0.22/.pi/harnesses/damage-control-continue/system1-child.ts +45 -0
  433. package/.versions/2.0.22/.pi/harnesses/damage-control-continue/system1-client.ts +85 -0
  434. package/.versions/2.0.22/.pi/harnesses/damage-control-continue/system1-guard.ts +65 -0
  435. package/.versions/2.0.22/.pi/harnesses/damage-control-continue/version.ts +42 -0
  436. package/.versions/2.0.22/.pi/harnesses/lib/approval-wait.ts +17 -0
  437. package/.versions/2.0.22/.pi/harnesses/lib/bash-policy-analysis.ts +185 -0
  438. package/.versions/2.0.22/.pi/harnesses/lib/changed-file-diagnostics.ts +642 -0
  439. package/.versions/2.0.22/.pi/harnesses/lib/clarification-policy.ts +9 -0
  440. package/.versions/2.0.22/.pi/harnesses/lib/coms-core-io.ts +413 -0
  441. package/.versions/2.0.22/.pi/harnesses/lib/coms-core.ts +680 -0
  442. package/.versions/2.0.22/.pi/harnesses/lib/coms-registry-entry.ts +96 -0
  443. package/.versions/2.0.22/.pi/harnesses/lib/context-budget-child-prompt.ts +214 -0
  444. package/.versions/2.0.22/.pi/harnesses/lib/context-budget-hub-prompt.ts +121 -0
  445. package/.versions/2.0.22/.pi/harnesses/lib/context-budget-view.ts +112 -0
  446. package/.versions/2.0.22/.pi/harnesses/lib/context-budget.ts +114 -0
  447. package/.versions/2.0.22/.pi/harnesses/lib/context-compaction-policy.js +35 -0
  448. package/.versions/2.0.22/.pi/harnesses/lib/damage-action-hash.ts +28 -0
  449. package/.versions/2.0.22/.pi/harnesses/lib/damage-control-shared.ts +229 -0
  450. package/.versions/2.0.22/.pi/harnesses/lib/damage-guard-port.ts +25 -0
  451. package/.versions/2.0.22/.pi/harnesses/lib/damage-result-evidence.ts +25 -0
  452. package/.versions/2.0.22/.pi/harnesses/lib/damage-result-view.ts +16 -0
  453. package/.versions/2.0.22/.pi/harnesses/lib/deterministic-handle-path.ts +25 -0
  454. package/.versions/2.0.22/.pi/harnesses/lib/execution-trace.ts +45 -0
  455. package/.versions/2.0.22/.pi/harnesses/lib/fixtures/context-budget-profiles.json +11 -0
  456. package/.versions/2.0.22/.pi/harnesses/lib/fixtures/hub-prompt-operator.legacy.txt +73 -0
  457. package/.versions/2.0.22/.pi/harnesses/lib/fixtures/hub-prompt-orchestrator.legacy.txt +73 -0
  458. package/.versions/2.0.22/.pi/harnesses/lib/fleet-dashboard-ops.ts +178 -0
  459. package/.versions/2.0.22/.pi/harnesses/lib/fleet-dashboard-view.ts +172 -0
  460. package/.versions/2.0.22/.pi/harnesses/lib/fleet-detail-view.ts +339 -0
  461. package/.versions/2.0.22/.pi/harnesses/lib/fleet-overlay.ts +26 -0
  462. package/.versions/2.0.22/.pi/harnesses/lib/fleet-panel.ts +34 -0
  463. package/.versions/2.0.22/.pi/harnesses/lib/fleet-read-model.ts +609 -0
  464. package/.versions/2.0.22/.pi/harnesses/lib/fleet-selection.ts +24 -0
  465. package/.versions/2.0.22/.pi/harnesses/lib/fleet-strip-controller.ts +75 -0
  466. package/.versions/2.0.22/.pi/harnesses/lib/fleet-strip-view.ts +179 -0
  467. package/.versions/2.0.22/.pi/harnesses/lib/fleet-transcript-store.ts +244 -0
  468. package/.versions/2.0.22/.pi/harnesses/lib/herdr-client.ts +472 -0
  469. package/.versions/2.0.22/.pi/harnesses/lib/herdr-presence.ts +399 -0
  470. package/.versions/2.0.22/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
  471. package/.versions/2.0.22/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
  472. package/.versions/2.0.22/.pi/harnesses/lib/hermes-monitor-model.ts +18 -0
  473. package/.versions/2.0.22/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
  474. package/.versions/2.0.22/.pi/harnesses/lib/hermes-monitor-socket.ts +163 -0
  475. package/.versions/2.0.22/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
  476. package/.versions/2.0.22/.pi/harnesses/lib/identical-dialog.ts +27 -0
  477. package/.versions/2.0.22/.pi/harnesses/lib/installation-state.js +62 -0
  478. package/.versions/2.0.22/.pi/harnesses/lib/policy-roots.js +106 -0
  479. package/.versions/2.0.22/.pi/harnesses/lib/policy-roots.ts +31 -0
  480. package/.versions/2.0.22/.pi/harnesses/lib/process-shared.ts +9 -0
  481. package/.versions/2.0.22/.pi/harnesses/lib/safe-source-read.js +29 -0
  482. package/.versions/2.0.22/.pi/harnesses/lib/semantic-approval.ts +80 -0
  483. package/.versions/2.0.22/.pi/harnesses/lib/spawned-peers.js +191 -0
  484. package/.versions/2.0.22/.pi/harnesses/lib/system1/config-agentic.js +15 -0
  485. package/.versions/2.0.22/.pi/harnesses/lib/system1/config-context-compaction.js +16 -0
  486. package/.versions/2.0.22/.pi/harnesses/lib/system1/config-damage-guard.js +24 -0
  487. package/.versions/2.0.22/.pi/harnesses/lib/system1/config-file-discovery.js +23 -0
  488. package/.versions/2.0.22/.pi/harnesses/lib/system1/config-json.js +37 -0
  489. package/.versions/2.0.22/.pi/harnesses/lib/system1/config-loader.js +44 -0
  490. package/.versions/2.0.22/.pi/harnesses/lib/system1/config-proactive.js +68 -0
  491. package/.versions/2.0.22/.pi/harnesses/lib/system1/config-triage.js +42 -0
  492. package/.versions/2.0.22/.pi/harnesses/lib/system1/config-v2.js +112 -0
  493. package/.versions/2.0.22/.pi/harnesses/lib/system1/config.js +50 -0
  494. package/.versions/2.0.22/.pi/harnesses/lib/system1/contracts.ts +154 -0
  495. package/.versions/2.0.22/.pi/harnesses/lib/system1/demo.ts +95 -0
  496. package/.versions/2.0.22/.pi/harnesses/lib/system1/jev.ts +503 -0
  497. package/.versions/2.0.22/.pi/harnesses/lib/system1/payload-screen.ts +65 -0
  498. package/.versions/2.0.22/.pi/harnesses/lib/system1/selection.js +11 -0
  499. package/.versions/2.0.22/.pi/harnesses/lib/system1/service.ts +245 -0
  500. package/.versions/2.0.22/.pi/harnesses/lib/update-check.ts +222 -0
  501. package/.versions/2.0.22/.pi/harnesses/package-lock.json +2121 -0
  502. package/.versions/2.0.22/.pi/harnesses/package.json +13 -0
  503. package/.versions/2.0.22/.pi/prompts/af-build.md +27 -0
  504. package/.versions/2.0.22/.pi/prompts/af-code-simplify.md +22 -0
  505. package/.versions/2.0.22/.pi/prompts/af-constraints.md +31 -0
  506. package/.versions/2.0.22/.pi/prompts/af-plan.md +17 -0
  507. package/.versions/2.0.22/.pi/prompts/af-review.md +16 -0
  508. package/.versions/2.0.22/.pi/prompts/af-set-hermes-telegram.md +15 -0
  509. package/.versions/2.0.22/.pi/prompts/af-set-hermes-watchdog.md +6 -0
  510. package/.versions/2.0.22/.pi/prompts/af-setup-rules.md +20 -0
  511. package/.versions/2.0.22/.pi/prompts/af-ship.md +17 -0
  512. package/.versions/2.0.22/.pi/prompts/af-spec.md +15 -0
  513. package/.versions/2.0.22/.pi/prompts/af-test.md +19 -0
  514. package/.versions/2.0.22/.pi/skills/bowser/SKILL.md +145 -0
  515. package/.versions/2.0.22/.version +1 -0
  516. package/.versions/2.0.22/agents/architect.md +24 -0
  517. package/.versions/2.0.22/agents/bowser.md +28 -0
  518. package/.versions/2.0.22/agents/builder.md +55 -0
  519. package/.versions/2.0.22/agents/code-reviewer.md +209 -0
  520. package/.versions/2.0.22/agents/deep-researcher.md +32 -0
  521. package/.versions/2.0.22/agents/documenter.md +22 -0
  522. package/.versions/2.0.22/agents/orchestrator.md +22 -0
  523. package/.versions/2.0.22/agents/plan-reviewer.md +83 -0
  524. package/.versions/2.0.22/agents/planner.md +107 -0
  525. package/.versions/2.0.22/agents/releaser.md +24 -0
  526. package/.versions/2.0.22/agents/researcher.md +30 -0
  527. package/.versions/2.0.22/agents/security-auditor.md +167 -0
  528. package/.versions/2.0.22/agents/test-engineer.md +153 -0
  529. package/.versions/2.0.22/agents/web-debugger.md +44 -0
  530. package/.versions/2.0.22/agents/web-performance-auditor.md +194 -0
  531. package/.versions/2.0.22/bin/catalog/harness-runtime-closure.json +73 -0
  532. package/.versions/2.0.22/codex/fleet-session-client/SKILL.md +34 -0
  533. package/.versions/2.0.22/codex/fleet-session-client.zip +0 -0
  534. package/.versions/2.0.22/docs/ARCHITECTURE.md +982 -0
  535. package/.versions/2.0.22/docs/agent-fleet-setup.md +1103 -0
  536. package/.versions/2.0.22/docs/claude-code-coms-bridge.md +147 -0
  537. package/.versions/2.0.22/docs/codex-session-bridge.md +219 -0
  538. package/.versions/2.0.22/docs/coms-hermes-bridge.md +188 -0
  539. package/.versions/2.0.22/docs/getting-started.md +126 -0
  540. package/.versions/2.0.22/docs/npm-install.md +535 -0
  541. package/.versions/2.0.22/docs/pi-extensions.md +455 -0
  542. package/.versions/2.0.22/docs/pi-setup.md +92 -0
  543. package/.versions/2.0.22/docs/skill-anatomy.md +150 -0
  544. package/.versions/2.0.22/install-manifest.json +3210 -0
  545. package/.versions/2.0.22/justfile +247 -0
  546. package/.versions/2.0.22/manifest-meta.json +1088 -0
  547. package/.versions/2.0.22/references/accessibility-checklist.md +160 -0
  548. package/.versions/2.0.22/references/communication-contract.md +26 -0
  549. package/.versions/2.0.22/references/definition-of-done.md +67 -0
  550. package/.versions/2.0.22/references/fleet-coordination-patterns.md +171 -0
  551. package/.versions/2.0.22/references/observability-checklist.md +92 -0
  552. package/.versions/2.0.22/references/orchestration-patterns.md +370 -0
  553. package/.versions/2.0.22/references/performance-checklist.md +236 -0
  554. package/.versions/2.0.22/references/prompting-patterns.md +380 -0
  555. package/.versions/2.0.22/references/security-checklist.md +245 -0
  556. package/.versions/2.0.22/references/testing-patterns.md +235 -0
  557. package/.versions/2.0.22/references/workflow-authoring.md +304 -0
  558. package/.versions/2.0.22/skills/_internal/grilling.md +59 -0
  559. package/.versions/2.0.22/skills/browser-testing-with-devtools/SKILL.md +351 -0
  560. package/.versions/2.0.22/skills/code-review-and-quality/SKILL.md +396 -0
  561. package/.versions/2.0.22/skills/compound-learning/SKILL.md +137 -0
  562. package/.versions/2.0.22/skills/constraint-driven-development/SKILL.md +338 -0
  563. package/.versions/2.0.22/skills/constraint-driven-development/references/floor-guard.md +99 -0
  564. package/.versions/2.0.22/skills/context-engineering/SKILL.md +341 -0
  565. package/.versions/2.0.22/skills/deprecation-and-migration/SKILL.md +247 -0
  566. package/.versions/2.0.22/skills/designing-agents/SKILL.md +394 -0
  567. package/.versions/2.0.22/skills/designing-agents/pi-harness-authoring.md +222 -0
  568. package/.versions/2.0.22/skills/drafting-workflows/SKILL.md +143 -0
  569. package/.versions/2.0.22/skills/drafting-workflows/scripts/make-workflow.ts +177 -0
  570. package/.versions/2.0.22/skills/frontend-ui-engineering/SKILL.md +328 -0
  571. package/.versions/2.0.22/skills/git-workflow-and-versioning/SKILL.md +316 -0
  572. package/.versions/2.0.22/skills/idea-refine/SKILL.md +182 -0
  573. package/.versions/2.0.22/skills/idea-refine/examples.md +238 -0
  574. package/.versions/2.0.22/skills/idea-refine/frameworks.md +99 -0
  575. package/.versions/2.0.22/skills/idea-refine/refinement-criteria.md +113 -0
  576. package/.versions/2.0.22/skills/idea-refine/scripts/idea-refine.sh +15 -0
  577. package/.versions/2.0.22/skills/incremental-implementation/SKILL.md +353 -0
  578. package/.versions/2.0.22/skills/incremental-implementation.zip +0 -0
  579. package/.versions/2.0.22/skills/interview-me/SKILL.md +226 -0
  580. package/.versions/2.0.22/skills/orchestration-verification/SKILL.md +182 -0
  581. package/.versions/2.0.22/skills/peer-coms/SKILL.md +90 -0
  582. package/.versions/2.0.22/skills/performance-optimization/SKILL.md +496 -0
  583. package/.versions/2.0.22/skills/planning-and-task-breakdown/SKILL.md +318 -0
  584. package/.versions/2.0.22/skills/planning-and-task-breakdown.zip +0 -0
  585. package/.versions/2.0.22/skills/repository-ai-setup/SKILL.md +135 -0
  586. package/.versions/2.0.22/skills/repository-ai-setup/references/agent-fleet-ai-state.template.json +4 -0
  587. package/.versions/2.0.22/skills/repository-ai-setup/references/apply-contract.md +74 -0
  588. package/.versions/2.0.22/skills/repository-ai-setup/references/provenance-template.md +16 -0
  589. package/.versions/2.0.22/skills/repository-ai-setup/references/setup-flow.md +108 -0
  590. package/.versions/2.0.22/skills/repository-ai-setup/references/verify-setup.md +20 -0
  591. package/.versions/2.0.22/skills/repository-ai-setup.zip +0 -0
  592. package/.versions/2.0.22/skills/security-and-hardening/SKILL.md +524 -0
  593. package/.versions/2.0.22/skills/spec-driven-development/SKILL.md +295 -0
  594. package/.versions/2.0.22/skills/spec-driven-development.zip +0 -0
  595. package/.versions/2.0.22/skills/using-agent-skills/SKILL.md +198 -0
  596. package/.versions/2.0.22/vendor/agent-skills-upstream/LICENSE +21 -0
  597. package/.versions/2.0.22/vendor/agent-skills-upstream/README.md +430 -0
  598. package/.versions/2.0.22/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +367 -0
  599. package/.versions/2.0.22/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
  600. package/.versions/2.0.22/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
  601. package/.versions/2.0.22/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
  602. package/.versions/2.0.22/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
  603. package/.versions/2.0.22/vendor/agent-skills-upstream/skills/constraint-driven-development/SKILL.md +311 -0
  604. package/.versions/2.0.22/vendor/agent-skills-upstream/skills/constraint-driven-development/references/floor-guard.md +99 -0
  605. package/.versions/2.0.22/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +337 -0
  606. package/.versions/2.0.22/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
  607. package/.versions/2.0.22/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
  608. package/.versions/2.0.22/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +288 -0
  609. package/.versions/2.0.22/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
  610. package/.versions/2.0.22/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
  611. package/.versions/2.0.22/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
  612. package/.versions/2.0.22/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
  613. package/.versions/2.0.22/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
  614. package/.versions/2.0.22/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
  615. package/.versions/2.0.22/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
  616. package/.versions/2.0.22/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
  617. package/.versions/2.0.22/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
  618. package/.versions/2.0.22/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
  619. package/.versions/2.0.22/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +238 -0
  620. package/.versions/2.0.22/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +496 -0
  621. package/.versions/2.0.22/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +257 -0
  622. package/.versions/2.0.22/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +524 -0
  623. package/.versions/2.0.22/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +330 -0
  624. package/.versions/2.0.22/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +216 -0
  625. package/.versions/2.0.22/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +245 -0
  626. package/.versions/2.0.22/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +398 -0
  627. package/.versions/2.0.22/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +192 -0
  628. package/CHANGELOG.md +13 -0
  629. package/bin/cli.js +3 -2
  630. package/docs/ARCHITECTURE.md +6 -3
  631. package/docs/system1-damage-guard.md +23 -2
  632. package/install-manifest.json +1 -1
  633. package/package.json +1 -1
@@ -0,0 +1,380 @@
1
+ # Prompting Patterns Reference
2
+
3
+ Consolidated prompt-engineering best practices for authoring instructions that coding agents will follow. Use alongside the `designing-agents`, `context-engineering`, and `using-agent-skills` skills, and consult this file before finalizing any agent persona, slash command, skill, pi harness, or rule file.
4
+
5
+ ## How to Use This Reference
6
+
7
+ Three primary audiences:
8
+
9
+ 1. **Persona authors** writing files under `.pi/agents/personas/` — check sections 1-3, 6, 7, 12 before writing.
10
+ 2. **Skill authors** writing files under `skills/` — check sections 1, 2, 4, 6.4, 7, 12 before writing.
11
+ 3. **Rule-file authors** writing project rules (CLAUDE.md, AGENTS.md, or supplementary rule files) — check sections 1.4, 2, 9, 11, 12.
12
+
13
+ Source attribution key: **[A]** = Anthropic, **[O]** = OpenAI, **[A+O]** = both vendors agree.
14
+
15
+ ## Table of Contents
16
+
17
+ 1. [Structural Foundations](#1-structural-foundations)
18
+ 2. [Clarity and Specificity](#2-clarity-and-specificity)
19
+ 3. [Role and Identity](#3-role-and-identity)
20
+ 4. [Examples (Few-Shot Prompting)](#4-examples-few-shot-prompting)
21
+ 5. [Tool Use and Function Calling](#5-tool-use-and-function-calling)
22
+ 6. [Agentic Behavior](#6-agentic-behavior)
23
+ 7. [Output Control](#7-output-control)
24
+ 8. [Thinking and Reasoning](#8-thinking-and-reasoning)
25
+ 9. [Layered Configuration Architecture](#9-layered-configuration-architecture)
26
+ 10. [Long-Horizon and Multi-Session Workflows](#10-long-horizon-and-multi-session-workflows)
27
+ 11. [Prompt Maintenance and Iteration](#11-prompt-maintenance-and-iteration)
28
+ 12. [Anti-Patterns to Avoid](#12-anti-patterns-to-avoid)
29
+ 13. [Sources](#sources)
30
+
31
+ ---
32
+
33
+ ## 1. Structural Foundations
34
+
35
+ ### 1.1 Use a Clear, Hierarchical Section Layout [A+O]
36
+
37
+ Structure prompts and rules with labeled sections using Markdown headers or XML tags. A recommended template:
38
+
39
+ ```
40
+ # Role and Objective
41
+ # Instructions
42
+ ## Sub-categories
43
+ # Constraints
44
+ # Output Format
45
+ # Examples
46
+ ```
47
+
48
+ - **[O]** Models trained on instruction-following (GPT-4.1+, Claude 4+) follow instructions more literally. Clear section labels help the model locate and apply the right rules at the right time.
49
+ - **[A]** Use numbered lists or bullet points when order or completeness matters.
50
+
51
+ ### 1.2 Use XML Tags for Structured Sections [A+O]
52
+
53
+ - **[A]** XML tags are the preferred delimiter for separating instructions, context, examples, and variable inputs. Use consistent, descriptive tag names (`<instructions>`, `<context>`, `<constraints>`). Nest tags when content has natural hierarchy.
54
+ - **[O]** Use XML tags for nested examples and metadata-tagged documents. Use Markdown for prose sections.
55
+ - **[A+O]** Avoid JSON for large document collections — both vendors report performance degradation.
56
+
57
+ ### 1.3 Instruction Placement Strategy [O]
58
+
59
+ For long-context prompts (20K+ tokens), place critical instructions at both the beginning **and** end of the prompt (the "sandwich" approach). This yields the best retrieval and adherence rates.
60
+
61
+ ### 1.4 Put Data Above Instructions [A]
62
+
63
+ Place longform data (documents, code, reference material) at the top of the prompt, with instructions and queries at the end. Anthropic testing showed up to 30% improved response quality.
64
+
65
+ ### 1.5 Later Instructions Take Priority [O]
66
+
67
+ In GPT-4.1+, when instructions conflict, the model prioritizes instructions appearing later. Use this to create a natural override hierarchy — put the most specific or important rules last.
68
+
69
+ ---
70
+
71
+ ## 2. Clarity and Specificity
72
+
73
+ ### 2.1 Be Explicit, Not Implicit [A+O]
74
+
75
+ Treat the model like a brilliant but new team member who lacks context on your norms. Specify everything explicitly.
76
+
77
+ - **[A]** Golden rule: show your prompt to a colleague with minimal context. If they would be confused, the model will be too.
78
+ - **[O]** Newer models do exactly what you say. A single clarifying sentence can redirect behavior, but omissions lead to undesired output.
79
+ - **[A+O]** Instead of "write clean code," specify: "Use descriptive variable names. Extract repeated logic into helpers. Add JSDoc to exported functions."
80
+
81
+ ### 2.2 Tell the Model What TO DO, Not What NOT to Do [A]
82
+
83
+ Positive instructions are more effective than prohibitions.
84
+
85
+ - Instead of: "Do not use markdown"
86
+ - Write: "Your response should be composed of smoothly flowing prose paragraphs."
87
+
88
+ ### 2.3 Explain WHY Behind Rules [A]
89
+
90
+ Providing motivation behind instructions helps the model generalize correctly and handle edge cases better.
91
+
92
+ - Instead of: "NEVER use ellipses"
93
+ - Write: "Never use ellipses because the response will be read aloud by a text-to-speech engine that cannot pronounce them."
94
+ - Instead of: "Always use absolute paths"
95
+ - Write: "Use absolute paths because the working directory resets between shell calls, so relative paths will break."
96
+
97
+ ### 2.4 Eliminate Contradictions [O]
98
+
99
+ Thoroughly review prompts for ambiguities and contradictions. Reasoning models (o1/o3, Claude extended thinking) expend tokens trying to reconcile conflicting directives rather than ignoring them.
100
+
101
+ - Example conflict: "Be concise" + "Err on the side of completeness."
102
+ - Resolution: "Default to concise responses (2-5 sentences). Provide detailed responses only when the change spans more than 3 files or the user explicitly requests detail."
103
+
104
+ ### 2.5 Remove Unnecessary Emphasis Patterns [A+O]
105
+
106
+ - **[O]** Avoid ALL-CAPS emphasis and reward/punishment language. These are unnecessary for modern models (GPT-4.1+) and can be counterproductive.
107
+ - **[A]** Replace "CRITICAL: You MUST use this tool when..." with normal language like "Use this tool when..." Claude 4+ models are significantly more responsive to the system prompt; aggressive language causes overtriggering.
108
+
109
+ ---
110
+
111
+ ## 3. Role and Identity
112
+
113
+ ### 3.1 Set a Role [A+O]
114
+
115
+ - **[A]** Set a role in the system prompt to focus behavior and tone. Even a single sentence makes a difference.
116
+ - **[O]** Frame coding agents as an autonomous senior pair-programmer who gathers context, plans, implements, tests, and refines without waiting for intermediate prompts.
117
+
118
+ ### 3.2 Scale Role Complexity to Task [A]
119
+
120
+ For simple tasks, a one-line role suffices. For complex agent systems, describe the persona's expertise, priorities, and behavioral constraints in detail.
121
+
122
+ ---
123
+
124
+ ## 4. Examples (Few-Shot Prompting)
125
+
126
+ ### 4.1 Include Relevant Examples [A+O]
127
+
128
+ - **[A]** Include 3-5 well-crafted examples to steer output format, tone, and structure. Wrap examples in `<example>` tags so the model distinguishes them from instructions.
129
+ - **[O]** Combine few-shot examples into a concise YAML-style or bulleted block. Place them in a dedicated `# Examples` section.
130
+
131
+ ### 4.2 Example Quality Requirements [A]
132
+
133
+ Good examples must be:
134
+ - **Relevant** — mirror your actual use case closely.
135
+ - **Diverse** — cover edge cases to prevent unintended pattern-matching.
136
+ - **Structured** — wrapped in tags to distinguish from instructions.
137
+
138
+ ### 4.3 Reasoning Models Need Fewer Examples [O]
139
+
140
+ For reasoning models (o1/o3), use zero-shot or at most one example. Multiple examples constrain internal reasoning rather than helping it.
141
+
142
+ ### 4.4 Show Reasoning Patterns in Examples [A]
143
+
144
+ Include `<thinking>` tags inside few-shot examples to demonstrate desired reasoning patterns. The model will generalize that reasoning style.
145
+
146
+ ---
147
+
148
+ ## 5. Tool Use and Function Calling
149
+
150
+ ### 5.1 Use Native API Tool Definitions [O]
151
+
152
+ Use the API-native `tools` field rather than manually injecting tool descriptions into prompt text. OpenAI testing showed 2% performance gain.
153
+
154
+ ### 5.2 Tool Description Best Practices [A+O]
155
+
156
+ - **[A+O]** Use clear, semantically meaningful tool names.
157
+ - **[O]** Include "when to use" and "when not to use" guidance.
158
+ - **[O]** Add a safety valve: "If insufficient information to call the tool, ask the user."
159
+ - **[A]** Use normal language instead of aggressive prompting. Replace "Default to using [tool]" with "Use [tool] when it would enhance your understanding of the problem."
160
+
161
+ ### 5.3 Enable Parallel Tool Calls [A+O]
162
+
163
+ - **[A+O]** Explicitly prompt for parallel tool execution when calls are independent.
164
+ - **[A]** Recommended phrasing: "If you intend to call multiple tools and there are no dependencies between the tool calls, make all independent calls in parallel. If some calls depend on previous results, do NOT call them in parallel."
165
+ - **[O]** "Think first before any tool call and decide all needed files upfront. Batch everything together."
166
+
167
+ ### 5.4 Prefer Dedicated Tools Over Shell [A+O]
168
+
169
+ - **[A]** Use Read instead of cat, Edit instead of sed, Grep instead of grep.
170
+ - **[O]** Use apply_patch, read_file, semantic_search as defaults. Only invoke the shell when no specialized tool exists.
171
+
172
+ ### 5.5 Add Tools Incrementally [O]
173
+
174
+ Start with 1-2 tools that eliminate current manual loops. Adding too many tools at once confuses tool selection and increases incorrect calls.
175
+
176
+ ---
177
+
178
+ ## 6. Agentic Behavior
179
+
180
+ ### 6.1 The Three Critical Agent Instructions [O]
181
+
182
+ Anchor every coding agent prompt with:
183
+
184
+ 1. **Persistence:** "Keep going until the user's query is completely resolved. Only terminate when you are sure the problem is solved."
185
+ 2. **Tool utilization:** "If you are not sure about file content or codebase structure, use your tools to read files. Do NOT guess or make up an answer."
186
+ 3. **Planning:** Require explicit reasoning steps before tool calls rather than silent tool-call chains.
187
+
188
+ OpenAI testing showed these three instructions boosted SWE-bench scores by ~20%.
189
+
190
+ ### 6.2 Provide Clear Completion Criteria [O]
191
+
192
+ Every task prompt should include a "Done When" section. Example: "Done when: all existing tests pass, the new endpoint returns the correct schema, and no TypeScript errors remain."
193
+
194
+ ### 6.3 Investigate Before Answering [A]
195
+
196
+ Never speculate about code you have not opened. If the user references a specific file, read it before answering. Give grounded, hallucination-free answers.
197
+
198
+ ### 6.4 Prevent Overengineering [A]
199
+
200
+ Explicitly instruct:
201
+ - Do not add features, refactor code, or make "improvements" beyond what was asked.
202
+ - Do not add docstrings, comments, or type annotations to code you did not change.
203
+ - Do not add error handling for scenarios that cannot happen. Only validate at system boundaries.
204
+ - Do not create helpers or utilities for one-time operations.
205
+
206
+ ### 6.5 Prevent Test-Focused Hard-Coding [A]
207
+
208
+ "Implement solutions that work correctly for all valid inputs, not just the test cases. Do not hard-code values. Tests verify correctness — they do not define the solution."
209
+
210
+ ### 6.6 Balance Autonomy and Safety [A+O]
211
+
212
+ - **[A]** Consider reversibility and blast radius. Take local, reversible actions freely. Confirm before destructive operations (deleting files, force-pushing, dropping tables).
213
+ - **[O]** Start restrictive, widen permissions based on observed needs. Do not grant full permissions before understanding workflows.
214
+
215
+ ### 6.7 Subagent Orchestration [A]
216
+
217
+ Use subagents when tasks can run in parallel, require isolated context, or involve independent workstreams. For simple tasks, single-file edits, or tasks requiring context continuity, work directly.
218
+
219
+ ### 6.8 Require Verification Loop [O]
220
+
221
+ Include a verification loop in agent workflows:
222
+ 1. Write or update tests for changes.
223
+ 2. Run relevant test suites.
224
+ 3. Execute lint, formatting, and type checks.
225
+ 4. Confirm final behavior matches requirements.
226
+ 5. Review diffs for bugs, regressions, or risky patterns.
227
+
228
+ ---
229
+
230
+ ## 7. Output Control
231
+
232
+ ### 7.1 Scale Output to Change Size [O]
233
+
234
+ - Tiny changes (10 lines or fewer): 2-5 sentences, 0-1 short snippet.
235
+ - Medium changes: 6 bullets or fewer, 1-2 snippets (8 lines max each).
236
+ - Large changes: Summarize per file with 1-2 bullets; avoid inlining code.
237
+
238
+ ### 7.2 Reference Files, Don't Reproduce Code [O]
239
+
240
+ Reference file paths instead of showing large code blocks. Show code only when necessary to clarify intent.
241
+
242
+ ### 7.3 Suppress Unnecessary Output [O]
243
+
244
+ Omit build/lint/test logs unless explicitly requested or they reveal blocking errors. Report outcomes, not processes.
245
+
246
+ ### 7.4 Control Format via Prompt Style [A]
247
+
248
+ Match your prompt formatting to desired output formatting. If your prompt is markdown-heavy, the output will be too. Remove markdown from your prompt if you want prose output.
249
+
250
+ ### 7.5 Eliminate Preambles [A]
251
+
252
+ Use direct instructions: "Respond directly without preamble. Do not start with phrases like 'Here is...', 'Based on...', etc."
253
+
254
+ ---
255
+
256
+ ## 8. Thinking and Reasoning
257
+
258
+ ### 8.1 Use Adaptive Thinking [A]
259
+
260
+ Prefer adaptive thinking (`thinking: {type: "adaptive"}`) with the `effort` parameter instead of manual `budget_tokens`. Claude dynamically decides when and how much to think.
261
+
262
+ ### 8.2 Reasoning Effort as a Tuning Knob [A+O]
263
+
264
+ - **[A]** `low` for high-volume, `medium` for most apps, `high` for complex coding, `max` for hardest problems.
265
+ - **[O]** Lower reasoning effort with better prompts can match higher reasoning effort with poor prompts.
266
+
267
+ ### 8.3 Prefer General Instructions Over Prescriptive Steps [A]
268
+
269
+ "Think thoroughly" often produces better reasoning than a hand-written step-by-step plan. Let the model organize its own thinking.
270
+
271
+ ### 8.4 Ask the Model to Self-Check [A]
272
+
273
+ "Before you finish, verify your answer against [test criteria]." This catches errors reliably, especially for coding and math.
274
+
275
+ ### 8.5 Reasoning Models Need Simpler Prompts [O]
276
+
277
+ Do NOT use chain-of-thought instructions ("think step by step") with reasoning models (o1/o3). They generate internal CoT; external prompting conflicts with it and can degrade performance.
278
+
279
+ ---
280
+
281
+ ## 9. Layered Configuration Architecture
282
+
283
+ ### 9.1 Structure Guidance in Layers [O]
284
+
285
+ Build a layered configuration system:
286
+ 1. **Task prompt** — immediate goal, context, constraints, done-when.
287
+ 2. **Rules files** (CLAUDE.md / AGENTS.md) — durable, reusable rules for the repository.
288
+ 3. **Configuration files** — model choice, reasoning effort, sandbox mode.
289
+ 4. **Tools** — external system integrations.
290
+ 5. **Skills** — packaged repeatable workflows.
291
+
292
+ ### 9.2 Keep Rules Files Concise [A+O]
293
+
294
+ - **[O]** "A short, accurate rules file is more useful than a long file full of vague rules." Add rules only after noticing repeated mistakes.
295
+ - **[A]** Keep the always-loaded core small. Load domain and task rules only when the current task needs them.
296
+
297
+ ### 9.3 Hierarchical Override Strategy [O]
298
+
299
+ Use a three-layer override hierarchy (global → repository → subdirectory). General rules are inherited; specific directories can override them.
300
+
301
+ ---
302
+
303
+ ## 10. Long-Horizon and Multi-Session Workflows
304
+
305
+ ### 10.1 Context Persistence [A]
306
+
307
+ Tell the model about context compaction: "Your context window will be automatically compacted as it approaches its limit. Do not stop tasks early due to token budget concerns. Save progress and state to memory before the context window refreshes."
308
+
309
+ ### 10.2 State Management [A]
310
+
311
+ - Use structured JSON for state data (test results, task status).
312
+ - Use freeform text for progress notes.
313
+ - Use git for state tracking across sessions.
314
+ - Create setup scripts to prevent repeated work when continuing from a fresh context.
315
+
316
+ ### 10.3 Resuming Fresh Context Windows [A]
317
+
318
+ Be prescriptive about how the model should resume: "Review progress files, test status, and git logs. Run a fundamental integration test before implementing new features."
319
+
320
+ ---
321
+
322
+ ## 11. Prompt Maintenance and Iteration
323
+
324
+ ### 11.1 Start Minimal, Add Rules for Observed Failures [A+O]
325
+
326
+ - **[O]** Start with the smallest prompt that passes evaluations. Add blocks only when they fix a measured failure mode.
327
+ - **[A]** Dial back anti-laziness prompting. Prompts designed for older models may cause overtriggering on newer ones.
328
+
329
+ ### 11.2 Use the Model as Its Own Optimizer [O]
330
+
331
+ When a prompt underperforms, ask the model to diagnose root causes and propose surgical revisions. Focus on clarifying conflicts and tightening vague rules rather than full rewrites.
332
+
333
+ ### 11.3 Build Evaluations Before Changing Prompts [O]
334
+
335
+ Build evaluation systems to measure prompt behavior before deploying changes. Pin production applications to specific model snapshots. Run evaluations every time you publish prompt changes.
336
+
337
+ ### 11.4 Audit for Model Generation Changes [A]
338
+
339
+ When upgrading to a new model generation:
340
+ - Replace blanket defaults with targeted instructions.
341
+ - Remove aggressive "If in doubt, use [tool]" prompting.
342
+ - Test for overtriggering and overengineering.
343
+ - Adjust emphasis patterns (remove ALL-CAPS, reward/punishment language).
344
+
345
+ ---
346
+
347
+ ## 12. Anti-Patterns to Avoid [A+O]
348
+
349
+ | Anti-Pattern | Source | Fix |
350
+ |---|---|---|
351
+ | Overloading prompts with durable rules | O | Move to rules files or repository docs |
352
+ | No build/test feedback to agent | O | Include verification loop |
353
+ | Skipping planning on complex tasks | O | Use plan mode or require explicit planning |
354
+ | ALL-CAPS and reward language | A+O | Use structured formatting instead |
355
+ | Contradictory instructions | O | Audit and resolve before deployment |
356
+ | Aggressive tool prompting ("MUST use") | A | Use normal language ("Use this when...") |
357
+ | Many few-shot examples for reasoning models | O | Use zero-shot or one example max |
358
+ | Not explaining WHY behind rules | A | Add motivation to help generalization |
359
+ | Telling model what NOT to do | A | Reframe as positive instructions |
360
+ | One thread per project instead of per task | O | One thread per coherent unit of work |
361
+ | Forcing tool calls without sufficient info | O | Add "ask the user" safety valve |
362
+ | Sample phrases repeated verbatim | O | Instruct variation explicitly |
363
+
364
+ ---
365
+
366
+ ## Sources
367
+
368
+ ### Anthropic
369
+ - [Claude Prompting Best Practices](https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/overview) (consolidated guide)
370
+ - [Prompt Caching](https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching)
371
+ - [Extended Thinking](https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking)
372
+
373
+ ### OpenAI
374
+ - [GPT-4.1 Prompting Guide](https://developers.openai.com/cookbook/examples/gpt4-1_prompting_guide/)
375
+ - [GPT-5 Prompting Guide](https://developers.openai.com/cookbook/examples/gpt-5/gpt-5_prompting_guide/)
376
+ - [GPT-5.1 Prompting Guide](https://developers.openai.com/cookbook/examples/gpt-5/gpt-5-1_prompting_guide/)
377
+ - [Codex Prompting Guide](https://developers.openai.com/cookbook/examples/gpt-5/codex_prompting_guide/)
378
+ - [Codex Best Practices](https://developers.openai.com/codex/learn/best-practices/)
379
+ - [Prompt Engineering Guide](https://developers.openai.com/api/docs/guides/prompt-engineering/)
380
+ - [Reasoning Models Guide](https://platform.openai.com/docs/guides/reasoning)
@@ -0,0 +1,245 @@
1
+ # Security Checklist
2
+
3
+ Quick reference for web application security. Use alongside the `security-and-hardening` skill.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Threat Modeling (Start Here)](#threat-modeling-start-here)
8
+ - [Pre-Commit Checks](#pre-commit-checks)
9
+ - [Authentication](#authentication)
10
+ - [Authorization](#authorization)
11
+ - [Input Validation](#input-validation)
12
+ - [Security Headers](#security-headers)
13
+ - [CORS Configuration](#cors-configuration)
14
+ - [Data Protection](#data-protection)
15
+ - [Dependency Security](#dependency-security)
16
+ - [AI / LLM Security](#ai--llm-security)
17
+ - [Error Handling](#error-handling)
18
+ - [OWASP Top 10 Quick Reference](#owasp-top-10-quick-reference)
19
+ - [OWASP Top 10 for LLMs Quick Reference](#owasp-top-10-for-llms-quick-reference)
20
+
21
+ ## Threat Modeling (Start Here)
22
+
23
+ Before reaching for controls, spend five minutes thinking like an attacker:
24
+
25
+ - [ ] Trust boundaries mapped (requests, uploads, webhooks, third-party APIs, LLM output, and local values written by processes you don't control)
26
+ - [ ] Assets named (credentials, PII, payment data, admin actions, money movement)
27
+ - [ ] STRIDE run per boundary (Spoofing, Tampering, Repudiation, Info disclosure, DoS, Elevation)
28
+ - [ ] Abuse cases written next to use cases ("how would I misuse this?")
29
+
30
+ ## Pre-Commit Checks
31
+
32
+ - [ ] No secrets in code (`git diff --cached | grep -i "password\|secret\|api_key\|token"`)
33
+ - [ ] `.gitignore` covers: `.env`, `.env.local`, `*.pem`, `*.key`
34
+ - [ ] `.env.example` uses placeholder values (not real secrets)
35
+
36
+ ## Authentication
37
+
38
+ - [ ] Passwords hashed with bcrypt (≥12 rounds), scrypt, or argon2
39
+ - [ ] Session cookies: `httpOnly`, `secure`, `sameSite: 'lax'`
40
+ - [ ] Session expiration configured (reasonable max-age)
41
+ - [ ] Rate limiting on login endpoint (≤10 attempts per 15 minutes)
42
+ - [ ] Password reset tokens: time-limited (≤1 hour), single-use
43
+ - [ ] Account lockout after repeated failures (optional, with notification)
44
+ - [ ] MFA supported for sensitive operations (optional but recommended)
45
+
46
+ ## Authorization
47
+
48
+ - [ ] Every protected endpoint checks authentication
49
+ - [ ] Every resource access checks ownership/role (prevents IDOR)
50
+ - [ ] Admin endpoints require admin role verification
51
+ - [ ] API keys scoped to minimum necessary permissions
52
+ - [ ] JWT tokens validated (signature, expiration, issuer)
53
+
54
+ ## Input Validation
55
+
56
+ - [ ] All user input validated at system boundaries (API routes, form handlers)
57
+ - [ ] Validation uses allowlists (not denylists)
58
+ - [ ] String lengths constrained (min/max)
59
+ - [ ] Numeric ranges validated
60
+ - [ ] Email, URL, and date formats validated with proper libraries
61
+ - [ ] File uploads: type restricted, size limited, content verified
62
+ - [ ] SQL queries parameterized (no string concatenation)
63
+ - [ ] HTML output encoded (use framework auto-escaping)
64
+ - [ ] URLs validated before redirect (prevent open redirect)
65
+ - [ ] Server-side URL fetches allowlisted; private/reserved IPs blocked (prevent SSRF)
66
+ - [ ] Destructive path operations (delete/move/overwrite): symlinks resolved, allowlisted root, minimum depth, ownership evidence read before the call
67
+
68
+ ### Destructive Path Operations
69
+
70
+ Containment for a target named by data. Resolve first, then decide — and treat the
71
+ result as a candidate, not as authorization:
72
+
73
+ ```typescript
74
+ import { realpath, readFile } from 'node:fs/promises';
75
+ import { resolve, relative, isAbsolute, join, sep } from 'node:path';
76
+
77
+ const ALLOWED_ROOTS = ['/var/lib/myapp/sessions']; // an allowlist, not a pattern
78
+ const MIN_DEPTH = 1; // so a root is never the target
79
+
80
+ async function resolveDeletable(candidate: string, expectedOwner: string) {
81
+ const target = await realpath(resolve(candidate)); // symlinks resolved BEFORE the check
82
+ const inRoot = ALLOWED_ROOTS.some((root) => {
83
+ const rel = relative(root, target);
84
+ // `rel === '..'` / `'../'` only — a plain `startsWith('..')` would also
85
+ // reject a legitimate child named `..cache`.
86
+ if (rel === '' || rel === '..' || rel.startsWith(`..${sep}`) || isAbsolute(rel)) return false;
87
+ return rel.split(sep).length >= MIN_DEPTH;
88
+ });
89
+ if (!inRoot) throw new Error(`refusing: outside allowed roots (${target})`);
90
+
91
+ const owner = await readFile(join(target, '.owner'), 'utf8').catch(() => null);
92
+ if (owner?.trim() !== expectedOwner) throw new Error(`refusing: unproven owner (${target})`);
93
+ return target;
94
+ }
95
+ ```
96
+
97
+ What this does not do, and must be said where the snippet is copied from:
98
+
99
+ - **The marker is self-attestation.** Anything that can write inside the root can write
100
+ `.owner`. `expectedOwner` has to come from authenticated state, and the marker needs
101
+ integrity protection (restrictive ownership, or a MAC) before it is authorization
102
+ rather than a consistency check against a misderived target.
103
+ - **Returning a path leaves a check/use race.** Where an untrusted process can swap an
104
+ ancestor between the check and the call, operate on a descriptor with no-follow,
105
+ beneath-the-root semantics, or guarantee the hierarchy is immutable for the duration.
106
+
107
+ ## Security Headers
108
+
109
+ ```
110
+ Content-Security-Policy: default-src 'self'; script-src 'self'
111
+ Strict-Transport-Security: max-age=31536000; includeSubDomains
112
+ X-Content-Type-Options: nosniff
113
+ X-Frame-Options: DENY
114
+ X-XSS-Protection: 0 (disabled, rely on CSP)
115
+ Referrer-Policy: strict-origin-when-cross-origin
116
+ Permissions-Policy: camera=(), microphone=(), geolocation=()
117
+ ```
118
+
119
+ ## CORS Configuration
120
+
121
+ ```typescript
122
+ // Restrictive (recommended)
123
+ cors({
124
+ origin: ['https://yourdomain.com', 'https://app.yourdomain.com'],
125
+ credentials: true,
126
+ methods: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'],
127
+ allowedHeaders: ['Content-Type', 'Authorization'],
128
+ })
129
+
130
+ // NEVER use in production:
131
+ cors({ origin: '*' }) // Allows any origin
132
+ ```
133
+
134
+ ## Data Protection
135
+
136
+ - [ ] Sensitive fields excluded from API responses (`passwordHash`, `resetToken`, etc.)
137
+ - [ ] Sensitive data not logged (passwords, tokens, full CC numbers)
138
+ - [ ] PII encrypted at rest (if required by regulation)
139
+ - [ ] HTTPS for all external communication
140
+ - [ ] Database backups encrypted
141
+
142
+ ## Dependency Security
143
+
144
+ First locate the **installation boundary**. If the package is matched by a parent `workspaces` declaration, use that workspace root; otherwise use the nearest project root that owns both its manifest and dependency graph. At that boundary, corroborate `packageManager` (when present), the lockfile, and CI commands. Stop if they disagree or competing manager lockfiles exist there. A nested project is independent only when it is outside the parent workspace; independent subprojects may legitimately use different managers.
145
+
146
+ | Manager/version signal | Frozen/immutable CI install | Known-advisory audit |
147
+ |---|---|---|
148
+ | npm (`package-lock.json` or `npm-shrinkwrap.json`) | `npm ci` | `npm audit` |
149
+ | pnpm | `pnpm install --frozen-lockfile` | `pnpm audit` |
150
+ | Yarn 2+ | `yarn install --immutable` | `yarn npm audit -A -R` |
151
+ | Yarn 1 | `yarn install --frozen-lockfile` | `yarn audit` |
152
+
153
+ For an unlisted manager or version, consult its official documentation; do not substitute another manager's commands or newer defaults.
154
+
155
+ ### Install-Script Gate
156
+
157
+ Never discover dependency lifecycle scripts by first executing an ordinary install on a client whose defaults have not been verified.
158
+
159
+ 1. Bootstrap with dependency scripts disabled, or with a documented default-deny policy plus fail-closed enforcement.
160
+ 2. Inspect the exact script source and package version before approval.
161
+ 3. Record the narrowest native allow/deny policy at the installation boundary and commit it.
162
+ 4. Run a clean frozen/immutable install with that policy and verify the required packages still build.
163
+
164
+ **Point-in-time snapshot:** Package-manager defaults and command names change quickly. Verify this matrix against the pinned client's current official documentation before relying on it.
165
+
166
+ | Manager version | Native policy |
167
+ |---|---|
168
+ | npm without verified granular approvals | Bootstrap with `npm ci --ignore-scripts`, or persist `ignore-scripts=true` when project-wide blocking is intended. Keep scripts disabled or deliberately upgrade before allowing any reviewed dependency script. |
169
+ | npm 11.18.x (verified on 11.18.0) | Unreviewed dependency scripts run with a warning by default. Enforce `strict-allow-scripts=true` before a normal install, then use the workspace-unaware `npm install-scripts ls` from the installation boundary; keep approvals version-pinned and denials name-wide. |
170
+ | npm 12.x (verified on 12.0.1) | Unreviewed dependency scripts are skipped by default; `strict-allow-scripts=true` makes their presence fail the install before execution. Use the same `npm install-scripts` review and approval flow. |
171
+ | pnpm 11+ | Use `pnpm approve-builds` and commit `allowBuilds` decisions; `strictDepBuilds` defaults to `true`, so unreviewed builds fail. |
172
+ | pnpm 10.26–10.x | Configure `allowBuilds` explicitly, or use `pnpm approve-builds` with the legacy `onlyBuiltDependencies` / `ignoredBuiltDependencies` lists. Set `strictDepBuilds: true`; its v10 default is `false`. |
173
+ | pnpm 10.1–10.25 | `pnpm approve-builds` records the legacy lists; enable `strictDepBuilds` where supported (10.3+). |
174
+ | Older or unknown pnpm | Bootstrap with `pnpm install --frozen-lockfile --ignore-scripts`. Keep scripts disabled unless the pinned version documents an enforceable policy. |
175
+ | Yarn 4.14+ | Dependency postinstalls are disabled by default. Grant only required exceptions with top-level `dependenciesMeta.<package>.built: true`. |
176
+ | Yarn 2–4.13 | Set `enableScripts: false` in `.yarnrc.yml`, then grant only required exceptions with top-level `dependenciesMeta.<package>.built: true`; do not enable scripts globally. |
177
+ | Yarn 1 | Bootstrap with `yarn install --ignore-scripts`; keep scripts disabled unless each required exception is reviewed under the pinned client's documented workflow. |
178
+
179
+ Authoritative checks: [npm install-scripts](https://docs.npmjs.com/cli/v11/commands/npm-install-scripts/), [install policy](https://docs.npmjs.com/cli/v11/commands/npm-install/), and [CLI releases](https://github.com/npm/cli/releases); [pnpm approve-builds](https://pnpm.io/cli/approve-builds) and [build settings](https://pnpm.io/settings#allowbuilds); [Yarn security](https://yarnpkg.com/features/security) and [manifest](https://yarnpkg.com/configuration/manifest#dependenciesMeta).
180
+
181
+ **Supply-chain hygiene** (advisory audits do not catch newly malicious packages):
182
+ - [ ] Exactly one authoritative lockfile per project/workspace root is committed and CI never rewrites it
183
+ - [ ] Critical/high findings are triaged for reachability; deferrals have a reason and review date
184
+ - [ ] Forced audit remediation (`npm audit fix --force` or equivalent) is never automatic; remediation diffs and changelogs are reviewed
185
+ - [ ] Registry signatures/provenance are verified where the manager supports it
186
+ - [ ] Dependency lifecycle scripts are blocked before first execution and approved only through the pinned manager's native policy
187
+ - [ ] New dependencies are reviewed for ownership, maintenance, release age, provenance, transitive graph, and typosquatting
188
+
189
+ ## AI / LLM Security
190
+
191
+ For any feature that calls an LLM (chatbots, summarizers, agents, RAG):
192
+
193
+ - [ ] Model output treated as untrusted — never into `eval`/SQL/shell/`innerHTML`/file paths
194
+ - [ ] Prompt injection assumed; permissions enforced in code, not in the system prompt
195
+ - [ ] Secrets, cross-tenant data, and full system prompts kept out of the context window
196
+ - [ ] Tool/agent permissions scoped; destructive or irreversible actions require confirmation
197
+ - [ ] Token, rate, and recursion/loop limits set (bound consumption)
198
+
199
+ ## Error Handling
200
+
201
+ ```typescript
202
+ // Production: generic error, no internals
203
+ res.status(500).json({
204
+ error: { code: 'INTERNAL_ERROR', message: 'Something went wrong' }
205
+ });
206
+
207
+ // NEVER in production:
208
+ res.status(500).json({
209
+ error: err.message,
210
+ stack: err.stack, // Exposes internals
211
+ query: err.sql, // Exposes database details
212
+ });
213
+ ```
214
+
215
+ ## OWASP Top 10 Quick Reference
216
+
217
+ | # | Vulnerability | Prevention |
218
+ |---|---|---|
219
+ | 1 | Broken Access Control | Auth checks on every endpoint, ownership verification |
220
+ | 2 | Cryptographic Failures | HTTPS, strong hashing, no secrets in code |
221
+ | 3 | Injection | Parameterized queries, input validation |
222
+ | 4 | Insecure Design | Threat modeling, spec-driven development |
223
+ | 5 | Security Misconfiguration | Security headers, minimal permissions, audit deps |
224
+ | 6 | Vulnerable Components | The ecosystem's dependency audit (`npm audit`, `pip-audit`, ...), keep deps updated, minimal deps |
225
+ | 7 | Auth Failures | Strong passwords, rate limiting, session management |
226
+ | 8 | Data Integrity Failures | Verify updates/dependencies, signed artifacts |
227
+ | 9 | Logging Failures | Log security events, don't log secrets |
228
+ | 10 | SSRF | Validate/allowlist URLs, restrict outbound requests |
229
+
230
+ ## OWASP Top 10 for LLMs Quick Reference
231
+
232
+ For apps with LLM features. See the [OWASP GenAI Security Project](https://genai.owasp.org/llm-top-10/).
233
+
234
+ | ID | Risk | Prevention |
235
+ |---|---|---|
236
+ | LLM01 | Prompt Injection | Don't trust the system prompt as a boundary; enforce permissions in code |
237
+ | LLM02 | Sensitive Information Disclosure | Keep secrets/PII out of prompts; filter outputs |
238
+ | LLM03 | Supply Chain | Vet models, datasets, and plugins like any dependency |
239
+ | LLM04 | Data and Model Poisoning | Use trusted model sources, verify integrity; vet fine-tuning and RAG data |
240
+ | LLM05 | Improper Output Handling | Treat model output as untrusted; validate, parameterize, encode |
241
+ | LLM06 | Excessive Agency | Scope tool permissions; confirm destructive actions |
242
+ | LLM07 | System Prompt Leakage | Assume the system prompt can leak; put no secrets in it |
243
+ | LLM08 | Vector and Embedding Weaknesses | Partition RAG embeddings per tenant; validate documents before indexing |
244
+ | LLM09 | Misinformation | Ground answers with citations; validate critical claims; keep a human in the loop |
245
+ | LLM10 | Unbounded Consumption | Cap tokens, request rate, and loop/recursion depth |