freddie 0.0.41

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 (307) hide show
  1. package/AGENTS.md +180 -0
  2. package/CHANGELOG.md +32 -0
  3. package/README.md +130 -0
  4. package/bin/freddie.js +116 -0
  5. package/package.json +59 -0
  6. package/skills/creative/README.md +3 -0
  7. package/skills/creative/architecture-diagram/SKILL.md +52 -0
  8. package/skills/creative/ascii-video/SKILL.md +60 -0
  9. package/skills/creative/concept-diagrams/SKILL.md +65 -0
  10. package/skills/data/README.md +3 -0
  11. package/skills/data/etl-pipelines/SKILL.md +60 -0
  12. package/skills/data/sql-explainer/SKILL.md +60 -0
  13. package/skills/ops/README.md +3 -0
  14. package/skills/ops/incident-response/SKILL.md +74 -0
  15. package/skills/ops/log-triage/SKILL.md +79 -0
  16. package/skills/planning/README.md +3 -0
  17. package/skills/planning/okr-drafter/SKILL.md +60 -0
  18. package/skills/planning/weekly-review/SKILL.md +64 -0
  19. package/skills/software-development/README.md +3 -0
  20. package/skills/software-development/code-review/SKILL.md +70 -0
  21. package/skills/software-development/rfc-writer/SKILL.md +68 -0
  22. package/skills/software-development/systematic-debugging/SKILL.md +80 -0
  23. package/src/acp/auth.js +21 -0
  24. package/src/acp/entry.js +2 -0
  25. package/src/acp/events.js +10 -0
  26. package/src/acp/main.js +8 -0
  27. package/src/acp/permissions.js +29 -0
  28. package/src/acp/server.js +84 -0
  29. package/src/acp/session.js +26 -0
  30. package/src/acp/tools.js +17 -0
  31. package/src/agent/account_usage.js +19 -0
  32. package/src/agent/acptoapi-bridge.js +80 -0
  33. package/src/agent/anthropic_adapter.js +10 -0
  34. package/src/agent/auxiliary_client.js +20 -0
  35. package/src/agent/bedrock_adapter.js +11 -0
  36. package/src/agent/codex_responses_adapter.js +10 -0
  37. package/src/agent/compress/compressor.js +55 -0
  38. package/src/agent/compress/fallback.js +14 -0
  39. package/src/agent/compress/index.js +6 -0
  40. package/src/agent/compress/policy.js +47 -0
  41. package/src/agent/compress/prompt.js +46 -0
  42. package/src/agent/compress/prune.js +16 -0
  43. package/src/agent/compress/tokens.js +31 -0
  44. package/src/agent/context_references.js +40 -0
  45. package/src/agent/copilot_acp_client.js +6 -0
  46. package/src/agent/credential_pool.js +30 -0
  47. package/src/agent/credential_sources.js +18 -0
  48. package/src/agent/curator.js +5 -0
  49. package/src/agent/display.js +23 -0
  50. package/src/agent/error_classifier.js +15 -0
  51. package/src/agent/file_safety.js +9 -0
  52. package/src/agent/gemini_cloudcode_adapter.js +9 -0
  53. package/src/agent/gemini_native_adapter.js +11 -0
  54. package/src/agent/gemini_schema.js +19 -0
  55. package/src/agent/google_code_assist.js +8 -0
  56. package/src/agent/google_oauth.js +21 -0
  57. package/src/agent/image_gen_provider.js +8 -0
  58. package/src/agent/image_gen_registry.js +6 -0
  59. package/src/agent/image_routing.js +13 -0
  60. package/src/agent/insights.js +9 -0
  61. package/src/agent/llm_resolver.js +21 -0
  62. package/src/agent/lmstudio_reasoning.js +13 -0
  63. package/src/agent/machine.js +102 -0
  64. package/src/agent/manual_compression_feedback.js +5 -0
  65. package/src/agent/memory_manager.js +14 -0
  66. package/src/agent/memory_provider.js +1 -0
  67. package/src/agent/model_metadata.js +28 -0
  68. package/src/agent/models_dev.js +13 -0
  69. package/src/agent/moonshot_schema.js +11 -0
  70. package/src/agent/oauth_endpoints.js +79 -0
  71. package/src/agent/onboarding.js +16 -0
  72. package/src/agent/pi-bridge.js +37 -0
  73. package/src/agent/prompt_builder.js +12 -0
  74. package/src/agent/prompt_caching.js +24 -0
  75. package/src/agent/rate_limit_tracker.js +12 -0
  76. package/src/agent/redact.js +25 -0
  77. package/src/agent/retry_utils.js +17 -0
  78. package/src/agent/shell_hooks.js +16 -0
  79. package/src/agent/skill_commands.js +16 -0
  80. package/src/agent/skill_preprocessing.js +12 -0
  81. package/src/agent/skill_utils.js +14 -0
  82. package/src/agent/subdirectory_hints.js +17 -0
  83. package/src/agent/title_generator.js +13 -0
  84. package/src/agent/trajectory.js +9 -0
  85. package/src/agent/usage_pricing.js +16 -0
  86. package/src/auth.js +84 -0
  87. package/src/batch.js +32 -0
  88. package/src/cli/auth_commands.js +17 -0
  89. package/src/cli/azure_detect.js +9 -0
  90. package/src/cli/backup.js +17 -0
  91. package/src/cli/banner.js +13 -0
  92. package/src/cli/browser_connect.js +11 -0
  93. package/src/cli/callbacks.js +5 -0
  94. package/src/cli/claw.js +8 -0
  95. package/src/cli/cli_output.js +19 -0
  96. package/src/cli/clipboard.js +24 -0
  97. package/src/cli/codex_models.js +8 -0
  98. package/src/cli/colors.js +13 -0
  99. package/src/cli/completer.js +98 -0
  100. package/src/cli/completion.js +21 -0
  101. package/src/cli/copilot_auth.js +9 -0
  102. package/src/cli/curator_cli.js +5 -0
  103. package/src/cli/curses.js +15 -0
  104. package/src/cli/debug.js +6 -0
  105. package/src/cli/default_soul.js +20 -0
  106. package/src/cli/dingtalk_auth.js +12 -0
  107. package/src/cli/doctor.js +15 -0
  108. package/src/cli/dump.js +11 -0
  109. package/src/cli/env_loader.js +25 -0
  110. package/src/cli/fallback_cmd.js +9 -0
  111. package/src/cli/gateway_cli.js +17 -0
  112. package/src/cli/hooks.js +9 -0
  113. package/src/cli/interactive.js +61 -0
  114. package/src/cli/logs.js +32 -0
  115. package/src/cli/main.js +7 -0
  116. package/src/cli/mcp_config.js +9 -0
  117. package/src/cli/memory_setup.js +12 -0
  118. package/src/cli/model_catalog.js +23 -0
  119. package/src/cli/model_normalize.js +12 -0
  120. package/src/cli/model_switch.js +11 -0
  121. package/src/cli/models.js +13 -0
  122. package/src/cli/nous_subscription.js +12 -0
  123. package/src/cli/oneshot.js +6 -0
  124. package/src/cli/pairing.js +21 -0
  125. package/src/cli/platforms.js +14 -0
  126. package/src/cli/plugins.js +4 -0
  127. package/src/cli/plugins_cmd.js +21 -0
  128. package/src/cli/profiles_cli.js +6 -0
  129. package/src/cli/providers.js +18 -0
  130. package/src/cli/pty_bridge.js +16 -0
  131. package/src/cli/relaunch.js +7 -0
  132. package/src/cli/runtime_provider.js +9 -0
  133. package/src/cli/setup.js +131 -0
  134. package/src/cli/skills_config.js +6 -0
  135. package/src/cli/skills_hub.js +8 -0
  136. package/src/cli/slack_cli.js +17 -0
  137. package/src/cli/status.js +10 -0
  138. package/src/cli/timeouts.js +5 -0
  139. package/src/cli/tips.js +14 -0
  140. package/src/cli/tools_config.js +15 -0
  141. package/src/cli/uninstall.js +8 -0
  142. package/src/cli/vercel_auth.js +13 -0
  143. package/src/cli/voice.js +6 -0
  144. package/src/cli/web_server.js +13 -0
  145. package/src/cli/webhook.js +12 -0
  146. package/src/commands/profile.js +72 -0
  147. package/src/commands/registry.js +94 -0
  148. package/src/config.js +125 -0
  149. package/src/context/engine.js +42 -0
  150. package/src/cron/cron-parse.js +27 -0
  151. package/src/cron/scheduler.js +63 -0
  152. package/src/db.js +178 -0
  153. package/src/gateway/base.js +13 -0
  154. package/src/gateway/builtin_hooks/boot.js +5 -0
  155. package/src/gateway/builtin_hooks/broadcast.js +3 -0
  156. package/src/gateway/builtin_hooks/deny.js +6 -0
  157. package/src/gateway/builtin_hooks/index.js +17 -0
  158. package/src/gateway/builtin_hooks/presence.js +4 -0
  159. package/src/gateway/builtin_hooks/routing.js +7 -0
  160. package/src/gateway/helpers.js +27 -0
  161. package/src/gateway/platforms/api_server.js +21 -0
  162. package/src/gateway/platforms/bluebubbles.js +32 -0
  163. package/src/gateway/platforms/dingtalk.js +32 -0
  164. package/src/gateway/platforms/discord.js +24 -0
  165. package/src/gateway/platforms/email.js +51 -0
  166. package/src/gateway/platforms/feishu.js +32 -0
  167. package/src/gateway/platforms/feishu_comment.js +12 -0
  168. package/src/gateway/platforms/feishu_comment_rules.js +11 -0
  169. package/src/gateway/platforms/homeassistant.js +32 -0
  170. package/src/gateway/platforms/matrix.js +40 -0
  171. package/src/gateway/platforms/mattermost.js +29 -0
  172. package/src/gateway/platforms/qqbot.js +32 -0
  173. package/src/gateway/platforms/signal.js +33 -0
  174. package/src/gateway/platforms/slack.js +34 -0
  175. package/src/gateway/platforms/sms.js +34 -0
  176. package/src/gateway/platforms/telegram.js +38 -0
  177. package/src/gateway/platforms/telegram_network.js +17 -0
  178. package/src/gateway/platforms/webhook.js +19 -0
  179. package/src/gateway/platforms/wecom.js +32 -0
  180. package/src/gateway/platforms/wecom_callback.js +15 -0
  181. package/src/gateway/platforms/wecom_crypto.js +16 -0
  182. package/src/gateway/platforms/weixin.js +32 -0
  183. package/src/gateway/platforms/whatsapp.js +40 -0
  184. package/src/gateway/platforms/yuanbao.js +9 -0
  185. package/src/gateway/platforms/yuanbao_media.js +5 -0
  186. package/src/gateway/platforms/yuanbao_proto.js +9 -0
  187. package/src/gateway/platforms/yuanbao_sticker.js +6 -0
  188. package/src/gateway/run.js +42 -0
  189. package/src/gateway/service.js +143 -0
  190. package/src/home.js +44 -0
  191. package/src/index.js +47 -0
  192. package/src/mcp/server.js +49 -0
  193. package/src/observability/debug.js +31 -0
  194. package/src/observability/log.js +38 -0
  195. package/src/plugins/achievements/index.js +9 -0
  196. package/src/plugins/cockpit/index.js +8 -0
  197. package/src/plugins/context_engine/index.js +13 -0
  198. package/src/plugins/disk_cleanup/index.js +22 -0
  199. package/src/plugins/google_meet/index.js +19 -0
  200. package/src/plugins/image_gen/index.js +5 -0
  201. package/src/plugins/manager.js +66 -0
  202. package/src/plugins/memory/_index.js +8 -0
  203. package/src/plugins/memory/byterover.js +25 -0
  204. package/src/plugins/memory/hindsight.js +25 -0
  205. package/src/plugins/memory/holographic.js +31 -0
  206. package/src/plugins/memory/honcho.js +25 -0
  207. package/src/plugins/memory/mem0.js +25 -0
  208. package/src/plugins/memory/openviking.js +25 -0
  209. package/src/plugins/memory/provider.js +35 -0
  210. package/src/plugins/memory/retaindb.js +25 -0
  211. package/src/plugins/memory/supermemory.js +25 -0
  212. package/src/plugins/observability/index.js +18 -0
  213. package/src/plugins/platforms/index.js +20 -0
  214. package/src/plugins/spotify/index.js +22 -0
  215. package/src/rl/atropos.js +22 -0
  216. package/src/rl/cli.js +18 -0
  217. package/src/sessions.js +84 -0
  218. package/src/skills/index.js +49 -0
  219. package/src/skin/engine.js +81 -0
  220. package/src/swe/runner.js +26 -0
  221. package/src/time.js +25 -0
  222. package/src/tools/ansi_strip.js +8 -0
  223. package/src/tools/approval.js +15 -0
  224. package/src/tools/bash.js +35 -0
  225. package/src/tools/binary_extensions.js +22 -0
  226. package/src/tools/browser.js +48 -0
  227. package/src/tools/budget_config.js +13 -0
  228. package/src/tools/checkpoint.js +29 -0
  229. package/src/tools/clarify.js +15 -0
  230. package/src/tools/code_execution.js +27 -0
  231. package/src/tools/credential_files.js +16 -0
  232. package/src/tools/cronjob.js +16 -0
  233. package/src/tools/debug_helpers.js +9 -0
  234. package/src/tools/delegate.js +28 -0
  235. package/src/tools/discord_tool.js +13 -0
  236. package/src/tools/edit.js +31 -0
  237. package/src/tools/env_passthrough.js +15 -0
  238. package/src/tools/environments/base.js +26 -0
  239. package/src/tools/environments/daytona.js +48 -0
  240. package/src/tools/environments/docker.js +14 -0
  241. package/src/tools/environments/file_sync.js +60 -0
  242. package/src/tools/environments/index.js +36 -0
  243. package/src/tools/environments/local.js +31 -0
  244. package/src/tools/environments/modal.js +33 -0
  245. package/src/tools/environments/singularity.js +38 -0
  246. package/src/tools/environments/ssh.js +14 -0
  247. package/src/tools/environments/vercel_sandbox.js +47 -0
  248. package/src/tools/feishu_doc.js +15 -0
  249. package/src/tools/feishu_drive.js +14 -0
  250. package/src/tools/file_operations.js +17 -0
  251. package/src/tools/file_state.js +16 -0
  252. package/src/tools/file_tools.js +23 -0
  253. package/src/tools/fuzzy_match.js +8 -0
  254. package/src/tools/grep.js +51 -0
  255. package/src/tools/homeassistant_tool.js +15 -0
  256. package/src/tools/image_gen.js +33 -0
  257. package/src/tools/interrupt.js +18 -0
  258. package/src/tools/managed_tool_gateway.js +11 -0
  259. package/src/tools/mcp_oauth.js +21 -0
  260. package/src/tools/mcp_oauth_manager.js +20 -0
  261. package/src/tools/mcp_tool.js +36 -0
  262. package/src/tools/memory.js +66 -0
  263. package/src/tools/mixture_of_agents.js +14 -0
  264. package/src/tools/neutts_synth.js +13 -0
  265. package/src/tools/openrouter_client.js +13 -0
  266. package/src/tools/osv_check.js +11 -0
  267. package/src/tools/patch_parser.js +42 -0
  268. package/src/tools/path_security.js +16 -0
  269. package/src/tools/process_registry.js +17 -0
  270. package/src/tools/read.js +26 -0
  271. package/src/tools/registry.js +54 -0
  272. package/src/tools/rl_training.js +13 -0
  273. package/src/tools/schema_sanitizer.js +18 -0
  274. package/src/tools/send_message.js +32 -0
  275. package/src/tools/session_search.js +23 -0
  276. package/src/tools/skill_manager.js +17 -0
  277. package/src/tools/skill_usage.js +20 -0
  278. package/src/tools/skills_guard.js +17 -0
  279. package/src/tools/skills_hub.js +31 -0
  280. package/src/tools/skills_index.js +14 -0
  281. package/src/tools/skills_sync.js +19 -0
  282. package/src/tools/skills_tool.js +11 -0
  283. package/src/tools/slash_confirm.js +16 -0
  284. package/src/tools/terminal.js +29 -0
  285. package/src/tools/tirith_security.js +25 -0
  286. package/src/tools/todo.js +54 -0
  287. package/src/tools/tool_backend_helpers.js +26 -0
  288. package/src/tools/tool_output_limits.js +15 -0
  289. package/src/tools/tool_result_storage.js +20 -0
  290. package/src/tools/transcription.js +19 -0
  291. package/src/tools/tts.js +19 -0
  292. package/src/tools/url_safety.js +15 -0
  293. package/src/tools/vision.js +18 -0
  294. package/src/tools/voice_mode.js +10 -0
  295. package/src/tools/web_search.js +37 -0
  296. package/src/tools/web_tools.js +18 -0
  297. package/src/tools/website_policy.js +14 -0
  298. package/src/tools/write.js +25 -0
  299. package/src/tools/xai_http.js +13 -0
  300. package/src/tools/yuanbao_tools.js +13 -0
  301. package/src/toolset_distributions.js +18 -0
  302. package/src/toolsets.js +26 -0
  303. package/src/tui/index.js +26 -0
  304. package/src/utils.js +54 -0
  305. package/src/web/app.js +547 -0
  306. package/src/web/index.html +167 -0
  307. package/src/web/server.js +109 -0
