failproofai 0.0.2-beta.6 → 0.0.2-beta.7

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 (159) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/build-manifest.json +5 -5
  3. package/.next/standalone/.next/prerender-manifest.json +3 -3
  4. package/.next/standalone/.next/required-server-files.json +1 -1
  5. package/.next/standalone/.next/server/app/_global-error/page/build-manifest.json +2 -2
  6. package/.next/standalone/.next/server/app/_global-error/page/server-reference-manifest.json +1 -1
  7. package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
  8. package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  10. package/.next/standalone/.next/server/app/_global-error.rsc +7 -7
  11. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +2 -2
  12. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +7 -7
  13. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +3 -3
  14. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +3 -3
  15. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  16. package/.next/standalone/.next/server/app/_not-found/page/build-manifest.json +2 -2
  17. package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
  18. package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  19. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  20. package/.next/standalone/.next/server/app/_not-found.html +2 -2
  21. package/.next/standalone/.next/server/app/_not-found.rsc +15 -15
  22. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +15 -15
  23. package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
  24. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +10 -10
  25. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  26. package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
  27. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  28. package/.next/standalone/.next/server/app/index.html +1 -1
  29. package/.next/standalone/.next/server/app/index.rsc +15 -15
  30. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  31. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +15 -15
  32. package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +4 -4
  33. package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +10 -10
  34. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  35. package/.next/standalone/.next/server/app/page/build-manifest.json +2 -2
  36. package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
  37. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  38. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  39. package/.next/standalone/.next/server/app/policies/page/build-manifest.json +2 -2
  40. package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +8 -8
  41. package/.next/standalone/.next/server/app/policies/page.js.nft.json +1 -1
  42. package/.next/standalone/.next/server/app/policies/page_client-reference-manifest.js +1 -1
  43. package/.next/standalone/.next/server/app/project/[name]/page/build-manifest.json +2 -2
  44. package/.next/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +1 -1
  45. package/.next/standalone/.next/server/app/project/[name]/page.js.nft.json +1 -1
  46. package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
  47. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/build-manifest.json +2 -2
  48. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
  49. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +2 -2
  50. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
  51. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
  52. package/.next/standalone/.next/server/app/projects/page/build-manifest.json +2 -2
  53. package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +1 -1
  54. package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
  55. package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
  56. package/.next/standalone/.next/server/chunks/[root-of-the-server]__02nt~6d._.js +1 -1
  57. package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_05pz9._._.js +1 -1
  58. package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_0z7w.hh._.js +1 -1
  59. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0u_n1xe._.js → [root-of-the-server]__05zi2mt._.js} +2 -2
  60. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__092s1ta._.js +2 -2
  61. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__09icjsf._.js +2 -2
  62. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0g.lg8b._.js +2 -2
  63. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0h..k-e._.js +2 -2
  64. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0epc5zr._.js → [root-of-the-server]__0kkt_9z._.js} +2 -2
  65. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0okos0k._.js +2 -2
  66. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0w6l33k._.js +8 -9
  67. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__11pa2ra._.js +2 -2
  68. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__12t-wym._.js +2 -2
  69. package/.next/standalone/.next/server/chunks/ssr/_10lm7or._.js +2 -2
  70. package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_0xerkr6._.js +1 -1
  71. package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_0q-m0y-._.js +1 -1
  72. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0a_7sdg.js +2 -2
  73. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0ef3uwk.js +2 -2
  74. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0j79~gv.js +2 -2
  75. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0pbja1x.js +2 -2
  76. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0r6o0i2.js +2 -2
  77. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_11y81~_.js +2 -2
  78. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_12or2kf.js +2 -2
  79. package/.next/standalone/.next/server/chunks/ssr/node_modules_posthog-node_dist_entrypoints_index_node_mjs_0mebn66._.js +1 -1
  80. package/.next/standalone/.next/server/middleware-build-manifest.js +5 -5
  81. package/.next/standalone/.next/server/pages/404.html +2 -2
  82. package/.next/standalone/.next/server/pages/500.html +1 -1
  83. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  84. package/.next/standalone/.next/server/server-reference-manifest.json +9 -9
  85. package/.next/standalone/.next/static/chunks/{0tood0~87-mm8.js → 02u4v.k5amfah.js} +1 -1
  86. package/.next/standalone/.next/static/chunks/{031pa5~qfzt~_.js → 09e7drilkf1sn.js} +1 -1
  87. package/.next/standalone/.next/static/chunks/{0jqg886bw85_6.js → 0bkizbynk9via.js} +1 -1
  88. package/.next/standalone/.next/static/chunks/{17p200_z1ivz4.js → 0e76l4~hq_sei.js} +1 -1
  89. package/.next/standalone/.next/static/chunks/{0wkzaq-8sxss7.js → 0ltx5i0xv85_s.js} +1 -1
  90. package/.next/standalone/.next/static/chunks/{0efsuf1p-k4qe.js → 0q7atesxo-36k.js} +1 -1
  91. package/.next/standalone/.next/static/chunks/{0rvepm.~uvks4.js → 0suauczjqzn07.js} +1 -1
  92. package/.next/standalone/.next/static/chunks/{0kbfx4p.g9wnr.js → 0w.rtg9.m8dk-.js} +2 -2
  93. package/.next/standalone/.next/static/chunks/{0_tx_~f8pi3d7.js → 13jdpvk~s2da8.js} +1 -1
  94. package/.next/standalone/.next/static/chunks/{turbopack-0uc5y~g6h.n7-.js → turbopack-0r26pc8h0y_-e.js} +1 -1
  95. package/.next/standalone/CHANGELOG.md +74 -0
  96. package/.next/standalone/CLAUDE.md +14 -0
  97. package/.next/standalone/README.md +20 -3
  98. package/.next/standalone/bin/failproofai.mjs +5 -0
  99. package/.next/standalone/bun.lock +31 -63
  100. package/.next/standalone/dist/cli.mjs +242 -61
  101. package/.next/standalone/docs/built-in-policies.mdx +2 -2
  102. package/.next/standalone/docs/configuration.mdx +46 -0
  103. package/.next/standalone/docs/custom-policies.mdx +63 -5
  104. package/.next/standalone/docs/docs.json +3 -3
  105. package/.next/standalone/examples/convention-policies/security-policies.mjs +40 -0
  106. package/.next/standalone/examples/convention-policies/workflow-policies.mjs +41 -0
  107. package/.next/standalone/node_modules/@next/env/package.json +1 -1
  108. package/.next/standalone/node_modules/next/dist/build/swc/index.js +1 -1
  109. package/.next/standalone/node_modules/next/dist/compiled/jsonwebtoken/index.js +2 -2
  110. package/.next/standalone/node_modules/next/dist/compiled/next-server/app-page-turbo-experimental.runtime.prod.js +1 -1
  111. package/.next/standalone/node_modules/next/dist/compiled/next-server/app-page-turbo.runtime.prod.js +1 -1
  112. package/.next/standalone/node_modules/next/dist/compiled/next-server/pages-turbo.runtime.prod.js +1 -1
  113. package/.next/standalone/node_modules/next/dist/lib/patch-incorrect-lockfile.js +3 -3
  114. package/.next/standalone/node_modules/next/dist/server/config.js +1 -1
  115. package/.next/standalone/node_modules/next/dist/server/dev/hot-reloader-turbopack.js +7 -2
  116. package/.next/standalone/node_modules/next/dist/server/dev/hot-reloader-webpack.js +1 -1
  117. package/.next/standalone/node_modules/next/dist/server/lib/app-info-log.js +1 -1
  118. package/.next/standalone/node_modules/next/dist/server/lib/start-server.js +1 -1
  119. package/.next/standalone/node_modules/next/dist/server/render.js +20 -19
  120. package/.next/standalone/node_modules/next/dist/shared/lib/errors/canary-only-config-error.js +1 -1
  121. package/.next/standalone/node_modules/next/dist/telemetry/anonymous-meta.js +1 -1
  122. package/.next/standalone/node_modules/next/dist/telemetry/events/swc-load-failure.js +1 -1
  123. package/.next/standalone/node_modules/next/dist/telemetry/events/version.js +2 -2
  124. package/.next/standalone/node_modules/next/package.json +15 -15
  125. package/.next/standalone/node_modules/react/cjs/react.development.js +1 -1
  126. package/.next/standalone/node_modules/react/cjs/react.production.js +1 -1
  127. package/.next/standalone/node_modules/react/package.json +1 -1
  128. package/.next/standalone/node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.js +1 -1
  129. package/.next/standalone/node_modules/react-dom/cjs/react-dom-server-legacy.node.production.js +1 -1
  130. package/.next/standalone/node_modules/react-dom/cjs/react-dom-server.browser.production.js +3 -3
  131. package/.next/standalone/node_modules/react-dom/cjs/react-dom-server.edge.production.js +3 -3
  132. package/.next/standalone/node_modules/react-dom/cjs/react-dom-server.node.production.js +3 -3
  133. package/.next/standalone/node_modules/react-dom/cjs/react-dom.production.js +1 -1
  134. package/.next/standalone/node_modules/react-dom/package.json +2 -2
  135. package/.next/standalone/package.json +1 -1
  136. package/.next/standalone/server.js +1 -1
  137. package/.next/standalone/src/hooks/builtin-policies.ts +70 -18
  138. package/.next/standalone/src/hooks/custom-hooks-loader.ts +158 -21
  139. package/.next/standalone/src/hooks/handler.ts +26 -6
  140. package/.next/standalone/src/hooks/hooks-config.ts +47 -2
  141. package/.next/standalone/src/hooks/llm-client.ts +2 -2
  142. package/.next/standalone/src/hooks/loader-utils.ts +4 -4
  143. package/.next/standalone/src/hooks/manager.ts +57 -14
  144. package/.next/standalone/src/hooks/policy-evaluator.ts +16 -2
  145. package/README.md +20 -3
  146. package/bin/failproofai.mjs +5 -0
  147. package/dist/cli.mjs +242 -61
  148. package/package.json +1 -1
  149. package/src/hooks/builtin-policies.ts +70 -18
  150. package/src/hooks/custom-hooks-loader.ts +158 -21
  151. package/src/hooks/handler.ts +26 -6
  152. package/src/hooks/hooks-config.ts +47 -2
  153. package/src/hooks/llm-client.ts +2 -2
  154. package/src/hooks/loader-utils.ts +4 -4
  155. package/src/hooks/manager.ts +57 -14
  156. package/src/hooks/policy-evaluator.ts +16 -2
  157. /package/.next/standalone/.next/static/{gDMch26rYN-bU-9f6ftKR → Opbai6exOQP2W488FWmr6}/_buildManifest.js +0 -0
  158. /package/.next/standalone/.next/static/{gDMch26rYN-bU-9f6ftKR → Opbai6exOQP2W488FWmr6}/_clientMiddlewareManifest.js +0 -0
  159. /package/.next/standalone/.next/static/{gDMch26rYN-bU-9f6ftKR → Opbai6exOQP2W488FWmr6}/_ssgManifest.js +0 -0