package/AGENTS.md ADDED
@@ -0,0 +1,180 @@
1
+ # Freddie — Agent Guide
2
+
3
+ Instructions for AI coding assistants working on Freddie.
4
+
5
+ ## Substrate (do not reimplement)
6
+
7
+ - `@mariozechner/pi-coding-agent` — agent + tools + interactive TUI. Use `AgentSession`, `BashExecutionComponent`, `ModelRegistry`, `InteractiveMode`, `FileAuthStorageBackend`, `ExtensionRunner`.
8
+ - `@mariozechner/pi-agent-core` — `Agent`, `agentLoop`, `runAgentLoop`, `streamProxy`. Wrap in xstate, do not rewrite.
9
+ - `@mariozechner/pi-ai` — `complete`, `completeSimple`, `AssistantMessageEventStream`, `registerApiProvider`, `getModel`, `calculateCost`, `parseStreamingJson`, `isContextOverflow`. THE provider layer.
10
+ - `@mariozechner/pi-tui` — TUI primitives (Ink-equivalent).
11
+ - `floosie` v0.6.14 — `ProcessorMachine` (xstate). Use for gateway pipelines.
12
+ - `anentrypoint-design` v0.0.27 — webjsx + ripple-ui. Use for any web UI; do NOT add React. Source in C:/dev/anentrypoint-design; freddie links via `file:../anentrypoint-design`.
13
+ - `xstate` v5 — every long-lived state machine (agent turns, gateway lifecycle, approvals).
14
+
15
+ ## Layout
16
+
17
+ ```
18
+ src/home.js # getFophHome, applyProfileOverride
19
+ src/config.js # loadConfig, saveConfigValue, DEFAULT_CONFIG, _config_version migrations
20
+ src/sessions.js # better-sqlite3 + FTS5
21
+ src/auth.js # FileAuthStore for credentials
22
+ src/tools/registry.js # tool registration + dispatch
23
+ src/tools/{bash,read,write,edit,grep,todo,memory,delegate,web_search,image_gen,browser}.js
24
+ src/tools/environments/{local,docker,ssh,index}.js # execution environments
25
+ src/toolsets.js # _FREDDIE_CORE_TOOLS, getEnabledToolSchemas
26
+ src/agent/machine.js # xstate turn machine
27
+ src/agent/pi-bridge.js # @mariozechner/pi-ai callLLM adapter
28
+ src/agent/compress/{tokens,policy,prompt,prune,fallback,compressor,index}.js # context compressor
29
+ src/commands/registry.js # CommandDef + resolveCommand + gateway/telegram/slack views
30
+ src/commands/profile.js # profile CRUD
31
+ src/cli/interactive.js # readline REPL, skin-aware
32
+ src/context/engine.js # context block builders (file, skills, memory)
33
+ src/cron/{scheduler,cron-parse}.js # persistent cron jobs
34
+ src/batch.js # parallel batch runner
35
+ src/web/{server,index.html} # dashboard (express + anentrypoint-design webjsx)
36
+ src/gateway/run.js # Gateway + hooks
37
+ src/gateway/platforms/*.js # webhook + api_server + 16 functional adapters
38
+ src/acp/server.js # JSON-RPC stdio
39
+ src/plugins/manager.js # PluginManager
40
+ src/plugins/memory/{provider,_index,honcho,mem0,supermemory,byterover,hindsight,holographic,openviking,retaindb}.js
41
+ src/skills/index.js # SKILL.md loader
42
+ src/skin/engine.js # _BUILTIN_SKINS + load/get/set
43
+ src/observability/log.js # structured logs
44
+ src/observability/debug.js # /debug registry
45
+ skills/ # bundled skill bundles (creative/, software-development/, ops/, data/, planning/)
46
+ website/ # flatspace docs site: flatspace.config.mjs + theme.mjs + content/pages/*.yaml + docs/ (build output)
47
+ bin/freddie.js # commander CLI: tools, skills, profile, skin, sessions, search, gateway, acp, run, cron, batch, dashboard, help-all
48
+ ```
49
+
50
+ ## Adding a tool
51
+
52
+ ```js
53
+ import { registry } from './tools/registry.js'
54
+
55
+ registry.register({
56
+ name: 'my_tool',
57
+ toolset: 'core',
58
+ schema: { name: 'my_tool', description: '…', parameters: { type: 'object', properties: { x: { type: 'string' } }, required: ['x'] } },
59
+ handler: async (args, ctx) => ({ ok: true, x: args.x }),
60
+ checkFn: () => !!process.env.MY_KEY,
61
+ requiresEnv: ['MY_KEY'],
62
+ })
63
+ ```
64
+
65
+ Drop the file in `src/tools/`. Auto-discovered by `discoverBuiltinTools()`.
66
+
67
+ ## Adding a slash command
68
+
69
+ Add a `CommandDef` to `COMMAND_REGISTRY` in `src/commands/registry.js`:
70
+
71
+ ```js
72
+ { name: 'mycmd', description: '…', category: 'Session', aliases: ['mc'], args_hint: '[arg]' }
73
+ ```
74
+
75
+ Dispatch happens against the canonical name resolved via `resolveCommand()`. Gateway/telegram/slack views derive automatically.
76
+
77
+ ## Adding a gateway platform
78
+
79
+ 1. Drop `src/gateway/platforms/<name>.js`
80
+ 2. Extend `EventEmitter`, implement `start/stop/send`, emit `'message'`
81
+ 3. `Gateway.register('name', adapter)` wires inbound to the agent
82
+
83
+ ## Profile-safe code
84
+
85
+ - Always `getFophHome()` for state paths. Never `path.join(os.homedir(), '.freddie')`.
86
+ - Always `displayFophHome()` for user-visible messages (returns `~/.freddie` or `~/.freddie/profiles/<name>`).
87
+ - Profile operations are HOME-anchored: `getProfilesRoot()` returns `~/.freddie/profiles` regardless of active profile.
88
+
89
+ ## Cache safety
90
+
91
+ Slash commands that mutate system-prompt state default to deferred invalidation; opt-in `--now` for immediate. Mid-conversation prompt rewrites blow the cache and cost real money.
92
+
93
+ ## Testing
94
+
95
+ One `test.js` at project root. ≤200 lines. Plain assertions, real data, real services. No mocks. No fixtures. No `tests/` dir. New behavior = extend `test.js`, not a new test file.
96
+
97
+ ## Substrate gotchas
98
+
99
+ - `pi-coding-agent` ships a photon-rs wasm; install needs network. Verified working on Windows.
100
+ - `pi-ai` reads provider keys via `findEnvKeys` / `getEnvApiKey`. Match its env var names (`ANTHROPIC_API_KEY`, etc.).
101
+ - `floosie.ProcessorMachine` is an xstate machine. Compose, don't fork.
102
+ - **Browser inline `<script type="module">` syntax errors** — When a pageerror reports "missing ) after argument list" with no file:line info, extract the script body to a separate `.js` file and run `node --check path/to/file.js`. Browsers swallow line numbers for inline modules; node's V8 parser prints exact line. Essential for debugging unbalanced parens in webjsx-style nested `h()` calls. (Confirmed 2026-04-30: freddie dashboard app.js, line 133.)
103
+
104
+ ## Subsystem guide
105
+
106
+ | Concern | Freddie location |
107
+ |---|---|
108
+ | Agent loop | `src/agent/machine.js` (xstate) + `@mariozechner/pi-agent-core` |
109
+ | CLI entry | `bin/freddie.js` (commander) + pi-coding-agent InteractiveMode |
110
+ | Tool registry | `src/tools/registry.js` + `src/tools/{bash,read,write,edit,grep}.js` |
111
+ | Toolsets | `src/toolsets.js` |
112
+ | Session store | `src/sessions.js` (better-sqlite3 + FTS5) |
113
+ | Home + profiles | `src/home.js` |
114
+ | Structured logging | `src/observability/log.js` |
115
+ | Config | `src/config.js` |
116
+ | Commands | `src/commands/registry.js` |
117
+ | Skin engine | `src/skin/engine.js` |
118
+ | Gateway + platforms | `src/gateway/run.js` + `src/gateway/platforms/*.js` |
119
+ | ACP (JSON-RPC stdio) | `src/acp/server.js` |
120
+ | TUI | substrate (`pi-tui` + pi-coding-agent) |
121
+ | Plugins + memory | `src/plugins/manager.js` + `src/plugins/memory/provider.js` |
122
+ | Skills loader | `src/skills/index.js` — content drops into `~/.freddie/skills/` |
123
+ | Context compressor | `src/agent/compress/{tokens,policy,prompt,prune,fallback,compressor,index}.js` |
124
+ | Documentation site | `website/` (flatspace + content/pages/*.yaml + theme.mjs) |
125
+ | Cron scheduler | `src/cron/{scheduler,cron-parse}.js` |
126
+ | Batch runner | `src/batch.js` |
127
+ | Execution environments | `src/tools/environments/{local,docker,ssh}.js` (modal/daytona/singularity = explicit residual) |
128
+ | Dashboard | `src/web/{server,index.html}` (anentrypoint-design webjsx) |
129
+ | Auth store | `src/auth.js` (FileAuthStore) + pi-ai key resolution |
130
+ | Context engine | `src/context/engine.js` |
131
+ | Browser tool | `src/tools/browser.js` (puppeteer-core, lazy) |
132
+ | Image gen | `src/tools/image_gen.js` (openai/replicate) |
133
+ | Web search | `src/tools/web_search.js` (DDG/SerpAPI) |
134
+ | Todo | `src/tools/todo.js` |
135
+ | Memory tool | `src/tools/memory.js` |
136
+ | Delegate | `src/tools/delegate.js` |
137
+ | Bundled skills | `skills/` (5 categories, 12 SKILL.md placeholders) |
138
+ | Integration tests | one `test.js` at root per gm policy |
139
+
140
+ ## Cross-project Rust gotchas
141
+
142
+ - **rs-plugkit exec utility verbs** (2026-04-30) — The plugkit.exe binary advertises `exec:status`, `exec:close`, `exec:sleep` in hook help, but the Cmd enum was missing Status/Close/Sleep variants. Fix applied to c:\dev\rs-plugkit\src\main.rs; awaiting CI rebuild. Until rebuilt: use `exec:wait <secs>` for waits, read task output files directly via fs.readFileSync instead of exec:status.
143
+ - **rs-exec timeout alias** — Both `--timeout` (long-form) and `--timeout-ms` (plugin convention) are accepted due to alias added to c:\dev\rs-exec\src\main.rs. Both Cmd::Exec and Cmd::Bash support either form.
144
+
145
+ ## Integration test status (2026-04-30)
146
+
147
+ All 21 named integration tests in `test.js` pass (exit 0). Subsystem coverage:
148
+ - agent loop, CLI, gateway, plugins, skills, sessions, cron, batch, dashboard, ACP, web, context-engine, compressor, auth, observability
149
+
150
+ ## Windows libuv cleanup caveat
151
+
152
+ `test.js` adds explicit cleanup hooks before exit (`closeDb()`, `closeAll()` for log streams) to prevent libuv handle-teardown crash on Windows. Without these, exit hangs or returns non-zero. Critical for stability on Windows hosts.
153
+
154
+ ## LLM backends and acptoapi
155
+
156
+ - **acptoapi bridge** — Integrated at `src/agent/acptoapi-bridge.js` + `src/agent/llm_resolver.js` (commit 5f55f1e). Localhost API (default port 4800) converting OpenAI/Anthropic SDK calls to multiple backends: Kilo Code, opencode, Claude CLI, Anthropic API, Gemini, Ollama, Bedrock. Endpoint `/v1/chat/completions`, OpenAI-compatible, accepts `Bearer none` auth.
157
+ - **LLM resolver priority** — (1) explicit `callLLM` arg, (2) pi-bridge if `ANTHROPIC_API_KEY` / `OPENAI_API_KEY` / `GROQ_API_KEY` / `OPENROUTER_API_KEY` env set, (3) acptoapi if `/v1/models` returns 200, (4) throw with actionable error. Configurable via `FREDDIE_LLM_URL` and `FREDDIE_LLM_MODEL` env vars.
158
+ - **acptoapi Claude backend tool-call mismatch** — acptoapi's Claude backend returns Anthropic-style XML `<function_calls><invoke name="bash">…</invoke></function_calls>` in message content, not OpenAI `tool_calls` JSON array. This breaks the agent's tool-loop auto-fire. Workaround: use real Anthropic API key + pi-bridge for proper tool dispatch, or use structured `callLLM` stubs in tests.
159
+
160
+ ## Learning audit
161
+
162
+ - 2026-05-01: 5 items queried (pi-ai keys, profile paths, cache safety, floosie composition, browser errors); rs-learn store unavailable (exec:recall returned no results). 0 items migrated. New facts (anentrypoint-design build, dashboard live-rerender caveat, libuv spawn caveat) ingested directly into rs-learn; audit will retry in future sessions.
163
+ - 2026-05-01 (session 2): 5 items queried (pi-ai env keys, profile safe paths, cache safety, floosie composition, browser syntax errors). rs-learn store still empty. 0 items migrated. Refined anentrypoint-design source/dist skew entry in AGENTS.md to include silent-failure pageerror diagnostic. New fact `reference/anentrypoint-design-dist-rebuild` ingested.
164
+
165
+ ## Dashboard web UI caveats
166
+
167
+ - **anentrypoint-design v0.0.27 source/dist skew** — Published npm package lags behind source in C:/dev/anentrypoint-design. New components (EmptyState, etc.) present in source but missing from dist/247420.js until rebuild. Run `node scripts/build.mjs` in the design repo (emits dist/247420.js ~441KB + 247420.css; build ~150ms); warning "[247420] missing css: vendor/rippleui-1.12.1.css" is benign. Skip rebuild and browser-witness new component usage: silent pageerror "component is not a function" kills app mount with no output in #app. freddie/package.json uses `file:../anentrypoint-design` so npm install always mirrors rebuilt dist without publish cycles.
168
+ - **Live page rerender caveat** — AppState.body caching (page computed once at navigation, body saved) breaks for live routes like #/chat where AppState is mutated mid-flight (SSE pushes new messages). Fix: detect live routes in rerender(), recompute body: `if (AppState.hash === '#/chat') { Promise.resolve(PAGES['#/chat']()).then(b => { AppState.body = b; _mount() }); return }`. Any future live-streaming pages (cron output, traces) need the same treatment.
169
+ - **libuv spawn caveat** — Spawning createDashboard() from exec:nodejs and keeping process alive triggers libuv UV_HANDLE_CLOSING crash on shutdown. Reliable alternative: boot via `node bin/freddie.js dashboard --port <port>`. Liveness checks: exec:browser → page.goto → window.__debug.dashboard() returns {booted, ts, framework, route}; window.__debug.chat() exposes {messages, streaming, draft}; window.__debug.sendChat(text) drives round-trips.
170
+
171
+ ## Residual complement (NOT ported this session)
172
+
173
+ Genuinely out of session reach, with reasons:
174
+
175
+ - **Real credentials per platform** — adapters work; setup needs you to provide TELEGRAM_BOT_TOKEN, DISCORD_BOT_TOKEN, SLACK_BOT_TOKEN, etc. before `start()` succeeds. Listed in each adapter's `getRequiredEnv()`.
176
+ - **Memory provider API accounts** — 8 provider modules call real endpoints. Test runs construct objects but don't hit external APIs without keys (HONCHO_API_KEY etc.).
177
+ - **modal / daytona / singularity environments** — only local/docker/ssh ported. The other three are heavyweight remote-execution deps (Modal SDK, Daytona Cloud, Singularity containers).
178
+ - **Bedrock / codex provider adapters** — `pi-ai` covers Anthropic/OpenAI/Groq. Adding bedrock/codex requires registering custom providers via `pi-ai`'s `registerApiProvider`.
179
+ - **TUI Ink rewrite** — `pi-tui` IS the substrate (architectural choice, not a port).
180
+ - **15k pytest tests** — single `test.js` per gm policy.
package/CHANGELOG.md ADDED
@@ -0,0 +1,32 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [0.0.8] - 2026-05-02
6
+
7
+ ### Changed
8
+ - Redesigned flatspace GitHub Pages with pro-rata anentrypoint-design patterns
9
+ - home: Hero + Manifesto + quick-start section with npm install + 3 CLI commands
10
+ - architecture: Crumb breadcrumbs + Section subsystems + Receipt tech specs
11
+ - tools: Core/Environment/External tool groups with full descriptions
12
+ - platforms: Chat/Messaging/Enterprise/Generic platform categories (16 adapters)
13
+ - skills: Manifesto listing 5 bundled skill categories
14
+ - cli: Install component + Top Commands section with 4+ commands + usage examples
15
+ - development: Changelog + integration test status (21/21 passing) + AGENTS.md link
16
+
17
+ ### Build
18
+ - flatspace build outputs 7 HTML pages + .nojekyll to website/docs/
19
+ - All pages generated without errors, validated via HTTP and browser witness
20
+ - Dark theme with gold headings, blue links, responsive layout
21
+
22
+ ## [0.0.7] - 2026-04-30
23
+
24
+ - Use npm anentrypoint-design instead of file: link so CI can install it
25
+
26
+ ## [0.0.6] - 2026-04-25
27
+
28
+ - Redesign dashboard web view with anentrypoint-design pro-rata patterns
29
+
30
+ ## Previous Releases
31
+
32
+ See git history for earlier versions.
package/README.md ADDED
@@ -0,0 +1,130 @@
1
+ # Freddie
2
+
3
+ An open JS agent harness built on pi-mono, xstate, floosie, and anentrypoint-design. Features a full gateway, context compressor, multi-platform adapters, and a live dashboard — built with:
4
+
5
+ - [`@mariozechner/pi-coding-agent`](https://www.npmjs.com/package/@mariozechner/pi-coding-agent) — agent + tools + interactive TUI substrate
6
+ - [`@mariozechner/pi-agent-core`](https://www.npmjs.com/package/@mariozechner/pi-agent-core) — agent loop primitives
7
+ - [`@mariozechner/pi-ai`](https://www.npmjs.com/package/@mariozechner/pi-ai) — provider abstraction (Anthropic / OpenAI / Groq / …)
8
+ - [`@mariozechner/pi-tui`](https://www.npmjs.com/package/@mariozechner/pi-tui) — TUI primitives
9
+ - [`floosie`](https://www.npmjs.com/package/floosie) — gateway stream pipeline (xstate-backed)
10
+ - [`xstate`](https://www.npmjs.com/package/xstate) — agent turn machine + lifecycle state machines
11
+ - [`anentrypoint-design`](https://www.npmjs.com/package/anentrypoint-design) — webjsx + ripple-ui design system (replaces React for the dashboard)
12
+ - [`flatspace`](https://www.npmjs.com/package/flatspace) — flat-file CMS + static site builder (powers the `website/` documentation site)
13
+
14
+ See [AGENTS.md](./AGENTS.md) for the full subsystem guide and residual complement.
15
+
16
+ ## Install
17
+
18
+ ```sh
19
+ cd c:/dev/freddie
20
+ npm install
21
+ ```
22
+
23
+ ## Use
24
+
25
+ ```sh
26
+ # List tools (>=11 registered)
27
+ node bin/freddie.js tools
28
+
29
+ # All slash-style commands
30
+ node bin/freddie.js help-all
31
+
32
+ # Interactive REPL (skin-aware, slash commands routed via registry)
33
+ node bin/freddie.js run
34
+
35
+ # Profile management (~/.freddie/profiles/*)
36
+ node bin/freddie.js profile list
37
+ node bin/freddie.js profile create coder
38
+ node bin/freddie.js profile switch coder
39
+
40
+ # Skin engine (default | ares | mono | slate)
41
+ node bin/freddie.js skin
42
+ node bin/freddie.js skin ares
43
+
44
+ # Sessions and search
45
+ node bin/freddie.js sessions
46
+ node bin/freddie.js search "<query>"
47
+
48
+ # Cron scheduler (persistent jobs in SQLite)
49
+ node bin/freddie.js cron list
50
+ node bin/freddie.js cron add "*/5 * * * *" "summarize my email"
51
+ node bin/freddie.js cron tick
52
+
53
+ # Batch runner (parallel runs, JSONL output)
54
+ node bin/freddie.js batch prompts.txt --concurrency 4
55
+
56
+ # Web dashboard (express + anentrypoint-design webjsx)
57
+ node bin/freddie.js dashboard --port 3000
58
+
59
+ # Gateway (webhook + api_server + 16 platform adapters)
60
+ node bin/freddie.js gateway --port 3000
61
+
62
+ # ACP server (JSON-RPC over stdio for IDE integrations)
63
+ node bin/freddie.js acp
64
+ ```
65
+
66
+ ## Tools
67
+
68
+ Built-in: `bash`, `read`, `write`, `edit`, `grep`, `todo`, `memory`, `delegate`, `web_search`, `image_gen`, `browser`. Auto-discovered from `src/tools/*.js`.
69
+
70
+ ## Platforms
71
+
72
+ `src/gateway/platforms/`: webhook, api_server, telegram, discord, slack, whatsapp, signal, matrix, mattermost, email, sms, dingtalk, wecom, weixin, feishu, qqbot, bluebubbles, homeassistant. Each adapter exposes `getRequiredEnv()` and throws clear messages when credentials are absent.
73
+
74
+ ## Memory providers
75
+
76
+ `src/plugins/memory/`: honcho, mem0, supermemory, byterover, hindsight, holographic (local-FS), openviking, retaindb. Set `memory.provider` in `~/.freddie/config.yaml` and the corresponding `*_API_KEY`.
77
+
78
+ ## Layout
79
+
80
+ ```
81
+ freddie/
82
+ ├── bin/freddie.js # commander CLI: tools, skills, profile, skin, sessions, search, gateway, acp, run, cron, batch, dashboard, help-all
83
+ ├── src/
84
+ │ ├── home.js # getFophHome + profiles
85
+ │ ├── config.js # YAML + migrations
86
+ │ ├── sessions.js # SQLite + FTS5
87
+ │ ├── auth.js # FileAuthStore (~/.freddie/auth/)
88
+ │ ├── batch.js # parallel batch runner
89
+ │ ├── tools/ # registry + 11 built-in tools + environments/
90
+ │ ├── toolsets.js
91
+ │ ├── agent/{machine,pi-bridge}.js # xstate turn machine + pi-ai bridge
92
+ │ ├── commands/{registry,profile}.js # CommandDef + CRUD
93
+ │ ├── cli/interactive.js # readline REPL
94
+ │ ├── context/engine.js # pluggable context blocks
95
+ │ ├── cron/{scheduler,cron-parse}.js
96
+ │ ├── web/{server,index.html} # dashboard
97
+ │ ├── gateway/ # Gateway + 18 platform adapters
98
+ │ ├── acp/server.js # JSON-RPC stdio
99
+ │ ├── plugins/ # PluginManager + 8 memory backends
100
+ │ ├── skills/index.js # SKILL.md loader
101
+ │ ├── skin/engine.js # 4 built-in skins, YAML user-skins
102
+ │ └── observability/ # structured logs + /debug
103
+ │ └── agent/compress/{tokens,policy,prompt,prune,fallback,compressor,index}.js # context compressor
104
+ ├── skills/ # bundled SKILL.md (creative, software-development, ops, data, planning)
105
+ ├── website/ # flatspace-powered docs site (content/pages/*.yaml + theme.mjs)
106
+ ├── AGENTS.md
107
+ ├── CHANGELOG.md
108
+ └── test.js # 21 named groups, ≤200 lines, real services
109
+ ```
110
+
111
+ ## Status
112
+
113
+ Tier 0.3 complete and witnessed: 21 named tests passing, dashboard + website both live-witnessed via headless browser.
114
+
115
+ - 16 gateway platforms with functional wire-format code (no throwing stubs)
116
+ - 8 memory providers call real endpoints (or local-FS for `holographic`)
117
+ - 11 built-in tools (bash/read/write/edit/grep/todo/memory/delegate/web_search/image_gen/browser)
118
+ - Cron scheduler, parallel batch runner, auth store, context-engine, pi-ai bridge, interactive REPL
119
+ - **Full context compressor** (`src/agent/compress/*`) with handoff-framed summary prefix, structured summarizer prompt, head/middle/tail policy, tool-output pre-pruning, summary-budget ratio, iterative summary update, and 600s failure cooldown
120
+ - **Documentation site** at `website/` powered by `flatspace` (NOT docusaurus). Build with `cd website && node ../node_modules/flatspace/bin/flatspace.js build` — output to `website/docs/` for GitHub Pages.
121
+
122
+ What's not in the box yet (residual, see AGENTS.md): real credentials per platform / memory backend; modal / daytona / singularity environments; bedrock / codex provider adapters.
123
+
124
+ ## Testing
125
+
126
+ ```sh
127
+ node test.js
128
+ ```
129
+
130
+ One integration test at root, ≤200 lines, plain assertions, real services. No fixtures, no mocks. Dashboard validation also runs through a live `exec:browser` witness during EMIT/VERIFY.
package/bin/freddie.js ADDED
@@ -0,0 +1,116 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from 'commander'
3
+ import { registry, discoverBuiltinTools } from '../src/tools/registry.js'
4
+ import { listAllProfiles, createProfile, deleteProfile, switchProfile } from '../src/commands/profile.js'
5
+ import { listSkills } from '../src/skills/index.js'
6
+ import { Gateway } from '../src/gateway/run.js'
7
+ import { WebhookAdapter } from '../src/gateway/platforms/webhook.js'
8
+ import { ApiServerAdapter } from '../src/gateway/platforms/api_server.js'
9
+ import { AcpServer } from '../src/acp/server.js'
10
+ import { COMMAND_REGISTRY, COMMANDS_BY_CATEGORY } from '../src/commands/registry.js'
11
+ import { getActiveSkin, listBuiltinSkins, setActiveSkin } from '../src/skin/engine.js'
12
+ import { listSessions, search } from '../src/sessions.js'
13
+
14
+ const program = new Command()
15
+ program.name('freddie').version('0.1.0').description('Freddie — JS port of hermes-agent built on pi-mono')
16
+
17
+ program.command('tools')
18
+ .description('List/inspect tools')
19
+ .argument('[action]', 'list | get', 'list')
20
+ .argument('[name]')
21
+ .action(async (action, name) => {
22
+ await discoverBuiltinTools()
23
+ if (action === 'get' && name) { console.log(JSON.stringify(registry.get(name)?.schema, null, 2)); return }
24
+ for (const t of registry.list()) console.log(`${t.toolset.padEnd(10)} ${t.name}\t${t.schema.description.slice(0, 60)}`)
25
+ })
26
+
27
+ program.command('skills')
28
+ .description('List skills')
29
+ .argument('[action]', 'list', 'list')
30
+ .action(() => {
31
+ for (const s of listSkills()) console.log(`${s.name}\t${s.description.slice(0, 80)}`)
32
+ })
33
+
34
+ program.command('profile')
35
+ .argument('[action]', 'list | create | switch | delete', 'list')
36
+ .argument('[name]')
37
+ .action((action, name) => {
38
+ if (action === 'list') { for (const p of listAllProfiles()) console.log(p); return }
39
+ if (action === 'create') { createProfile(name); console.log('created:', name); return }
40
+ if (action === 'delete') { deleteProfile(name); console.log('deleted:', name); return }
41
+ if (action === 'switch') { switchProfile(name); console.log('switched:', name || 'default'); return }
42
+ })
43
+
44
+ program.command('skin')
45
+ .argument('[name]')
46
+ .action((name) => {
47
+ if (!name) { console.log('active:', getActiveSkin().name); console.log('available:', listBuiltinSkins().join(', ')); return }
48
+ setActiveSkin(name); console.log('switched to:', name)
49
+ })
50
+
51
+ program.command('sessions').action(() => { for (const s of listSessions()) console.log(`${s.id}\t${s.platform}\t${new Date(s.updated_at).toISOString()}\t${s.title || ''}`) })
52
+ program.command('search').argument('<query>').action((q) => { for (const r of search(q)) console.log(`${r.session_id}\t${(r.content || '').slice(0, 100)}`) })
53
+
54
+ program.command('gateway')
55
+ .option('--port <port>', 'webhook port', '0')
56
+ .action(async (opts) => {
57
+ const webhook = new WebhookAdapter({ port: Number(opts.port) })
58
+ const api = new ApiServerAdapter({ port: 0 })
59
+ const gw = new Gateway({ platforms: { webhook, api_server: api } })
60
+ await gw.start()
61
+ console.log('webhook port:', webhook.port, '\napi_server port:', api.port)
62
+ process.on('SIGINT', async () => { await gw.stop(); process.exit(0) })
63
+ })
64
+
65
+ program.command('acp').action(() => { const s = new AcpServer(); s.start() })
66
+
67
+ program.command('help-all').action(() => {
68
+ for (const [cat, cmds] of Object.entries(COMMANDS_BY_CATEGORY)) {
69
+ console.log(`\n# ${cat}`)
70
+ for (const c of cmds) console.log(` /${c.name}${c.args_hint ? ' ' + c.args_hint : ''}\t${c.description}`)
71
+ }
72
+ })
73
+
74
+ program.command('run').description('Run interactive REPL').action(async () => {
75
+ const { interactive } = await import('../src/cli/interactive.js')
76
+ let callLLM = null
77
+ try { ({ callLLM } = await import('../src/agent/pi-bridge.js')) } catch {}
78
+ await interactive({ callLLM })
79
+ })
80
+
81
+ program.command('cron')
82
+ .argument('[action]', 'list | add | cancel | delete | tick', 'list')
83
+ .argument('[arg1]')
84
+ .argument('[arg2]')
85
+ .action(async (action, a1, a2) => {
86
+ const { listJobs, createJob, cancelJob, deleteJob, tick } = await import('../src/cron/scheduler.js')
87
+ if (action === 'list') { for (const j of listJobs()) console.log(`${j.id}\t${j.cron}\t${j.enabled ? 'on ' : 'off'}\t${j.prompt.slice(0, 60)}`); return }
88
+ if (action === 'add') { const id = createJob({ cron: a1, prompt: a2 }); console.log('created:', id); return }
89
+ if (action === 'cancel') { cancelJob(Number(a1)); console.log('cancelled:', a1); return }
90
+ if (action === 'delete') { deleteJob(Number(a1)); console.log('deleted:', a1); return }
91
+ if (action === 'tick') { console.log('fired:', (await tick()).length); return }
92
+ })
93
+
94
+ program.command('batch')
95
+ .argument('<file>', 'JSONL or TXT prompts file')
96
+ .option('--concurrency <n>', '', '4')
97
+ .option('--model <model>', '', '')
98
+ .action(async (file, opts) => {
99
+ const fs = await import('node:fs')
100
+ const { runBatch } = await import('../src/batch.js')
101
+ const raw = fs.readFileSync(file, 'utf8').trim().split('\n')
102
+ const prompts = raw.map(l => { try { return JSON.parse(l).prompt || JSON.parse(l) } catch { return l } }).filter(Boolean)
103
+ const out = await runBatch({ prompts, concurrency: Number(opts.concurrency), model: opts.model })
104
+ console.log('batch:', out.id, '\nfile:', out.file, '\nresults:', out.results.length)
105
+ })
106
+
107
+ program.command('dashboard')
108
+ .option('--port <port>', '', '0')
109
+ .action(async (opts) => {
110
+ const { createDashboard } = await import('../src/web/server.js')
111
+ const d = await createDashboard({ port: Number(opts.port) })
112
+ console.log('dashboard:', d.url)
113
+ process.on('SIGINT', async () => { await d.stop(); process.exit(0) })
114
+ })
115
+
116
+ program.parseAsync(process.argv).catch(e => { console.error(e); process.exit(1) })
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "freddie",
3
+ "version": "0.0.41",
4
+ "type": "module",
5
+ "description": "Freddie — Free Realtime Dynamic Dialogue Information Engine. Open JS agent harness built on pi-mono, floosie, xstate, and anentrypoint-design",
6
+ "bin": {
7
+ "freddie": "./bin/freddie.js"
8
+ },
9
+ "main": "./src/index.js",
10
+ "scripts": {
11
+ "start": "node bin/freddie.js",
12
+ "test": "node test.js"
13
+ },
14
+ "dependencies": {
15
+ "@mariozechner/pi-agent-core": "^0.70.6",
16
+ "@mariozechner/pi-ai": "^0.70.6",
17
+ "@mariozechner/pi-coding-agent": "^0.70.6",
18
+ "@mariozechner/pi-tui": "^0.70.6",
19
+ "anentrypoint-design": "^0.0.29",
20
+ "commander": "^14.0.0",
21
+ "express": "^5.0.0",
22
+ "flatspace": "^1.0.18",
23
+ "floosie": "^0.6.14",
24
+ "js-yaml": "^4.1.0",
25
+ "@libsql/client": "^0.5.0",
26
+ "xstate": "^5.31.0",
27
+ "zod": "^4.0.0"
28
+ },
29
+ "engines": {
30
+ "node": ">=20.6.0"
31
+ },
32
+ "files": [
33
+ "bin/",
34
+ "src/",
35
+ "skills/",
36
+ "README.md",
37
+ "CHANGELOG.md",
38
+ "AGENTS.md"
39
+ ],
40
+ "repository": {
41
+ "type": "git",
42
+ "url": "git+https://github.com/AnEntrypoint/freddie.git"
43
+ },
44
+ "bugs": {
45
+ "url": "https://github.com/AnEntrypoint/freddie/issues"
46
+ },
47
+ "homepage": "https://github.com/AnEntrypoint/freddie#readme",
48
+ "license": "MIT",
49
+ "keywords": [
50
+ "ai",
51
+ "agent",
52
+ "llm",
53
+ "cli",
54
+ "coding-agent",
55
+ "freddie",
56
+ "pi-mono",
57
+ "xstate"
58
+ ]
59
+ }
@@ -0,0 +1,3 @@
1
+ # creative skills
2
+
3
+ Built-in skills in this category. Drop additional SKILL.md files in subdirectories.
@@ -0,0 +1,52 @@
1
+ ---
2
+ name: architecture-diagram
3
+ description: Generate system architecture diagrams as Mermaid, PlantUML, or ASCII art from a description or codebase
4
+ category: creative
5
+ ---
6
+
7
+ # Architecture Diagram
8
+
9
+ You are an expert software architect. Produce clear, accurate architecture diagrams from user descriptions or codebases.
10
+
11
+ ## Inputs you accept
12
+
13
+ - Natural language description of a system ("I have a Node.js API, a Postgres DB, and a Redis cache")
14
+ - A directory path or list of source files to analyse
15
+ - An existing diagram to update or extend
16
+
17
+ ## Output formats
18
+
19
+ Choose the best format for the request:
20
+ 1. **Mermaid** (`graph TD`, `sequenceDiagram`, `C4Context`) — preferred for GitHub/Notion
21
+ 2. **PlantUML** (`@startuml`) — preferred for enterprise/Java shops
22
+ 3. **ASCII art** — for terminal output or when no renderer is available
23
+
24
+ ## Process
25
+
26
+ 1. Identify the **system boundary** — what is in scope vs external.
27
+ 2. Identify **components**: services, databases, queues, external APIs, clients.
28
+ 3. Identify **data flows**: reads, writes, events, API calls.
29
+ 4. Group components into **layers** (presentation / application / data / infra).
30
+ 5. Label every arrow with the **protocol or action** (HTTP GET, SQL, AMQP publish).
31
+ 6. Add a legend if non-obvious glyphs are used.
32
+
33
+ ## Rules
34
+
35
+ - Keep diagrams under 20 nodes. Split into sub-diagrams if larger.
36
+ - Never invent components not mentioned or clearly implied.
37
+ - Always show the entry point and the persistence layer.
38
+ - For sequence diagrams: happy path first, then `alt` error blocks.
39
+
40
+ ## Example (Mermaid)
41
+
42
+ ```mermaid
43
+ graph TD
44
+ Browser -->|HTTPS| API[Node.js API]
45
+ API -->|SQL| DB[(Postgres)]
46
+ API -->|GET/SET| Cache[(Redis)]
47
+ API -->|publish| Queue[RabbitMQ]
48
+ Worker -->|consume| Queue
49
+ Worker -->|SQL| DB
50
+ ```
51
+
52
+ Ask the user for the system description if none is provided; otherwise produce the diagram immediately.
@@ -0,0 +1,60 @@
1
+ ---
2
+ name: ascii-video
3
+ description: Convert images or video frames to ASCII art, or generate ASCII animations from descriptions
4
+ category: creative
5
+ ---
6
+
7
+ # ASCII Video / Animation
8
+
9
+ You are an ASCII art specialist. Produce static ASCII art, multi-frame ASCII animations, and terminal video player scripts.
10
+
11
+ ## Character density palette (dark → light)
12
+
13
+ ```
14
+ █▓▒░ @#S%?*+;:,.
15
+ ```
16
+
17
+ Use dense characters for dark areas, sparse for light. Monochrome: `@#+=-. `
18
+
19
+ ## ASCII animation format
20
+
21
+ Frames separated by `---FRAME <n>---`. Each frame is fixed-width. Play with ANSI clear: `\x1b[2J\x1b[H` between frames.
22
+
23
+ Example 3-frame bouncing ball:
24
+ ```
25
+ ---FRAME 0---
26
+ O
27
+
28
+
29
+ ---FRAME 1---
30
+
31
+ O
32
+
33
+ ---FRAME 2---
34
+
35
+
36
+ O
37
+ ```
38
+
39
+ ## ffmpeg-based video-to-ASCII (Node.js)
40
+
41
+ ```js
42
+ import { execSync } from 'child_process'
43
+ import fs from 'fs'
44
+ const VIDEO = process.argv[2], FPS = 10, W = 80, H = 24
45
+ execSync(`ffmpeg -i "${VIDEO}" -vf fps=${FPS},scale=${W}:${H} /tmp/frame%04d.pgm -y`)
46
+ const frames = fs.readdirSync('/tmp').filter(f => /^frame\d+\.pgm$/.test(f)).sort()
47
+ for (const f of frames) {
48
+ const raw = fs.readFileSync('/tmp/' + f)
49
+ process.stdout.write('\x1b[2J\x1b[H' + renderFrame(raw))
50
+ await new Promise(r => setTimeout(r, 1000 / FPS))
51
+ }
52
+ ```
53
+
54
+ ## Rules
55
+
56
+ - Confirm terminal width before generating wide art.
57
+ - For animations, state the frame rate and total duration.
58
+ - Keep all frames the same width/height — mismatched frames cause terminal flicker.
59
+
60
+ Ask the user: source image/video, output width (default 80), desired style (blocks/ASCII/braille).