@@ -1,39 +1,51 @@
1
1
  /**
2
- * Loads a user-authored hooks.js file with ESM import rewriting.
2
+ * Loads user-authored policy files with ESM import rewriting.
3
3
  * Supports transitive local imports and `import { ... } from 'failproofai'`.
4
4
  *
5
+ * Two loading modes:
6
+ * 1. Explicit: a single file via `customPoliciesPath` in policies-config.json
7
+ * 2. Convention: auto-discovered *policies.{js,mjs,ts} files from
8
+ * .failproofai/policies/ at project and user level (git-hooks style)
9
+ *
5
10
  * Fail-open: any error (file not found, syntax error, import failure) is logged
6
- * and results in an empty hook list. Builtins continue running normally.
11
+ * and results in an empty hook list for that file. Builtins continue normally.
7
12
  */
8
- import { resolve, isAbsolute } from "node:path";
9
- import { existsSync } from "node:fs";
13
+ import { resolve, isAbsolute, basename } from "node:path";
14
+ import { existsSync, readdirSync } from "node:fs";
10
15
  import { pathToFileURL } from "node:url";
11
- import { hookLogWarn, hookLogError } from "./hook-logger";
16
+ import { homedir } from "node:os";
17
+ import { hookLogWarn, hookLogError, hookLogInfo } from "./hook-logger";
12
18
  import { getCustomHooks, clearCustomHooks } from "./custom-hooks-registry";
13
19
  import { findDistIndex, rewriteFileTree, TMP_SUFFIX, cleanupTmpFiles } from "./loader-utils";
14
20
  import type { CustomHook } from "./policy-types";
15
21
 
16
22
  const LOADING_KEY = "__FAILPROOFAI_LOADING_HOOKS__";
17
23
 
18
- export async function loadCustomHooks(
19
- customPoliciesPath: string | undefined,
20
- opts?: { strict?: boolean },
21
- ): Promise<CustomHook[]> {
22
- if (!customPoliciesPath) return [];
24
+ /** Regex matching convention policy filenames: *policies.{js,mjs,ts} */
25
+ const CONVENTION_FILE_RE = /policies\.(js|mjs|ts)$/;
23
26
 
24
- const absPath = isAbsolute(customPoliciesPath)
25
- ? customPoliciesPath
26
- : resolve(process.cwd(), customPoliciesPath);
27
-
28
- if (!existsSync(absPath)) {
29
- if (opts?.strict) throw new Error(`Custom hooks file not found: ${absPath}`);
30
- hookLogWarn(`customPoliciesPath not found: ${absPath}`);
27
+ /**
28
+ * Scan a directory for convention policy files (*policies.{js,mjs,ts}).
29
+ * Returns sorted absolute paths. Returns [] if the directory doesn't exist.
30
+ */
31
+ export function discoverPolicyFiles(dir: string): string[] {
32
+ if (!existsSync(dir)) return [];
33
+ try {
34
+ const entries = readdirSync(dir, { withFileTypes: true });
35
+ return entries
36
+ .filter((e) => e.isFile() && CONVENTION_FILE_RE.test(e.name))
37
+ .sort((a, b) => a.name.localeCompare(b.name))
38
+ .map((e) => resolve(dir, e.name));
39
+ } catch {
31
40
  return [];
32
41
  }
42
+ }
33
43
 
34
- // Clear registry before loading so each invocation starts fresh
35
- clearCustomHooks();
36
-
44
+ /**
45
+ * Load a single policy file into the globalThis custom hooks registry.
46
+ * Does NOT clear the registry — caller is responsible for that.
47
+ */
48
+ async function loadSingleFile(absPath: string, opts?: { strict?: boolean }): Promise<void> {
37
49
  const g = globalThis as Record<string, unknown>;
38
50
  g[LOADING_KEY] = true;
39
51
 
@@ -51,11 +63,136 @@ export async function loadCustomHooks(
51
63
  const msg = err instanceof Error ? err.message : String(err);
52
64
  if (opts?.strict) throw new Error(`Failed to load custom hooks from ${absPath}: ${msg}`);
53
65
  hookLogError(`failed to load custom hooks from ${absPath}: ${msg}`);
54
- return [];
55
66
  } finally {
56
67
  g[LOADING_KEY] = false;
57
68
  await cleanupTmpFiles(tmpFiles);
58
69
  }
70
+ }
71
+
72
+ /**
73
+ * Load a single explicit custom hooks file (legacy API).
74
+ * Clears the registry, loads the file, returns registered hooks.
75
+ */
76
+ export async function loadCustomHooks(
77
+ customPoliciesPath: string | undefined,
78
+ opts?: { strict?: boolean; sessionCwd?: string },
79
+ ): Promise<CustomHook[]> {
80
+ if (!customPoliciesPath) return [];
81
+
82
+ const absPath = isAbsolute(customPoliciesPath)
83
+ ? customPoliciesPath
84
+ : resolve(opts?.sessionCwd ?? process.cwd(), customPoliciesPath);
59
85
 
86
+ if (!existsSync(absPath)) {
87
+ if (opts?.strict) throw new Error(`Custom hooks file not found: ${absPath}`);
88
+ hookLogWarn(`customPoliciesPath not found: ${absPath}`);
89
+ return [];
90
+ }
91
+
92
+ clearCustomHooks();
93
+ await loadSingleFile(absPath, opts);
60
94
  return getCustomHooks();
61
95
  }
96
+
97
+ /** Source metadata for a loaded convention policy file. */
98
+ export interface ConventionSource {
99
+ scope: "project" | "user";
100
+ file: string;
101
+ hookNames: string[];
102
+ }
103
+
104
+ /** Result of loadAllCustomHooks with source metadata. */
105
+ export interface LoadAllResult {
106
+ hooks: CustomHook[];
107
+ conventionSources: ConventionSource[];
108
+ }
109
+
110
+ /**
111
+ * Load ALL custom hooks: explicit customPoliciesPath + convention-discovered files.
112
+ *
113
+ * Load order:
114
+ * 1. Explicit customPoliciesPath (if configured)
115
+ * 2. Project convention: {cwd}/.failproofai/policies/*policies.{js,mjs,ts} (alphabetical)
116
+ * 3. User convention: ~/.failproofai/policies/*policies.{js,mjs,ts} (alphabetical)
117
+ *
118
+ * Each file is loaded independently (fail-open per file).
119
+ * Convention hooks are tagged with __conventionSource so the handler can distinguish them.
120
+ */
121
+ export async function loadAllCustomHooks(
122
+ customPoliciesPath: string | undefined,
123
+ opts?: { sessionCwd?: string },
124
+ ): Promise<LoadAllResult> {
125
+ clearCustomHooks();
126
+
127
+ const conventionSources: ConventionSource[] = [];
128
+
129
+ // 1. Explicit customPoliciesPath (existing behavior)
130
+ if (customPoliciesPath) {
131
+ const absPath = isAbsolute(customPoliciesPath)
132
+ ? customPoliciesPath
133
+ : resolve(opts?.sessionCwd ?? process.cwd(), customPoliciesPath);
134
+ if (existsSync(absPath)) {
135
+ await loadSingleFile(absPath);
136
+ } else {
137
+ hookLogWarn(`customPoliciesPath not found: ${absPath}`);
138
+ }
139
+ }
140
+
141
+ const hooksBeforeConvention = getCustomHooks().length;
142
+
143
+ // 2. Project convention: {cwd}/.failproofai/policies/*policies.{js,mjs,ts}
144
+ const projectDir = resolve(opts?.sessionCwd ?? process.cwd(), ".failproofai", "policies");
145
+ const projectFiles = discoverPolicyFiles(projectDir);
146
+ for (const file of projectFiles) {
147
+ const hooksBefore = getCustomHooks().length;
148
+ await loadSingleFile(file);
149
+ const newHooks = getCustomHooks().slice(hooksBefore);
150
+ if (newHooks.length > 0) {
151
+ conventionSources.push({
152
+ scope: "project",
153
+ file: basename(file),
154
+ hookNames: newHooks.map((h) => h.name),
155
+ });
156
+ }
157
+ }
158
+
159
+ // 3. User convention: ~/.failproofai/policies/*policies.{js,mjs,ts}
160
+ const userDir = resolve(homedir(), ".failproofai", "policies");
161
+ const userFiles = discoverPolicyFiles(userDir);
162
+ for (const file of userFiles) {
163
+ const hooksBefore = getCustomHooks().length;
164
+ await loadSingleFile(file);
165
+ const newHooks = getCustomHooks().slice(hooksBefore);
166
+ if (newHooks.length > 0) {
167
+ conventionSources.push({
168
+ scope: "user",
169
+ file: basename(file),
170
+ hookNames: newHooks.map((h) => h.name),
171
+ });
172
+ }
173
+ }
174
+
175
+ const allHooks = getCustomHooks();
176
+ const conventionCount = allHooks.length - hooksBeforeConvention;
177
+
178
+ if (projectFiles.length > 0 || userFiles.length > 0) {
179
+ hookLogInfo(
180
+ `convention policies: ${projectFiles.length} project file(s), ${userFiles.length} user file(s), ${conventionCount} hook(s)`,
181
+ );
182
+ }
183
+
184
+ // Tag convention hooks so the handler can register them with a "convention/" prefix.
185
+ // Track by object reference (not name) to avoid mis-tagging an explicit custom hook
186
+ // that happens to share the same name as a convention hook.
187
+ const conventionHookRefs = new Set<CustomHook>();
188
+ for (const hook of allHooks.slice(hooksBeforeConvention)) {
189
+ conventionHookRefs.add(hook);
190
+ }
191
+ for (const hook of allHooks) {
192
+ if (conventionHookRefs.has(hook)) {
193
+ (hook as CustomHook & { __conventionSource?: boolean }).__conventionSource = true;
194
+ }
195
+ }
196
+
197
+ return { hooks: allHooks, conventionSources };
198
+ }
@@ -11,7 +11,8 @@ import { readMergedHooksConfig } from "./hooks-config";
11
11
  import { registerBuiltinPolicies } from "./builtin-policies";
12
12
  import { evaluatePolicies } from "./policy-evaluator";
13
13
  import { clearPolicies, registerPolicy } from "./policy-registry";
14
- import { loadCustomHooks } from "./custom-hooks-loader";
14
+ import { loadAllCustomHooks } from "./custom-hooks-loader";
15
+ import type { CustomHook } from "./policy-types";
15
16
  import { persistHookActivity } from "./hook-activity-store";
16
17
  import { trackHookEvent } from "./hook-telemetry";
17
18
  import { getInstanceId } from "../../lib/telemetry-id";
@@ -71,9 +72,14 @@ export async function handleHookEvent(eventType: string): Promise<number> {
71
72
  registerBuiltinPolicies(config.enabledPolicies);
72
73
 
73
74
  // Load and register custom hooks (layer 2, after builtins)
74
- const customHooksList = await loadCustomHooks(config.customPoliciesPath);
75
+ const loadResult = await loadAllCustomHooks(config.customPoliciesPath, { sessionCwd: session.cwd });
76
+ const customHooksList = loadResult.hooks;
77
+ const conventionHookNames = new Set(loadResult.conventionSources.flatMap((s) => s.hookNames));
78
+
75
79
  for (const hook of customHooksList) {
76
80
  const hookName = hook.name;
81
+ const isConvention = (hook as CustomHook & { __conventionSource?: boolean }).__conventionSource === true;
82
+ const prefix = isConvention ? "convention" : "custom";
77
83
  const fn: PolicyFunction = async (ctx): Promise<PolicyResult> => {
78
84
  try {
79
85
  const result = await Promise.race([
@@ -86,17 +92,18 @@ export async function handleHookEvent(eventType: string): Promise<number> {
86
92
  } catch (err) {
87
93
  const msg = err instanceof Error ? err.message : String(err);
88
94
  const isTimeout = msg === "timeout";
89
- hookLogWarn(`custom hook "${hookName}" failed: ${msg}`);
95
+ hookLogWarn(`${prefix} hook "${hookName}" failed: ${msg}`);
90
96
  void trackHookEvent(getInstanceId(), "custom_hook_error", {
91
97
  hook_name: hookName,
92
98
  error_type: isTimeout ? "timeout" : "exception",
93
99
  event_type: eventType,
100
+ is_convention_policy: isConvention,
94
101
  });
95
102
  return { decision: "allow" };
96
103
  }
97
104
  };
98
105
  registerPolicy(
99
- `custom/${hookName}`,
106
+ `${prefix}/${hookName}`,
100
107
  hook.description ?? "",
101
108
  fn,
102
109
  hook.match ?? {},
@@ -113,7 +120,18 @@ export async function handleHookEvent(eventType: string): Promise<number> {
113
120
  });
114
121
  }
115
122
 
116
- hookLogInfo(`event=${eventType} policies=${config.enabledPolicies.length} custom=${customHooksList.length}`);
123
+ // Fire telemetry for convention-based policy discovery
124
+ if (loadResult.conventionSources.length > 0) {
125
+ void trackHookEvent(getInstanceId(), "convention_policies_loaded", {
126
+ event_type: eventType,
127
+ project_file_count: loadResult.conventionSources.filter((s) => s.scope === "project").length,
128
+ user_file_count: loadResult.conventionSources.filter((s) => s.scope === "user").length,
129
+ convention_hook_count: conventionHookNames.size,
130
+ convention_hook_names: [...conventionHookNames],
131
+ });
132
+ }
133
+
134
+ hookLogInfo(`event=${eventType} policies=${config.enabledPolicies.length} custom=${customHooksList.length} convention=${conventionHookNames.size}`);
117
135
 
118
136
  // Evaluate policies
119
137
  const result = await evaluatePolicies(eventType as HookEventType, parsed, session, config);
@@ -152,8 +170,9 @@ export async function handleHookEvent(eventType: string): Promise<number> {
152
170
  if (result.decision === "deny" || result.decision === "instruct") {
153
171
  try {
154
172
  const isCustomHook = result.policyName?.startsWith("custom/") ?? false;
173
+ const isConventionPolicy = result.policyName?.startsWith("convention/") ?? false;
155
174
  const hasCustomParams =
156
- !isCustomHook && !!(result.policyName && config.policyParams?.[result.policyName]);
175
+ !isCustomHook && !isConventionPolicy && !!(result.policyName && config.policyParams?.[result.policyName]);
157
176
  const paramKeysOverridden = hasCustomParams
158
177
  ? Object.keys(config.policyParams![result.policyName!])
159
178
  : [];
@@ -164,6 +183,7 @@ export async function handleHookEvent(eventType: string): Promise<number> {
164
183
  policy_name: result.policyName,
165
184
  decision: result.decision,
166
185
  is_custom_hook: isCustomHook,
186
+ is_convention_policy: isConventionPolicy,
167
187
  has_custom_params: hasCustomParams,
168
188
  param_keys_overridden: paramKeysOverridden,
169
189
  });
@@ -5,6 +5,7 @@ import { readFileSync, writeFileSync, existsSync, mkdirSync } from "node:fs";
5
5
  import { resolve, dirname } from "node:path";
6
6
  import { homedir } from "node:os";
7
7
  import type { HooksConfig } from "./policy-types";
8
+ import type { HookScope } from "./types";
8
9
  import { hookLogInfo, hookLogWarn } from "./hook-logger";
9
10
 
10
11
  function readConfigAt(path: string): Partial<HooksConfig> {
@@ -100,14 +101,58 @@ export function writeHooksConfig(config: HooksConfig): void {
100
101
  writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n", "utf8");
101
102
  }
102
103
 
104
+ /**
105
+ * Resolve the policies-config path for a specific scope.
106
+ */
107
+ export function getConfigPathForScope(scope: HookScope, cwd?: string): string {
108
+ const base = cwd ? resolve(cwd) : process.cwd();
109
+ switch (scope) {
110
+ case "user":
111
+ return resolve(homedir(), ".failproofai", "policies-config.json");
112
+ case "project":
113
+ return resolve(base, ".failproofai", "policies-config.json");
114
+ case "local":
115
+ return resolve(base, ".failproofai", "policies-config.local.json");
116
+ }
117
+ }
118
+
119
+ /**
120
+ * Read hooks config from a single specific scope (not merged).
121
+ */
122
+ export function readScopedHooksConfig(scope: HookScope, cwd?: string): HooksConfig {
123
+ const configPath = getConfigPathForScope(scope, cwd);
124
+ if (!existsSync(configPath)) {
125
+ return { enabledPolicies: [] };
126
+ }
127
+ try {
128
+ const raw = readFileSync(configPath, "utf8");
129
+ return JSON.parse(raw) as HooksConfig;
130
+ } catch (err) {
131
+ hookLogWarn(`failed to parse config at ${configPath}: ${err instanceof Error ? err.message : String(err)}`);
132
+ return { enabledPolicies: [] };
133
+ }
134
+ }
135
+
136
+ /**
137
+ * Write hooks config to the scope-appropriate path.
138
+ */
139
+ export function writeScopedHooksConfig(config: HooksConfig, scope: HookScope, cwd?: string): void {
140
+ const configPath = getConfigPathForScope(scope, cwd);
141
+ const dir = dirname(configPath);
142
+ if (!existsSync(dir)) {
143
+ mkdirSync(dir, { recursive: true });
144
+ }
145
+ writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n", "utf8");
146
+ }
147
+
103
148
  export interface ResolvedLlmConfig {
104
149
  baseUrl: string;
105
150
  apiKey: string;
106
151
  model: string;
107
152
  }
108
153
 
109
- export function readLlmConfig(): ResolvedLlmConfig | null {
110
- const config = readHooksConfig();
154
+ export function readLlmConfig(cwd?: string): ResolvedLlmConfig | null {
155
+ const config = readMergedHooksConfig(cwd);
111
156
  const baseUrl =
112
157
  process.env.FAILPROOFAI_LLM_BASE_URL ?? config.llm?.baseUrl ?? "https://api.openai.com/v1";
113
158
  const apiKey = process.env.FAILPROOFAI_LLM_API_KEY ?? config.llm?.apiKey;
@@ -30,9 +30,9 @@ export interface ChatCompletionResponse {
30
30
 
31
31
  export async function chatCompletion(
32
32
  messages: ChatMessage[],
33
- options?: ChatCompletionOptions,
33
+ options?: ChatCompletionOptions & { cwd?: string },
34
34
  ): Promise<ChatCompletionResponse> {
35
- const config = readLlmConfig();
35
+ const config = readLlmConfig(options?.cwd);
36
36
  if (!config) {
37
37
  throw new Error(
38
38
  "No LLM API key configured. Set FAILPROOFAI_LLM_API_KEY or configure llm.apiKey in policies-config.json",
@@ -71,7 +71,8 @@ export async function resolveLocalImport(
71
71
 
72
72
  /**
73
73
  * Create an ESM shim that re-exports from the CJS dist module.
74
- * Includes all public API exports: createApp, customHooks, allow, deny, instruct.
74
+ * Exports the full public API of failproofai: customPolicies, allow, deny, instruct,
75
+ * getCustomHooks, clearCustomHooks.
75
76
  */
76
77
  export async function createEsmShim(
77
78
  distIndex: string,
@@ -80,10 +81,9 @@ export async function createEsmShim(
80
81
  const shimPath = distIndex + ".__failproofai_esm_shim__.mjs";
81
82
  const shimCode = [
82
83
  `import _cjs from '${distUrl}';`,
83
- `export const createApp = _cjs.createApp;`,
84
- `export const getQueueCondition = _cjs.getQueueCondition;`,
85
- `export const clearQueueCondition = _cjs.clearQueueCondition;`,
86
84
  `export const customPolicies = _cjs.customPolicies;`,
85
+ `export const getCustomHooks = _cjs.getCustomHooks;`,
86
+ `export const clearCustomHooks = _cjs.clearCustomHooks;`,
87
87
  `export const allow = _cjs.allow;`,
88
88
  `export const deny = _cjs.deny;`,
89
89
  `export const instruct = _cjs.instruct;`,
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import { execSync } from "node:child_process";
5
5
  import { readFileSync, writeFileSync, existsSync, mkdirSync } from "node:fs";
6
- import { resolve, dirname } from "node:path";
6
+ import { resolve, dirname, basename } from "node:path";
7
7
  import { homedir, platform, arch, release, hostname } from "node:os";
8
8
  import {
9
9
  HOOK_EVENT_TYPES,
@@ -15,10 +15,10 @@ import {
15
15
  type ClaudeSettings,
16
16
  } from "./types";
17
17
  import { promptPolicySelection } from "./install-prompt";
18
- import { readHooksConfig, writeHooksConfig, readMergedHooksConfig } from "./hooks-config";
18
+ import { readMergedHooksConfig, readScopedHooksConfig, writeScopedHooksConfig } from "./hooks-config";
19
19
  import type { HooksConfig } from "./policy-types";
20
20
  import { BUILTIN_POLICIES } from "./builtin-policies";
21
- import { loadCustomHooks } from "./custom-hooks-loader";
21
+ import { loadCustomHooks, discoverPolicyFiles } from "./custom-hooks-loader";
22
22
  import { trackHookEvent } from "./hook-telemetry";
23
23
  import { getInstanceId, hashToId } from "../../lib/telemetry-id";
24
24
  import { CliError } from "../cli-error";
@@ -203,7 +203,7 @@ export async function installHooks(
203
203
  const binaryPath = resolveFailproofaiBinary();
204
204
 
205
205
  // Capture existing config before overwriting (used for telemetry diff)
206
- const previousConfig = readHooksConfig();
206
+ const previousConfig = readScopedHooksConfig(scope, cwd);
207
207
  const previousEnabled = new Set(previousConfig.enabledPolicies);
208
208
 
209
209
  let selectedPolicies: string[];
@@ -251,7 +251,7 @@ export async function installHooks(
251
251
  `\nValidated ${validatedHooks.length} custom hook(s): ${validatedHooks.map((h) => h.name).join(", ")}`,
252
252
  );
253
253
  }
254
- writeHooksConfig(configToWrite);
254
+ writeScopedHooksConfig(configToWrite, scope, cwd);
255
255
  console.log(`\nEnabled ${selectedPolicies.length} policy(ies): ${selectedPolicies.join(", ")}`);
256
256
  if (removeCustomHooks) {
257
257
  console.log("Custom hooks path cleared.");
@@ -355,18 +355,21 @@ export async function installHooks(
355
355
  * @param opts.betaOnly — set to true when removing only beta policies (adds beta_only flag to telemetry)
356
356
  */
357
357
  export async function removeHooks(policyNames?: string[], scope: HookScope | "all" = "user", cwd?: string, opts?: { betaOnly?: boolean; source?: string; removeCustomHooks?: boolean }): Promise<void> {
358
+ // Resolve the effective config scope ("all" falls back to "user" for config reads/writes)
359
+ const configScope: HookScope = scope === "all" ? "user" : scope;
360
+
358
361
  // Clear custom hooks path if requested
359
362
  if (opts?.removeCustomHooks) {
360
- const config = readHooksConfig();
363
+ const config = readScopedHooksConfig(configScope, cwd);
361
364
  delete config.customPoliciesPath;
362
- writeHooksConfig(config);
365
+ writeScopedHooksConfig(config, configScope, cwd);
363
366
  console.log("Custom hooks path cleared.");
364
367
  }
365
368
 
366
369
  // Remove specific policies from config (keep hooks installed)
367
370
  if (policyNames && policyNames.length > 0 && !(policyNames.length === 1 && policyNames[0] === "all")) {
368
371
  validatePolicyNames(policyNames);
369
- const config = readHooksConfig();
372
+ const config = readScopedHooksConfig(configScope, cwd);
370
373
  const removeSet = new Set(policyNames);
371
374
  const remaining = config.enabledPolicies.filter((p) => !removeSet.has(p));
372
375
  const notEnabled = policyNames.filter((p) => !config.enabledPolicies.includes(p));
@@ -382,7 +385,7 @@ export async function removeHooks(policyNames?: string[], scope: HookScope | "al
382
385
  enabledPolicies: remaining,
383
386
  ...(filteredParams && Object.keys(filteredParams).length > 0 ? { policyParams: filteredParams } : {}),
384
387
  };
385
- writeHooksConfig(updatedConfig);
388
+ writeScopedHooksConfig(updatedConfig, configScope, cwd);
386
389
 
387
390
  // Telemetry: track policy-only removal from config
388
391
  try {
@@ -410,7 +413,7 @@ export async function removeHooks(policyNames?: string[], scope: HookScope | "al
410
413
  }
411
414
 
412
415
  // Capture enabled policies before clearing (used for accurate telemetry below)
413
- const configBeforeRemoval = readHooksConfig();
416
+ const configBeforeRemoval = readScopedHooksConfig(configScope, cwd);
414
417
 
415
418
  // Remove all failproofai hooks from Claude Code settings
416
419
  const scopesToRemove: HookScope[] = scope === "all" ? [...HOOK_SCOPES] : [scope];
@@ -472,10 +475,19 @@ export async function removeHooks(policyNames?: string[], scope: HookScope | "al
472
475
  }
473
476
 
474
477
  // Clear policy config when removing from all scopes, or when no hooks remain in any scope
475
- if (scope === "all" || !HOOK_SCOPES.some((s) => hooksInstalledInSettings(s, cwd))) {
476
- const existingForClear = readHooksConfig();
477
- const { customPoliciesPath: _drop, policyParams: _dropParams, ...restClear } = existingForClear;
478
- writeHooksConfig({ ...restClear, enabledPolicies: [] });
478
+ if (scope === "all") {
479
+ // Clear config across all three scopes
480
+ for (const s of HOOK_SCOPES) {
481
+ const existing = readScopedHooksConfig(s, cwd);
482
+ if (existing.enabledPolicies.length > 0 || existing.customPoliciesPath || existing.policyParams) {
483
+ const { customPoliciesPath: _drop, policyParams: _dropParams, ...rest } = existing;
484
+ writeScopedHooksConfig({ ...rest, enabledPolicies: [] }, s, cwd);
485
+ }
486
+ }
487
+ } else if (!HOOK_SCOPES.some((s) => hooksInstalledInSettings(s, cwd))) {
488
+ const existing = readScopedHooksConfig(configScope, cwd);
489
+ const { customPoliciesPath: _drop, policyParams: _dropParams, ...rest } = existing;
490
+ writeScopedHooksConfig({ ...rest, enabledPolicies: [] }, configScope, cwd);
479
491
  }
480
492
  }
481
493
 
@@ -638,4 +650,35 @@ export async function listHooks(cwd?: string): Promise<void> {
638
650
  }
639
651
  console.log();
640
652
  }
653
+
654
+ // Convention Policies section (.failproofai/policies/*policies.{js,mjs,ts})
655
+ const base = cwd ? resolve(cwd) : process.cwd();
656
+ const conventionDirs: { label: string; dir: string }[] = [
657
+ { label: "Project", dir: resolve(base, ".failproofai", "policies") },
658
+ { label: "User", dir: resolve(homedir(), ".failproofai", "policies") },
659
+ ];
660
+
661
+ for (const { label, dir } of conventionDirs) {
662
+ const files = discoverPolicyFiles(dir);
663
+ if (files.length === 0) continue;
664
+
665
+ console.log(`\n \u2500\u2500 Convention Policies \u2014 ${label} (${dir}) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`);
666
+ for (const file of files) {
667
+ try {
668
+ const hooks = await loadCustomHooks(file);
669
+ if (hooks.length === 0) {
670
+ const filename = basename(file);
671
+ console.log(` \x1B[31m\u2717\x1B[0m ${filename.padEnd(nameColWidth)}\x1B[31mfailed to load\x1B[0m`);
672
+ } else {
673
+ const filename = basename(file);
674
+ const hookSummary = hooks.map((h) => h.name).join(", ");
675
+ console.log(` \x1B[32m\u2713\x1B[0m ${filename.padEnd(nameColWidth)}${hooks.length} hook(s): ${hookSummary}`);
676
+ }
677
+ } catch {
678
+ const filename = basename(file);
679
+ console.log(` \x1B[31m\u2717\x1B[0m ${filename.padEnd(nameColWidth)}\x1B[31merror\x1B[0m`);
680
+ }
681
+ }
682
+ console.log();
683
+ }
641
684
  }
@@ -8,6 +8,14 @@ import { BUILTIN_POLICIES } from "./builtin-policies";
8
8
  import { getPoliciesForEvent } from "./policy-registry";
9
9
  import { hookLogInfo, hookLogWarn } from "./hook-logger";
10
10
 
11
+ function appendHint(baseReason: string, hint: unknown): string {
12
+ const base = baseReason.trim();
13
+ const normalizedHint = typeof hint === "string" ? hint.trim() : "";
14
+ if (!normalizedHint) return base;
15
+ if (!base) return normalizedHint;
16
+ return `${base}. ${normalizedHint}`;
17
+ }
18
+
11
19
  export interface EvaluationResult {
12
20
  exitCode: number;
13
21
  stdout: string;
@@ -80,7 +88,10 @@ export async function evaluatePolicies(
80
88
  }
81
89
 
82
90
  if (result.decision === "deny") {
83
- const reason = result.reason ?? `Blocked by policy: ${policy.name}`;
91
+ const reason = appendHint(
92
+ result.reason ?? `Blocked by policy: ${policy.name}`,
93
+ config?.policyParams?.[policy.name]?.hint,
94
+ );
84
95
  hookLogInfo(`deny by "${policy.name}": ${reason}`);
85
96
 
86
97
  const displayTool = ctx.toolName ?? "unknown tool";
@@ -134,7 +145,10 @@ export async function evaluatePolicies(
134
145
  // Accumulate first instruct (does not short-circuit — later policies can still deny)
135
146
  if (result.decision === "instruct" && !instructPolicyName) {
136
147
  instructPolicyName = policy.name;
137
- instructReason = result.reason ?? `Instruction from policy: ${policy.name}`;
148
+ instructReason = appendHint(
149
+ result.reason ?? `Instruction from policy: ${policy.name}`,
150
+ config?.policyParams?.[policy.name]?.hint,
151
+ );
138
152
  hookLogInfo(`instruct by "${policy.name}": ${instructReason}`);
139
153
  }
140
154
 
package/README.md CHANGED
@@ -13,7 +13,7 @@
13
13
  [![npm](https://img.shields.io/npm/v/failproofai?style=flat-square&color=CB3837)](https://www.npmjs.com/package/failproofai)
14
14
  [![License](https://img.shields.io/badge/license-MIT%20%2B%20Commons%20Clause-blue?style=flat-square)](LICENSE)
15
15
  [![CI](https://img.shields.io/github/actions/workflow/status/exospherehost/failproofai/ci.yml?branch=main&style=flat-square&label=CI)](https://github.com/exospherehost/failproofai/actions)
16
- [![Discord](https://img.shields.io/discord/1234567890?style=flat-square&label=Discord&color=5865F2)](https://discord.com/invite/zT92CAgvkj)
16
+ [![Slack](https://img.shields.io/badge/Slack-join%20us-4A154B?style=flat-square&logo=slack)](https://join.slack.com/t/failproofai/shared_invite/zt-3v63b7k5e-O3NBHmj8X6n9gZSGDx6ggQ)
17
17
 
18
18
  The easiest way to manage policies that keep your AI agents reliable, on-task, and running autonomously - for **Claude Code** & the **Agents SDK**.
19
19
 
@@ -111,10 +111,12 @@ Policy configuration lives in `~/.failproofai/policies-config.json` (global) or
111
111
  ],
112
112
  "policyParams": {
113
113
  "block-sudo": {
114
- "allowPatterns": ["sudo systemctl status", "sudo journalctl"]
114
+ "allowPatterns": ["sudo systemctl status", "sudo journalctl"],
115
+ "hint": "Use apt-get directly without sudo."
115
116
  },
116
117
  "block-push-master": {
117
- "protectedBranches": ["main", "release", "prod"]
118
+ "protectedBranches": ["main", "release", "prod"],
119
+ "hint": "Try creating a fresh branch instead."
118
120
  },
119
121
  "sanitize-api-keys": {
120
122
  "additionalPatterns": [
@@ -216,6 +218,21 @@ failproofai policies --install --custom ./my-policies.js
216
218
 
217
219
  Custom hooks support transitive local imports, async/await, and access to `process.env`. Errors are fail-open (logged to `~/.failproofai/hook.log`, built-in policies continue). See [docs/custom-hooks.mdx](docs/custom-hooks.mdx) for the full guide.
218
220
 
221
+ ### Convention-based policies (v0.0.2-beta.7+)
222
+
223
+ Drop `*policies.{js,mjs,ts}` files into `.failproofai/policies/` and they're automatically loaded — no `--custom` flag or config changes needed. Works like git hooks: drop a file, it just works.
224
+
225
+ ```text
226
+ # Project level — committed to git, shared with the team
227
+ .failproofai/policies/security-policies.mjs
228
+ .failproofai/policies/workflow-policies.mjs
229
+
230
+ # User level — personal, applies to all projects
231
+ ~/.failproofai/policies/my-policies.mjs
232
+ ```
233
+
234
+ Both levels load (union). Files are loaded alphabetically within each directory. Prefix with `01-`, `02-`, etc. to control order. See [examples/convention-policies/](examples/convention-policies/) for ready-to-use examples.
235
+
219
236
  ---
220
237
 
221
238
  ## Telemetry
@@ -97,6 +97,11 @@ COMMANDS
97
97
  --version, -v Print version and exit
98
98
  --help, -h Show this help message
99
99
 
100
+ CONVENTION POLICIES
101
+ Drop *policies.{js,mjs,ts} files into .failproofai/policies/ for auto-loading.
102
+ Works at project level (.failproofai/policies/) and user level (~/.failproofai/policies/).
103
+ No --custom flag or config changes needed — just drop files and they're picked up.
104
+
100
105
  EXAMPLES
101
106
  failproofai policies
102
107
  failproofai policies --install