ada-agent 0.1.0

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 (339) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +256 -0
  3. package/bench/README.md +88 -0
  4. package/bench/swebench.mjs +242 -0
  5. package/bin/ada-server.mjs +6 -0
  6. package/bin/ada.mjs +7 -0
  7. package/docs/agent-loop.svg +66 -0
  8. package/docs/architecture.md +139 -0
  9. package/docs/architecture.svg +73 -0
  10. package/docs/connectors.md +48 -0
  11. package/docs/integrations.md +59 -0
  12. package/docs/login-flow.svg +56 -0
  13. package/docs/orchestration.md +45 -0
  14. package/package.json +64 -0
  15. package/skills/accessibility/SKILL.md +23 -0
  16. package/skills/add-logging/SKILL.md +23 -0
  17. package/skills/add-metrics/SKILL.md +23 -0
  18. package/skills/adr/SKILL.md +24 -0
  19. package/skills/aesthetic-direction/SKILL.md +24 -0
  20. package/skills/agent-loop/SKILL.md +23 -0
  21. package/skills/alerting/SKILL.md +23 -0
  22. package/skills/alpha-compositing/SKILL.md +23 -0
  23. package/skills/android-compose/SKILL.md +23 -0
  24. package/skills/angular-module/SKILL.md +23 -0
  25. package/skills/ansible-playbook/SKILL.md +24 -0
  26. package/skills/api-docs/SKILL.md +24 -0
  27. package/skills/app-store-prep/SKILL.md +23 -0
  28. package/skills/architecture-diagram/SKILL.md +21 -0
  29. package/skills/architecture-doc/SKILL.md +24 -0
  30. package/skills/audit-log/SKILL.md +23 -0
  31. package/skills/authz-review/SKILL.md +23 -0
  32. package/skills/aws-lambda/SKILL.md +24 -0
  33. package/skills/bash-script/SKILL.md +23 -0
  34. package/skills/batch/SKILL.md +23 -0
  35. package/skills/bisect/SKILL.md +23 -0
  36. package/skills/bounding-box/SKILL.md +24 -0
  37. package/skills/branch-cleanup/SKILL.md +23 -0
  38. package/skills/bundle-analyze/SKILL.md +23 -0
  39. package/skills/cache/SKILL.md +23 -0
  40. package/skills/call-graph/SKILL.md +23 -0
  41. package/skills/canvas-debug/SKILL.md +23 -0
  42. package/skills/cdn-setup/SKILL.md +23 -0
  43. package/skills/changelog/SKILL.md +24 -0
  44. package/skills/cherry-pick/SKILL.md +23 -0
  45. package/skills/ci-setup/SKILL.md +23 -0
  46. package/skills/cleanup/SKILL.md +23 -0
  47. package/skills/cli-tool/SKILL.md +23 -0
  48. package/skills/cloudformation/SKILL.md +23 -0
  49. package/skills/code-examples/SKILL.md +24 -0
  50. package/skills/code-review/SKILL.md +23 -0
  51. package/skills/color-palette/SKILL.md +24 -0
  52. package/skills/color-space/SKILL.md +24 -0
  53. package/skills/comment-why/SKILL.md +23 -0
  54. package/skills/commit/SKILL.md +26 -0
  55. package/skills/complexity-audit/SKILL.md +23 -0
  56. package/skills/component/SKILL.md +23 -0
  57. package/skills/component-library/SKILL.md +23 -0
  58. package/skills/connect-github/SKILL.md +20 -0
  59. package/skills/connect-mcp/SKILL.md +21 -0
  60. package/skills/connect-postgres/SKILL.md +20 -0
  61. package/skills/connect-remote/SKILL.md +23 -0
  62. package/skills/connect-slack/SKILL.md +20 -0
  63. package/skills/contract-audit/SKILL.md +25 -0
  64. package/skills/contributing/SKILL.md +23 -0
  65. package/skills/cpp-raii/SKILL.md +23 -0
  66. package/skills/cron-job/SKILL.md +23 -0
  67. package/skills/cv-preprocess/SKILL.md +24 -0
  68. package/skills/dark-mode/SKILL.md +24 -0
  69. package/skills/dashboard/SKILL.md +23 -0
  70. package/skills/dashboard-ui/SKILL.md +23 -0
  71. package/skills/data-export/SKILL.md +23 -0
  72. package/skills/data-validation/SKILL.md +23 -0
  73. package/skills/dataframe/SKILL.md +23 -0
  74. package/skills/db-index/SKILL.md +24 -0
  75. package/skills/dead-code/SKILL.md +23 -0
  76. package/skills/debug/SKILL.md +24 -0
  77. package/skills/deck-review/SKILL.md +24 -0
  78. package/skills/dedupe/SKILL.md +23 -0
  79. package/skills/dedupe-deps/SKILL.md +23 -0
  80. package/skills/dependency-audit/SKILL.md +23 -0
  81. package/skills/dependency-update/SKILL.md +23 -0
  82. package/skills/deploy/SKILL.md +23 -0
  83. package/skills/design-system/SKILL.md +24 -0
  84. package/skills/design-tokens/SKILL.md +24 -0
  85. package/skills/diagram-as-code/SKILL.md +24 -0
  86. package/skills/diff-explain/SKILL.md +23 -0
  87. package/skills/django-view/SKILL.md +23 -0
  88. package/skills/doc-lint/SKILL.md +24 -0
  89. package/skills/docker-compose/SKILL.md +23 -0
  90. package/skills/dockerize/SKILL.md +23 -0
  91. package/skills/docstrings/SKILL.md +23 -0
  92. package/skills/dotfiles/SKILL.md +23 -0
  93. package/skills/dpi-scaling/SKILL.md +23 -0
  94. package/skills/e2e-test/SKILL.md +23 -0
  95. package/skills/embeddings/SKILL.md +23 -0
  96. package/skills/empty-states/SKILL.md +23 -0
  97. package/skills/env-setup/SKILL.md +23 -0
  98. package/skills/erc20/SKILL.md +24 -0
  99. package/skills/error-tracking/SKILL.md +23 -0
  100. package/skills/estimate/SKILL.md +23 -0
  101. package/skills/etl-pipeline/SKILL.md +24 -0
  102. package/skills/eval-harness/SKILL.md +23 -0
  103. package/skills/exif-orientation/SKILL.md +23 -0
  104. package/skills/explain-code/SKILL.md +23 -0
  105. package/skills/express-middleware/SKILL.md +23 -0
  106. package/skills/extract-function/SKILL.md +23 -0
  107. package/skills/faq/SKILL.md +24 -0
  108. package/skills/fastapi-endpoint/SKILL.md +23 -0
  109. package/skills/favicon/SKILL.md +23 -0
  110. package/skills/feature-engineering/SKILL.md +23 -0
  111. package/skills/few-shot/SKILL.md +23 -0
  112. package/skills/find-owner/SKILL.md +23 -0
  113. package/skills/firmware-driver/SKILL.md +23 -0
  114. package/skills/fix-flaky-tests/SKILL.md +23 -0
  115. package/skills/flutter-widget/SKILL.md +23 -0
  116. package/skills/font-rendering/SKILL.md +23 -0
  117. package/skills/form-validation/SKILL.md +23 -0
  118. package/skills/format/SKILL.md +23 -0
  119. package/skills/game-loop/SKILL.md +23 -0
  120. package/skills/gas-optimize/SKILL.md +25 -0
  121. package/skills/gdpr-review/SKILL.md +24 -0
  122. package/skills/github-actions/SKILL.md +23 -0
  123. package/skills/glossary/SKILL.md +24 -0
  124. package/skills/go-idioms/SKILL.md +23 -0
  125. package/skills/gpu-profile/SKILL.md +23 -0
  126. package/skills/graphify/SKILL.md +21 -0
  127. package/skills/graphql-resolver/SKILL.md +23 -0
  128. package/skills/grpc-service/SKILL.md +23 -0
  129. package/skills/guardrails/SKILL.md +23 -0
  130. package/skills/healthcheck/SKILL.md +23 -0
  131. package/skills/heisenbug/SKILL.md +23 -0
  132. package/skills/helm-chart/SKILL.md +24 -0
  133. package/skills/hero-section/SKILL.md +23 -0
  134. package/skills/html-email/SKILL.md +24 -0
  135. package/skills/html-form/SKILL.md +23 -0
  136. package/skills/html-sanitize/SKILL.md +23 -0
  137. package/skills/html-table/SKILL.md +23 -0
  138. package/skills/html-to-pdf/SKILL.md +23 -0
  139. package/skills/http-client/SKILL.md +23 -0
  140. package/skills/i18n/SKILL.md +23 -0
  141. package/skills/i2c-spi/SKILL.md +23 -0
  142. package/skills/image-decode/SKILL.md +24 -0
  143. package/skills/image-memory/SKILL.md +24 -0
  144. package/skills/image-perf/SKILL.md +24 -0
  145. package/skills/image-pipeline/SKILL.md +24 -0
  146. package/skills/image-upload/SKILL.md +24 -0
  147. package/skills/infra-cost/SKILL.md +24 -0
  148. package/skills/input-validation/SKILL.md +23 -0
  149. package/skills/issue-template/SKILL.md +23 -0
  150. package/skills/java-streams/SKILL.md +23 -0
  151. package/skills/k8s-manifest/SKILL.md +23 -0
  152. package/skills/kotlin-coroutines/SKILL.md +23 -0
  153. package/skills/landing-page/SKILL.md +24 -0
  154. package/skills/laravel-controller/SKILL.md +23 -0
  155. package/skills/lazy-load/SKILL.md +23 -0
  156. package/skills/license-check/SKILL.md +23 -0
  157. package/skills/license-header/SKILL.md +23 -0
  158. package/skills/lint-fix/SKILL.md +23 -0
  159. package/skills/llm-cost/SKILL.md +23 -0
  160. package/skills/lockfile-fix/SKILL.md +23 -0
  161. package/skills/low-power/SKILL.md +23 -0
  162. package/skills/makefile/SKILL.md +23 -0
  163. package/skills/man-page/SKILL.md +24 -0
  164. package/skills/mcp-server/SKILL.md +23 -0
  165. package/skills/memory-leak/SKILL.md +23 -0
  166. package/skills/mermaid-diagram/SKILL.md +23 -0
  167. package/skills/meta-tags/SKILL.md +23 -0
  168. package/skills/micro-interactions/SKILL.md +23 -0
  169. package/skills/migration/SKILL.md +23 -0
  170. package/skills/migration-guide/SKILL.md +24 -0
  171. package/skills/mkdocs-setup/SKILL.md +24 -0
  172. package/skills/mobile-permissions/SKILL.md +23 -0
  173. package/skills/mock-api/SKILL.md +23 -0
  174. package/skills/modernize/SKILL.md +23 -0
  175. package/skills/monorepo-setup/SKILL.md +23 -0
  176. package/skills/motion-design/SKILL.md +23 -0
  177. package/skills/n-plus-one/SKILL.md +23 -0
  178. package/skills/naming-review/SKILL.md +23 -0
  179. package/skills/nextjs-route/SKILL.md +23 -0
  180. package/skills/nginx-config/SKILL.md +23 -0
  181. package/skills/ocr-debug/SKILL.md +24 -0
  182. package/skills/onboard/SKILL.md +23 -0
  183. package/skills/onboarding-map/SKILL.md +23 -0
  184. package/skills/open-pr/SKILL.md +24 -0
  185. package/skills/openapi/SKILL.md +23 -0
  186. package/skills/opencv-debug/SKILL.md +24 -0
  187. package/skills/orm-model/SKILL.md +23 -0
  188. package/skills/owasp-check/SKILL.md +24 -0
  189. package/skills/page-transitions/SKILL.md +23 -0
  190. package/skills/pagination/SKILL.md +23 -0
  191. package/skills/perf-optimize/SKILL.md +23 -0
  192. package/skills/perf-profile/SKILL.md +23 -0
  193. package/skills/physics/SKILL.md +23 -0
  194. package/skills/pitch-deck/SKILL.md +24 -0
  195. package/skills/pixel-diff/SKILL.md +23 -0
  196. package/skills/ponytail/SKILL.md +46 -0
  197. package/skills/postmortem/SKILL.md +24 -0
  198. package/skills/pptx-deck/SKILL.md +23 -0
  199. package/skills/pptx-export/SKILL.md +23 -0
  200. package/skills/pptx-from-markdown/SKILL.md +23 -0
  201. package/skills/pptx-template/SKILL.md +24 -0
  202. package/skills/pr-review/SKILL.md +24 -0
  203. package/skills/precommit/SKILL.md +23 -0
  204. package/skills/pricing-page/SKILL.md +23 -0
  205. package/skills/project-overview/SKILL.md +22 -0
  206. package/skills/prompt-template/SKILL.md +23 -0
  207. package/skills/property-test/SKILL.md +23 -0
  208. package/skills/protobuf/SKILL.md +23 -0
  209. package/skills/py-async/SKILL.md +23 -0
  210. package/skills/py-typing/SKILL.md +23 -0
  211. package/skills/query-optimize/SKILL.md +23 -0
  212. package/skills/rag-pipeline/SKILL.md +23 -0
  213. package/skills/rails-resource/SKILL.md +23 -0
  214. package/skills/rate-limit/SKILL.md +23 -0
  215. package/skills/react-hooks/SKILL.md +23 -0
  216. package/skills/react-native-screen/SKILL.md +23 -0
  217. package/skills/react-perf/SKILL.md +23 -0
  218. package/skills/readme/SKILL.md +24 -0
  219. package/skills/rebase/SKILL.md +24 -0
  220. package/skills/refactor/SKILL.md +23 -0
  221. package/skills/regression-test/SKILL.md +23 -0
  222. package/skills/release-notes/SKILL.md +24 -0
  223. package/skills/rename-symbol/SKILL.md +23 -0
  224. package/skills/repro/SKILL.md +23 -0
  225. package/skills/resolve-conflicts/SKILL.md +23 -0
  226. package/skills/responsive/SKILL.md +23 -0
  227. package/skills/rest-endpoint/SKILL.md +23 -0
  228. package/skills/retro/SKILL.md +23 -0
  229. package/skills/rtos-task/SKILL.md +23 -0
  230. package/skills/runbook/SKILL.md +25 -0
  231. package/skills/rust-borrow/SKILL.md +23 -0
  232. package/skills/rust-unsafe-audit/SKILL.md +23 -0
  233. package/skills/sanitize/SKILL.md +23 -0
  234. package/skills/schema-design/SKILL.md +23 -0
  235. package/skills/screenshot-debug/SKILL.md +22 -0
  236. package/skills/scroll-animation/SKILL.md +23 -0
  237. package/skills/secret-scan/SKILL.md +23 -0
  238. package/skills/security-audit/SKILL.md +23 -0
  239. package/skills/security-review/SKILL.md +23 -0
  240. package/skills/seed-data/SKILL.md +23 -0
  241. package/skills/self-review/SKILL.md +23 -0
  242. package/skills/semantic-html/SKILL.md +23 -0
  243. package/skills/semver-bump/SKILL.md +24 -0
  244. package/skills/shader/SKILL.md +23 -0
  245. package/skills/shader-debug/SKILL.md +23 -0
  246. package/skills/simplify-conditionals/SKILL.md +23 -0
  247. package/skills/sitemap/SKILL.md +23 -0
  248. package/skills/skeleton-loader/SKILL.md +23 -0
  249. package/skills/slide-charts/SKILL.md +24 -0
  250. package/skills/slide-outline/SKILL.md +23 -0
  251. package/skills/snapshot-update/SKILL.md +23 -0
  252. package/skills/solidity-contract/SKILL.md +25 -0
  253. package/skills/speaker-notes/SKILL.md +23 -0
  254. package/skills/spike/SKILL.md +23 -0
  255. package/skills/split-file/SKILL.md +23 -0
  256. package/skills/spring-controller/SKILL.md +23 -0
  257. package/skills/sprite-anim/SKILL.md +23 -0
  258. package/skills/sql-report/SKILL.md +23 -0
  259. package/skills/squash/SKILL.md +24 -0
  260. package/skills/ssl-setup/SKILL.md +23 -0
  261. package/skills/stacktrace/SKILL.md +23 -0
  262. package/skills/static-site/SKILL.md +24 -0
  263. package/skills/structured-logging/SKILL.md +23 -0
  264. package/skills/svelte-store/SKILL.md +23 -0
  265. package/skills/swiftui-view/SKILL.md +23 -0
  266. package/skills/tailwind-theme/SKILL.md +24 -0
  267. package/skills/tcp-server/SKILL.md +23 -0
  268. package/skills/tdd/SKILL.md +23 -0
  269. package/skills/terraform-module/SKILL.md +24 -0
  270. package/skills/test-coverage/SKILL.md +23 -0
  271. package/skills/texture-debug/SKILL.md +23 -0
  272. package/skills/threat-model/SKILL.md +23 -0
  273. package/skills/thumbnail/SKILL.md +24 -0
  274. package/skills/todo-scan/SKILL.md +23 -0
  275. package/skills/tool-definition/SKILL.md +23 -0
  276. package/skills/trace-flow/SKILL.md +23 -0
  277. package/skills/tracing/SKILL.md +23 -0
  278. package/skills/train-model/SKILL.md +24 -0
  279. package/skills/tree-shake/SKILL.md +23 -0
  280. package/skills/ts-generics/SKILL.md +23 -0
  281. package/skills/ts-strict/SKILL.md +23 -0
  282. package/skills/tui-app/SKILL.md +23 -0
  283. package/skills/tutorial/SKILL.md +24 -0
  284. package/skills/type-tighten/SKILL.md +23 -0
  285. package/skills/typography/SKILL.md +24 -0
  286. package/skills/ui-bug-repro/SKILL.md +23 -0
  287. package/skills/ui-polish/SKILL.md +24 -0
  288. package/skills/ui-review/SKILL.md +24 -0
  289. package/skills/vendor/SKILL.md +23 -0
  290. package/skills/visual-diff-ci/SKILL.md +24 -0
  291. package/skills/visual-regression/SKILL.md +23 -0
  292. package/skills/vue-composition/SKILL.md +23 -0
  293. package/skills/web-component/SKILL.md +23 -0
  294. package/skills/web-fonts/SKILL.md +24 -0
  295. package/skills/web3-frontend/SKILL.md +25 -0
  296. package/skills/webgl-debug/SKILL.md +23 -0
  297. package/skills/webhook/SKILL.md +23 -0
  298. package/skills/websocket/SKILL.md +23 -0
  299. package/skills/write-tests/SKILL.md +19 -0
  300. package/src/client/agent.ts +803 -0
  301. package/src/client/background.ts +39 -0
  302. package/src/client/checkpoint.ts +48 -0
  303. package/src/client/cli.ts +1253 -0
  304. package/src/client/compaction.ts +86 -0
  305. package/src/client/extensions.ts +83 -0
  306. package/src/client/hooks.ts +40 -0
  307. package/src/client/image.ts +26 -0
  308. package/src/client/lsp.ts +0 -0
  309. package/src/client/mcp.ts +276 -0
  310. package/src/client/models-dev.ts +52 -0
  311. package/src/client/pkg.ts +41 -0
  312. package/src/client/platform.ts +94 -0
  313. package/src/client/prompts.ts +47 -0
  314. package/src/client/render.ts +138 -0
  315. package/src/client/session.ts +107 -0
  316. package/src/client/settings.ts +86 -0
  317. package/src/client/skill-router.ts +79 -0
  318. package/src/client/skills.ts +199 -0
  319. package/src/client/snapshot.ts +56 -0
  320. package/src/client/telemetry.ts +24 -0
  321. package/src/client/todos.ts +23 -0
  322. package/src/client/tools.ts +756 -0
  323. package/src/client/tui-mode.ts +41 -0
  324. package/src/client/tui.ts +224 -0
  325. package/src/sdk/index.ts +36 -0
  326. package/src/selfcheck.ts +364 -0
  327. package/src/server/config.ts +58 -0
  328. package/src/server/credentials.ts +89 -0
  329. package/src/server/identity.ts +58 -0
  330. package/src/server/index.ts +113 -0
  331. package/src/server/oauth.ts +93 -0
  332. package/src/server/providers/adapter.ts +25 -0
  333. package/src/server/providers/anthropic.ts +189 -0
  334. package/src/server/providers/openai-compat.ts +76 -0
  335. package/src/server/providers/registry.ts +31 -0
  336. package/src/server/router.ts +29 -0
  337. package/src/server/sse.ts +20 -0
  338. package/src/shared/types.ts +20 -0
  339. package/tsconfig.json +15 -0
@@ -0,0 +1,66 @@
1
+ <svg viewBox="0 0 900 430" xmlns="http://www.w3.org/2000/svg" font-family="ui-sans-serif, system-ui, sans-serif" role="img" aria-labelledby="t d">
2
+ <title id="t">ada agent loop</title>
3
+ <desc id="d">A turn: your message goes to the model, which streams a reply. If it has no tool calls the turn is done. If it does, gated tools prompt for approval, the tools run (read, edit, bash, grep), their results are appended as tool messages, and control returns to the model — repeating until the model stops calling tools.</desc>
4
+
5
+ <defs>
6
+ <marker id="a" markerWidth="9" markerHeight="9" refX="7" refY="4.5" orient="auto"><path d="M0,0 L9,4.5 L0,9 z" fill="#ffaf00"/></marker>
7
+ </defs>
8
+
9
+ <rect x="6" y="6" width="888" height="418" rx="16" fill="#0d0f12" stroke="#262b33"/>
10
+ <rect x="34" y="32" width="13" height="13" rx="4" transform="rotate(45 40 38)" fill="#ffaf00"/>
11
+ <text x="58" y="38" fill="#ffaf00" font-size="16" font-weight="700">ada · agent loop</text>
12
+ <text x="58" y="57" fill="#9aa3af" font-size="11.5">stream → call tools → feed results back → repeat until done</text>
13
+
14
+ <!-- arrows -->
15
+ <g stroke="#ffaf00" stroke-width="1.6" fill="none">
16
+ <line x1="192" y1="123" x2="248" y2="123" marker-end="url(#a)"/>
17
+ <line x1="412" y1="123" x2="498" y2="123" marker-end="url(#a)"/>
18
+ <line x1="622" y1="123" x2="710" y2="123" marker-end="url(#a)"/>
19
+ <path d="M560,165 V198 H765 V230" marker-end="url(#a)"/>
20
+ <line x1="690" y1="262" x2="622" y2="262" marker-end="url(#a)"/>
21
+ <line x1="470" y1="262" x2="412" y2="262" marker-end="url(#a)"/>
22
+ <path d="M330,230 V152" marker-end="url(#a)"/>
23
+ </g>
24
+ <g font-family="ui-monospace, monospace" font-size="10" fill="#9aa3af">
25
+ <text x="666" y="113" text-anchor="middle" fill="#7ee08a">no</text>
26
+ <text x="600" y="190" fill="#ffaf00">yes · tool_calls</text>
27
+ <text x="338" y="195" fill="#9aa3af">append {role: tool}</text>
28
+ </g>
29
+
30
+ <!-- top row -->
31
+ <g>
32
+ <rect x="42" y="95" width="150" height="56" rx="11" fill="#14171c" stroke="#262b33"/>
33
+ <text x="117" y="120" fill="#e6e9ee" font-size="13" font-weight="600" text-anchor="middle">user message</text>
34
+ <text x="117" y="138" fill="#9aa3af" font-size="10" text-anchor="middle" font-family="ui-monospace, monospace">your prompt</text>
35
+
36
+ <rect x="250" y="95" width="162" height="56" rx="11" fill="#101318" stroke="#262b33"/>
37
+ <text x="331" y="120" fill="#ffaf00" font-size="13" font-weight="700" text-anchor="middle">model</text>
38
+ <text x="331" y="138" fill="#9aa3af" font-size="10" text-anchor="middle" font-family="ui-monospace, monospace">stream tokens</text>
39
+
40
+ <path d="M560,81 L622,123 L560,165 L498,123 Z" fill="#14171c" stroke="#ffaf00"/>
41
+ <text x="560" y="120" fill="#e6e9ee" font-size="12" font-weight="600" text-anchor="middle">tool</text>
42
+ <text x="560" y="135" fill="#e6e9ee" font-size="12" font-weight="600" text-anchor="middle">calls?</text>
43
+
44
+ <rect x="712" y="95" width="150" height="56" rx="11" fill="#14171c" stroke="#3fb950"/>
45
+ <text x="787" y="120" fill="#7ee08a" font-size="13" font-weight="700" text-anchor="middle">reply</text>
46
+ <text x="787" y="138" fill="#9aa3af" font-size="10" text-anchor="middle" font-family="ui-monospace, monospace">turn done</text>
47
+ </g>
48
+
49
+ <!-- bottom row -->
50
+ <g>
51
+ <rect x="250" y="234" width="162" height="56" rx="11" fill="#14171c" stroke="#262b33"/>
52
+ <text x="331" y="259" fill="#e6e9ee" font-size="13" font-weight="600" text-anchor="middle">feed results</text>
53
+ <text x="331" y="277" fill="#9aa3af" font-size="10" text-anchor="middle" font-family="ui-monospace, monospace">one per tool call</text>
54
+
55
+ <rect x="470" y="234" width="152" height="56" rx="11" fill="#14171c" stroke="#262b33"/>
56
+ <text x="546" y="259" fill="#e6e9ee" font-size="13" font-weight="600" text-anchor="middle">run tools</text>
57
+ <text x="546" y="277" fill="#9aa3af" font-size="10" text-anchor="middle" font-family="ui-monospace, monospace">read·edit·bash·grep</text>
58
+
59
+ <rect x="690" y="234" width="152" height="56" rx="11" fill="#14171c" stroke="#ff7a59"/>
60
+ <text x="766" y="259" fill="#ff7a59" font-size="13" font-weight="700" text-anchor="middle">approve</text>
61
+ <text x="766" y="277" fill="#9aa3af" font-size="10" text-anchor="middle" font-family="ui-monospace, monospace">[y/a/N] · gated</text>
62
+ </g>
63
+
64
+ <text x="450" y="345" fill="#9aa3af" font-size="11" text-anchor="middle" font-family="ui-monospace, monospace">read-only tools never prompt · --yolo auto-approves · only the model's tool_calls drive the loop</text>
65
+ <text x="450" y="372" fill="#6b7480" font-size="10" text-anchor="middle">a tool call leaked into text as JSON (Ollama-over-stream) is recovered and run, not printed</text>
66
+ </svg>
@@ -0,0 +1,139 @@
1
+ # Architecture
2
+
3
+ ada is two programs in one repo: a thin **client** (the coding agent) and a **backend** (the
4
+ router that holds provider keys). They communicate in one wire format — OpenAI Chat Completions.
5
+
6
+ ![ada architecture](architecture.svg)
7
+
8
+ ```
9
+ ada (client) ada backend upstream providers
10
+ ──────────── ─────────── ──────────────────
11
+ agentic loop ──── HTTP ───▶ auth (client key)
12
+ tools router: model id → provider
13
+ sessions adapter: provider → wire format ──▶ Anthropic / OpenAI / …
14
+ approval/TUI ◀── SSE ──── normalize back to OpenAI SSE
15
+ ```
16
+
17
+ Why split it: the backend is the **one control point**. Provider keys, auth, rate limits, and
18
+ billing all belong in one place; the client carries only an ada client key. Same shape as Cursor.
19
+
20
+ ## Request flow
21
+
22
+ 1. The client sends an OpenAI-format chat request (model, messages, tools) to `ADA_BACKEND_URL`
23
+ with its client key as the bearer.
24
+ 2. The backend authenticates the key (`ADA_CLIENT_KEYS`, or open in dev mode), then `router.ts`
25
+ maps the model id → a provider.
26
+ 3. The matching **adapter** calls the upstream with the server-held provider key — a pass-through
27
+ for OpenAI-compatible providers, a translation for Anthropic.
28
+ 4. The backend streams normalized OpenAI SSE chunks back; the client renders text and runs tool
29
+ calls, appending one `{role:"tool", tool_call_id, content}` per call and looping.
30
+
31
+ ## The agent loop
32
+
33
+ ![ada agent loop](agent-loop.svg)
34
+
35
+ Each turn streams the model's reply; if it contains tool calls, gated ones prompt for approval,
36
+ the tools run, and one `{role:"tool", tool_call_id, content}` per call is appended before control
37
+ returns to the model — looping until the model stops calling tools.
38
+
39
+ ## Sign in (device flow)
40
+
41
+ ![ada login device flow](login-flow.svg)
42
+
43
+ GitHub/Google login uses the OAuth 2.0 device authorization grant (RFC 8628) — no password ever
44
+ reaches ada. The token is stored locally and sent as the bearer; the backend verifies identity in
45
+ `server/identity.ts`. The GitHub `client_id` is baked in (public, like `gh`), so the client needs
46
+ zero config.
47
+
48
+ ## One adapter per wire format
49
+
50
+ The key design decision: adapters are keyed by **wire format**, not by provider or model.
51
+
52
+ - Most providers speak the OpenAI format and share **`openai-compat.ts`** (a pass-through that just
53
+ swaps in the right base URL + key).
54
+ - Only a divergent format gets its own adapter — **`anthropic.ts`** translates OpenAI ⇄ Anthropic
55
+ Messages and re-emits Anthropic events as OpenAI SSE.
56
+
57
+ Consequences:
58
+
59
+ | Change | Cost |
60
+ |---|---|
61
+ | A new model | **0 code** (routing is by id) |
62
+ | A new OpenAI-compatible provider | **2 lines** in `config.ts` (base URL + key env) |
63
+ | A brand-new wire format | **1 adapter** + one line in `registry.ts` |
64
+
65
+ Vendor SDKs load **lazily** (pi-style): a `type`-only import plus a dynamic `import()`, so e.g.
66
+ `@anthropic-ai/sdk` never loads unless a Claude request actually arrives.
67
+
68
+ ## Routing
69
+
70
+ `router.ts` maps a model id to a provider:
71
+
72
+ - a model id containing `:` (e.g. `qwen2.5-coder:latest`) → local **Ollama**;
73
+ - otherwise by prefix (`gpt*`/`o*` → openai, `claude*` → anthropic, `gemini*` → google,
74
+ `mistral*` → mistral, `grok*` → xai, …);
75
+ - an explicit `provider` field on the request always wins;
76
+ - anything unmatched falls through to **OpenRouter**.
77
+
78
+ ## Context compaction
79
+
80
+ The client estimates context size (≈ chars / 4) and, when it crosses `ADA_COMPACT_AT` (default
81
+ 100k) or a request overflows, summarizes older turns into one compact summary and keeps the recent
82
+ ones. `/compact` forces it; `/context` shows the current estimate.
83
+
84
+ ## Tool-call recovery
85
+
86
+ Some providers (notably **Ollama over a streaming connection**) fail to parse a model's tool call
87
+ into the structured `tool_calls` field and leak it into the text as raw JSON. The client detects a
88
+ reply that *is* a JSON tool call (plain, ```` ```json ```` fenced, or `<tool_call>`-wrapped) for a
89
+ real tool and runs it instead of printing the JSON. Hallucinated tools (no such tool) are left as
90
+ text. See `parseTextToolCalls` in `client/agent.ts`.
91
+
92
+ ## File layout
93
+
94
+ ```
95
+ bin/
96
+ ada.mjs launcher: register tsx loader → run client/cli.ts
97
+ ada-server.mjs launcher: register tsx loader → run server/index.ts
98
+
99
+ src/
100
+ shared/
101
+ types.ts provider/model types shared by client and server
102
+
103
+ server/ the routing backend (ada-server | npm run server)
104
+ index.ts HTTP entry: auth → route → dispatch to an adapter (+ /v1/models, /v1/whoami)
105
+ config.ts providers, base URLs, key env vars, port, client-key auth
106
+ router.ts model id → provider
107
+ sse.ts Server-Sent Events helpers
108
+ identity.ts verify GitHub/Google tokens; allowlist
109
+ oauth.ts RFC 8628 device-flow login (built-in GitHub client id)
110
+ credentials.ts local credential store
111
+ providers/
112
+ adapter.ts the Adapter interface ← one adapter per WIRE FORMAT
113
+ registry.ts provider → adapter map
114
+ openai-compat.ts pass-through OpenAI-compatible adapter
115
+ anthropic.ts native Anthropic adapter (lazy @anthropic-ai/sdk)
116
+
117
+ client/ the terminal agent (ada | npm start)
118
+ cli.ts REPL: flags, model picker, slash commands, approval prompt
119
+ agent.ts the agentic loop (stream → tool calls → feed back → repeat)
120
+ tools.ts read/write/edit/bash/ls/grep/glob; protected paths; destructive detection
121
+ tui.ts inline TUI engine (composer, spinner, user bar)
122
+ tui-mode.ts the TUI loop
123
+ session.ts append-only JSONL session store (.cos0/sessions/)
124
+ compaction.ts context summarization
125
+ checkpoint.ts undo: snapshot files before edits, restore on /undo
126
+ todos.ts task tracking + render
127
+ hooks.ts extension hooks (before/after tool, input transform)
128
+ extensions.ts load extensions (tools + hooks + commands)
129
+ skills.ts · mcp.ts · prompts.ts skills, MCP servers, prompt templates
130
+ settings.ts · platform.ts · render.ts · image.ts · telemetry.ts · pkg.ts
131
+
132
+ selfcheck.ts offline checks (tools, sessions, routing, parsers, TUI)
133
+ ```
134
+
135
+ ## No build step
136
+
137
+ Everything runs through `tsx` — TypeScript with no compile. The `bin/*.mjs` launchers register the
138
+ tsx ESM loader in-process, then import the relevant `.ts` entrypoint (which self-runs). `tsx` is a
139
+ runtime dependency so the global `ada` command works after `npm link` / `npm install -g`.
@@ -0,0 +1,73 @@
1
+ <svg viewBox="0 0 920 470" xmlns="http://www.w3.org/2000/svg" font-family="ui-sans-serif, system-ui, sans-serif" role="img" aria-labelledby="t d">
2
+ <title id="t">ada architecture</title>
3
+ <desc id="d">The ada terminal client sends OpenAI Chat Completions over HTTP to the ada backend, which authenticates the client key, routes by model id, adapts to each provider's wire format, and streams normalized SSE back. The backend holds every provider key and reaches Anthropic via a native adapter and all other providers via a shared OpenAI-compatible adapter.</desc>
4
+
5
+ <defs>
6
+ <marker id="fwd" markerWidth="9" markerHeight="9" refX="7" refY="4.5" orient="auto"><path d="M0,0 L9,4.5 L0,9 z" fill="#ffaf00"/></marker>
7
+ <marker id="back" markerWidth="9" markerHeight="9" refX="7" refY="4.5" orient="auto"><path d="M0,0 L9,4.5 L0,9 z" fill="#3fb950"/></marker>
8
+ </defs>
9
+
10
+ <!-- panel -->
11
+ <rect x="6" y="6" width="908" height="458" rx="16" fill="#0d0f12" stroke="#262b33"/>
12
+ <rect x="34" y="34" width="14" height="14" rx="4" transform="rotate(45 41 41)" fill="#ffaf00"/>
13
+ <text x="60" y="40" fill="#ffaf00" font-size="17" font-weight="700">ada · architecture</text>
14
+ <text x="60" y="60" fill="#9aa3af" font-size="12">terminal client → routing backend → providers · one wire format throughout</text>
15
+
16
+ <!-- request / response lanes -->
17
+ <g font-family="ui-monospace, monospace" font-size="10.5">
18
+ <!-- top: request (gold, →) -->
19
+ <line x1="226" y1="200" x2="340" y2="200" stroke="#ffaf00" stroke-width="1.6" marker-end="url(#fwd)"/>
20
+ <text x="283" y="190" fill="#c5cdd6" text-anchor="middle">OpenAI Chat</text>
21
+ <text x="283" y="178" fill="#9aa3af" text-anchor="middle" font-size="9">Completions · HTTP</text>
22
+ <line x1="652" y1="200" x2="710" y2="200" stroke="#ffaf00" stroke-width="1.6" marker-end="url(#fwd)"/>
23
+ <text x="683" y="190" fill="#c5cdd6" text-anchor="middle">+ key</text>
24
+
25
+ <!-- bottom: response (green, ←) -->
26
+ <line x1="710" y1="320" x2="652" y2="320" stroke="#3fb950" stroke-width="1.6" marker-end="url(#back)"/>
27
+ <text x="683" y="338" fill="#7ee08a" text-anchor="middle">SSE</text>
28
+ <line x1="340" y1="320" x2="226" y2="320" stroke="#3fb950" stroke-width="1.6" marker-end="url(#back)"/>
29
+ <text x="283" y="338" fill="#7ee08a" text-anchor="middle">normalized OpenAI SSE</text>
30
+ </g>
31
+
32
+ <!-- client card -->
33
+ <rect x="42" y="138" width="184" height="212" rx="12" fill="#14171c" stroke="#262b33"/>
34
+ <text x="134" y="166" fill="#ffaf00" font-size="16" font-weight="700" text-anchor="middle">ada client</text>
35
+ <text x="134" y="183" fill="#9aa3af" font-size="10.5" text-anchor="middle">the terminal</text>
36
+ <g font-family="ui-monospace, monospace" font-size="11" fill="#c5cdd6" text-anchor="middle">
37
+ <text x="134" y="207">agentic loop · tools</text>
38
+ <text x="134" y="226">285 skills · MCP</text>
39
+ <text x="134" y="245">ask · plan · auto</text>
40
+ <text x="134" y="264">REPL · TUI · sessions</text>
41
+ <text x="134" y="283" fill="#6b7480">serve · SDK · ACP</text>
42
+ </g>
43
+ <rect x="80" y="303" width="108" height="22" rx="11" fill="#0d0f12" stroke="#262b33"/>
44
+ <text x="134" y="318" fill="#6b7480" font-size="10" text-anchor="middle" font-family="ui-monospace, monospace">holds no keys</text>
45
+
46
+ <!-- backend card -->
47
+ <rect x="346" y="118" width="306" height="244" rx="12" fill="#101318" stroke="#262b33"/>
48
+ <text x="499" y="146" fill="#ffaf00" font-size="15" font-weight="700" text-anchor="middle">ada backend</text>
49
+ <text x="499" y="163" fill="#9aa3af" font-size="10" text-anchor="middle">the one control point — holds every key</text>
50
+ <g font-family="ui-monospace, monospace" font-size="11.5">
51
+ <g><rect x="366" y="176" width="266" height="30" rx="8" fill="#14171c" stroke="#262b33"/><text x="380" y="195" fill="#e6e9ee"><tspan fill="#ffaf00">1</tspan> auth · client key</text></g>
52
+ <g><rect x="366" y="214" width="266" height="30" rx="8" fill="#14171c" stroke="#262b33"/><text x="380" y="233" fill="#e6e9ee"><tspan fill="#ffaf00">2</tspan> route · model id → provider</text></g>
53
+ <g><rect x="366" y="252" width="266" height="30" rx="8" fill="#14171c" stroke="#262b33"/><text x="380" y="271" fill="#e6e9ee"><tspan fill="#ffaf00">3</tspan> adapt · one per wire format</text></g>
54
+ <g><rect x="366" y="290" width="266" height="30" rx="8" fill="#14171c" stroke="#262b33"/><text x="380" y="309" fill="#e6e9ee"><tspan fill="#ffaf00">4</tspan> normalize → OpenAI SSE</text></g>
55
+ </g>
56
+
57
+ <!-- providers card -->
58
+ <rect x="716" y="150" width="162" height="180" rx="12" fill="#14171c" stroke="#262b33"/>
59
+ <text x="797" y="180" fill="#e6e9ee" font-size="13" font-weight="700" text-anchor="middle">providers</text>
60
+ <text x="797" y="202" fill="#ff7a59" font-size="12" font-weight="700" text-anchor="middle" font-family="ui-monospace, monospace">Anthropic <tspan fill="#6b7480" font-weight="400" font-size="9">native</tspan></text>
61
+ <line x1="732" y1="214" x2="862" y2="214" stroke="#262b33"/>
62
+ <g font-family="ui-monospace, monospace" font-size="10.5" fill="#c5cdd6" text-anchor="middle">
63
+ <text x="797" y="234">OpenAI · Gemini · Groq</text>
64
+ <text x="797" y="252">Mistral · DeepSeek · xAI</text>
65
+ <text x="797" y="270">Together · DashScope</text>
66
+ <text x="797" y="288">Ollama · OpenRouter</text>
67
+ </g>
68
+ <text x="797" y="312" fill="#ffaf00" font-size="9.5" text-anchor="middle" font-family="ui-monospace, monospace">all but Anthropic: openai-compat</text>
69
+
70
+ <!-- footer note -->
71
+ <text x="460" y="406" fill="#9aa3af" font-size="11" text-anchor="middle" font-family="ui-monospace, monospace">a new model = 0 code · a new OpenAI-compatible provider = 2 lines · a new wire format = 1 adapter</text>
72
+ <text x="460" y="430" fill="#6b7480" font-size="10" text-anchor="middle">vendor SDKs load lazily — the Anthropic SDK never loads unless a Claude request arrives</text>
73
+ </svg>
@@ -0,0 +1,48 @@
1
+ # Connectors (MCP)
2
+
3
+ ada connects to external tools and data through the **Model Context Protocol (MCP)**. Each connector
4
+ is an MCP server; ada spawns or calls it, lists its tools, and registers them as ada tools named
5
+ `<server>__<tool>` — approval-gated, and only loaded for **trusted projects**.
6
+
7
+ ## Quick start
8
+
9
+ ```bash
10
+ ada mcp # list the connector catalog (● configured · ○ available)
11
+ ada mcp add github # write the github entry into .ada/mcp.json
12
+ ada mcp remove github # remove it
13
+ ```
14
+
15
+ After `add`, set any env vars it prints (e.g. `GITHUB_PERSONAL_ACCESS_TOKEN`), then start `ada` in
16
+ that project — the connector's tools appear automatically.
17
+
18
+ ## Catalog
19
+
20
+ `filesystem` · `github` · `git` · `postgres` · `sqlite` · `fetch` · `brave-search` · `puppeteer` ·
21
+ `slack` · `memory` · `sentry`. Run `ada mcp` for the live list and which env vars each needs.
22
+
23
+ ## Config: `.ada/mcp.json`
24
+
25
+ `ada mcp add` edits this file, but you can also write entries by hand. Two transports:
26
+
27
+ ```jsonc
28
+ {
29
+ "servers": {
30
+ // local stdio server (a subprocess)
31
+ "fs": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "."] },
32
+ // remote server over Streamable HTTP
33
+ "remote": { "url": "https://mcp.example.com/v1", "headers": { "Authorization": "Bearer <token>" } }
34
+ }
35
+ }
36
+ ```
37
+
38
+ - **stdio** — `{ command, args, env }`: ada launches the process and speaks JSON-RPC over stdin/stdout.
39
+ - **http** — `{ url, headers }`: ada POSTs JSON-RPC and reads a JSON or SSE response (Streamable HTTP).
40
+
41
+ ## Notes
42
+
43
+ - MCP servers run code / reach the network, so they load **only in trusted projects** (the same trust
44
+ gate as `.ada` prompts and settings). Untrusted projects skip them.
45
+ - Every MCP tool is **approval-gated** — ada prompts before each call.
46
+ - Secrets come from **env vars** (referenced in the server's `env`), never committed to `.ada/mcp.json`.
47
+ - See the `connectors` skill category (`list_skills {category: "connectors"}`) for per-connector setup
48
+ walk-throughs, and the `mcp-server` skill to build your own.
@@ -0,0 +1,59 @@
1
+ # Integrating with ada
2
+
3
+ ada exposes a few programmatic surfaces so other tools can drive it. The buildable foundations are
4
+ shipped; the product surfaces that need *external* infrastructure (a Slack app, hosting, an Electron
5
+ build, an IdP) are described with what they'd take — they can't be "live" without your accounts.
6
+
7
+ ## HTTP API — `ada serve`
8
+
9
+ ```bash
10
+ ada serve # → http://localhost:8788 (ADA_HTTP_PORT to change)
11
+ ```
12
+ - `GET /health` → `{ ok, model }`
13
+ - `POST /v1/prompt` `{ "text": "...", "model"?: "..." }` → `{ text, usage }` (runs a fresh agent turn)
14
+
15
+ ## Typed SDK — `src/sdk`
16
+
17
+ ```ts
18
+ import { createClient } from "ada/sdk"; // or "./src/sdk/index.ts" in-repo
19
+ const ada = createClient("http://localhost:8788");
20
+ console.log(await ada.health());
21
+ const { text } = await ada.prompt("list the files in this project");
22
+ ```
23
+
24
+ ## ACP bridge — `ada acp`
25
+
26
+ A minimal Agent Client Protocol bridge over stdio (JSON-RPC 2.0, newline-delimited): handles
27
+ `initialize` and `session/prompt`, so an ACP-aware editor can drive ada. It's a **scaffold** — method
28
+ names and framing may need adjusting to your client's ACP version.
29
+
30
+ ## Session share — `ada share`
31
+
32
+ ```bash
33
+ ada share # serve the latest session as a read-only web page (localhost)
34
+ ada share <name|file> # a specific session
35
+ ```
36
+ Local and read-only. A *public* share link would need a hosted backend to receive and serve the
37
+ transcript (see below).
38
+
39
+ ---
40
+
41
+ ## Needs your infrastructure (foundations are here; the rest is your accounts/hosting)
42
+
43
+ These are all buildable **on top of the HTTP API / SDK above** — what's missing is the external
44
+ service, which only you can provision.
45
+
46
+ - **Slack bot** — a [Slack Bolt](https://slack.dev/bolt-js) app that, per thread, calls
47
+ `createClient().prompt(message)` and posts the reply. Needs a **Slack app + bot token** (`SLACK_BOT_TOKEN`)
48
+ and a running process. ~30 lines on top of the SDK.
49
+ - **Web console** — a single page that POSTs to `/v1/prompt` and renders the reply (the `ada share`
50
+ server is a minimal read-only version). Needs **hosting** + CORS if cross-origin.
51
+ - **Desktop app** — an Electron shell that spawns `ada serve` and points a webview at it. Needs the
52
+ **Electron build/packaging** pipeline (you already have the separate `ada-ide` VS Code fork).
53
+ - **Public session sharing** — `ada share` is local; a public link needs a **hosted endpoint** to
54
+ receive the transcript and a viewer (like opencode's `console.opncd.ai`).
55
+ - **Enterprise / identity / teams** — multi-tenant accounts + SSO need an **IdP and a control plane**;
56
+ out of scope for a single-binary CLI.
57
+ - **SQLite session store** — ada uses append-only JSONL (`.ada/sessions/*.jsonl`) by design (no native
58
+ dep, greppable, trivially portable). Node 24 ships an experimental `node:sqlite`; a SQLite backend is
59
+ a drop-in for `session.ts` if you want indexed queries — say the word and it's a small module.
@@ -0,0 +1,56 @@
1
+ <svg viewBox="0 0 580 500" xmlns="http://www.w3.org/2000/svg" font-family="ui-sans-serif, system-ui, sans-serif" role="img" aria-labelledby="t d">
2
+ <title id="t">ada login — device flow</title>
3
+ <desc id="d">Signing in with GitHub or Google uses the OAuth 2.0 device authorization grant (RFC 8628). The client requests a device code, shows you a user code and a URL, you approve in your browser, and the client polls until it receives an access token, which it stores locally and sends as the bearer for the backend to verify your identity.</desc>
4
+
5
+ <defs>
6
+ <marker id="a" markerWidth="9" markerHeight="9" refX="7" refY="4.5" orient="auto"><path d="M0,0 L9,4.5 L0,9 z" fill="#ffaf00"/></marker>
7
+ </defs>
8
+
9
+ <rect x="6" y="6" width="568" height="488" rx="16" fill="#0d0f12" stroke="#262b33"/>
10
+ <rect x="30" y="30" width="13" height="13" rx="4" transform="rotate(45 36 36)" fill="#ffaf00"/>
11
+ <text x="54" y="36" fill="#ffaf00" font-size="16" font-weight="700">ada · sign in</text>
12
+ <text x="54" y="55" fill="#9aa3af" font-size="11.5">device flow (RFC 8628) — no password ever touches ada</text>
13
+
14
+ <!-- connector spine -->
15
+ <g stroke="#ffaf00" stroke-width="1.6" fill="none">
16
+ <line x1="60" y1="118" x2="60" y2="150" marker-end="url(#a)"/>
17
+ <line x1="60" y1="196" x2="60" y2="228" marker-end="url(#a)"/>
18
+ <line x1="60" y1="288" x2="60" y2="320" marker-end="url(#a)"/>
19
+ <line x1="60" y1="366" x2="60" y2="398" marker-end="url(#a)"/>
20
+ </g>
21
+
22
+ <g font-family="ui-monospace, monospace">
23
+ <!-- 1 -->
24
+ <circle cx="60" cy="92" r="13" fill="#14171c" stroke="#ffaf00"/><text x="60" y="96" fill="#ffaf00" font-size="12" font-weight="700" text-anchor="middle">1</text>
25
+ <rect x="92" y="74" width="456" height="38" rx="9" fill="#14171c" stroke="#262b33"/>
26
+ <text x="108" y="91" fill="#e6e9ee" font-size="12">ada · <tspan fill="#ffaf00">/login</tspan> → choose GitHub or Google</text>
27
+ <text x="108" y="105" fill="#9aa3af" font-size="9.5">client POSTs a device-code request</text>
28
+
29
+ <!-- 2 -->
30
+ <circle cx="60" cy="172" r="13" fill="#14171c" stroke="#ffaf00"/><text x="60" y="176" fill="#ffaf00" font-size="12" font-weight="700" text-anchor="middle">2</text>
31
+ <rect x="92" y="154" width="456" height="42" rx="9" fill="#14171c" stroke="#262b33"/>
32
+ <text x="108" y="172" fill="#e6e9ee" font-size="12">ada shows a <tspan fill="#ffaf00" font-weight="700">user code</tspan> + a verification URL</text>
33
+ <text x="108" y="188" fill="#9aa3af" font-size="9.5">e.g. 8447-AB0E · https://github.com/login/device</text>
34
+
35
+ <!-- 3 (human / browser) -->
36
+ <circle cx="60" cy="258" r="13" fill="#14171c" stroke="#ff7a59"/><text x="60" y="262" fill="#ff7a59" font-size="12" font-weight="700" text-anchor="middle">3</text>
37
+ <rect x="92" y="234" width="456" height="54" rx="9" fill="#14171c" stroke="#ff7a59"/>
38
+ <text x="108" y="254" fill="#ff7a59" font-size="12" font-weight="700">↗ you open the URL in a browser</text>
39
+ <text x="108" y="271" fill="#e6e9ee" font-size="11">enter the code, sign in, approve</text>
40
+ <text x="108" y="284" fill="#9aa3af" font-size="9.5">meanwhile ada polls the token endpoint</text>
41
+
42
+ <!-- 4 -->
43
+ <circle cx="60" cy="342" r="13" fill="#14171c" stroke="#ffaf00"/><text x="60" y="346" fill="#ffaf00" font-size="12" font-weight="700" text-anchor="middle">4</text>
44
+ <rect x="92" y="324" width="456" height="42" rx="9" fill="#14171c" stroke="#262b33"/>
45
+ <text x="108" y="342" fill="#e6e9ee" font-size="12">provider returns an <tspan fill="#7ee08a" font-weight="700">access token</tspan></text>
46
+ <text x="108" y="358" fill="#9aa3af" font-size="9.5">stored locally in ~/.ada/credentials.json (file-locked)</text>
47
+
48
+ <!-- 5 -->
49
+ <circle cx="60" cy="422" r="13" fill="#14171c" stroke="#3fb950"/><text x="60" y="426" fill="#7ee08a" font-size="12" font-weight="700" text-anchor="middle">5</text>
50
+ <rect x="92" y="404" width="456" height="44" rx="9" fill="#14171c" stroke="#3fb950"/>
51
+ <text x="108" y="423" fill="#e6e9ee" font-size="12">token sent as the <tspan fill="#7ee08a" font-weight="700">bearer</tspan>; backend verifies identity</text>
52
+ <text x="108" y="439" fill="#9aa3af" font-size="9.5">server/identity.ts: GitHub /user · Google userinfo · allowlist</text>
53
+ </g>
54
+
55
+ <text x="290" y="476" fill="#6b7480" font-size="10" text-anchor="middle" font-family="ui-monospace, monospace">GitHub client_id is baked in (public, like gh) — zero client config</text>
56
+ </svg>
@@ -0,0 +1,45 @@
1
+ # Orchestration strategies
2
+
3
+ ada's harness splits into two roles so the *control flow* is pluggable:
4
+
5
+ - **Engine** — the harness primitives, in one place (`client/agent.ts`): `step()` (one model turn —
6
+ stream, collect content + tool calls, recover leaked calls, push the assistant message),
7
+ `runTools()`, `spawn()` (a headless sub-agent), plus `readDocs()` / `writeSkills()` /
8
+ `soleIntegration()`. It owns streaming, tool-call recovery, compaction, approval, and sessions.
9
+ - **Orchestrator** — a Strategy that only decides *when* to call those primitives. An agent
10
+ architecture is one small orchestrator; the engine never changes.
11
+
12
+ ```ts
13
+ interface Engine { step(opts?): Promise<StepResult|null>; runTools(calls); spawn(prompt); … }
14
+ interface Orchestrator { name: string; run(e: Engine): Promise<void>; }
15
+ ```
16
+
17
+ ## Built-in strategies
18
+
19
+ | Strategy | Architecture |
20
+ |---|---|
21
+ | `react` (default) | reason → act → observe → repeat (the classic loop) |
22
+ | `single` | one model turn, no tools — quick Q&A |
23
+ | `plan` | a read-only plan first, then execute it |
24
+ | `multi` | decompose → fan out to sub-agents → synthesize |
25
+ | `toolsmith` | read the lone integration's docs → sub-agents author skills for it |
26
+
27
+ Select with `--strategy <name>` or the `/strategy [name]` command (default `react`).
28
+
29
+ ## toolsmith — self-extending from an integration's docs
30
+
31
+ When **exactly one** connector is configured (`ada mcp add <name>`), `toolsmith`:
32
+
33
+ 1. reads that integration's "docs" — the descriptions + schemas of its registered `<name>__*` tools;
34
+ 2. a planning `step()` lists the capability **areas** (products, orders, payments, …);
35
+ 3. fans out one **sub-agent per area** (`Engine.spawn`), each authoring a `SKILL.md` from the docs;
36
+ 4. writes them to `.ada/skills/<name>-<area>/SKILL.md` under category `integration-<name>`.
37
+
38
+ ```bash
39
+ ada mcp add epicmerch # the only connector
40
+ ada --strategy toolsmith -p go # reads epicmerch's tools, writes epicmerch-* skills
41
+ ```
42
+
43
+ The model then discovers them with `list_skills category=integration-epicmerch` and loads one with
44
+ `use_skill`. Adding a new agent architecture is one new `Orchestrator` in `agent.ts` — zero changes
45
+ to streaming, tools, or sessions. (Same discipline as the backend's *one adapter per wire format*.)
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "ada-agent",
3
+ "version": "0.1.0",
4
+ "description": "A from-zero terminal coding agent with a Cursor-style routing backend, ~285 skills, MCP connectors, and ask/plan/auto modes",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": "Aditya",
8
+ "homepage": "https://github.com/black141312/ada#readme",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/black141312/ada.git"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/black141312/ada/issues"
15
+ },
16
+ "keywords": [
17
+ "coding-agent",
18
+ "ai-agent",
19
+ "llm",
20
+ "cli",
21
+ "terminal",
22
+ "tui",
23
+ "mcp",
24
+ "openai",
25
+ "anthropic",
26
+ "ollama",
27
+ "agentic",
28
+ "developer-tools"
29
+ ],
30
+ "bin": {
31
+ "ada": "bin/ada.mjs",
32
+ "ada-server": "bin/ada-server.mjs"
33
+ },
34
+ "files": [
35
+ "bin/",
36
+ "src/",
37
+ "skills/",
38
+ "docs/",
39
+ "bench/",
40
+ "tsconfig.json",
41
+ "README.md",
42
+ "LICENSE"
43
+ ],
44
+ "engines": {
45
+ "node": ">=18"
46
+ },
47
+ "scripts": {
48
+ "start": "tsx src/client/cli.ts",
49
+ "server": "tsx src/server/index.ts",
50
+ "typecheck": "tsc --noEmit",
51
+ "selfcheck": "tsx src/selfcheck.ts",
52
+ "bench:swebench": "node bench/swebench.mjs"
53
+ },
54
+ "dependencies": {
55
+ "@anthropic-ai/sdk": "^0.106.0",
56
+ "node-pty": "^1.1.0",
57
+ "openai": "^6.45.0",
58
+ "tsx": "^4.22.4"
59
+ },
60
+ "devDependencies": {
61
+ "@types/node": "^26.0.1",
62
+ "typescript": "^6.0.3"
63
+ }
64
+ }
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: accessibility
3
+ description: Audit and fix a11y issues — semantics, ARIA, contrast, keyboard nav, focus, and labels
4
+ category: frontend
5
+ ---
6
+
7
+ # Accessibility
8
+
9
+ Use when a component or page needs an a11y pass: failing audits, keyboard traps, missing labels, or low contrast.
10
+
11
+ 1. Start with semantics: replace `div`/`span` clickables with `button`, `a`, `nav`, `main`, `ul`, headings in order — native elements give you roles and keyboard support for free.
12
+ 2. Label every interactive and form control: visible `<label htmlFor>`, or `aria-label`/`aria-labelledby`; give icon-only buttons an accessible name and decorative images `alt=""`.
13
+ 3. Verify keyboard flow: Tab order is logical, every action is reachable and operable via Enter/Space, focus is visible, and modals trap focus and restore it on close.
14
+ 4. Add ARIA only to fill gaps native HTML can't (`aria-expanded`, `aria-current`, `role="alert"`, `aria-live` for dynamic updates) — and remove redundant or wrong ARIA.
15
+ 5. Check color contrast against WCAG AA (4.5:1 text, 3:1 large text / UI), and ensure state isn't conveyed by color alone (add icon/text).
16
+ 6. Re-run an automated checker (axe/Lighthouse) plus a manual keyboard + screen-reader sweep, and fix what tooling flags.
17
+
18
+ ## Rules
19
+ - Prefer native semantic HTML over ARIA; a wrong `role` is worse than none.
20
+ - Never remove focus outlines without providing an equally visible replacement.
21
+ - Every form input needs a programmatically associated label, not just placeholder text.
22
+ - Don't rely on color alone to communicate errors, status, or required fields.
23
+ - Announce async changes (toasts, validation, loading) via `aria-live` so screen readers catch them.
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: add-logging
3
+ description: Add strategic temporary logging to isolate an issue, read the output, then remove it cleanly
4
+ category: debugging
5
+ ---
6
+
7
+ # Add Logging
8
+
9
+ Reach for this when you can't see what the code is doing and a debugger isn't practical (async flows, production-like runs, fast loops). Logging buys visibility — but it's scaffolding, not a deliverable.
10
+
11
+ 1. Decide what you need to confirm: which branch was taken, what a value is, whether a function ran, or how long something took.
12
+ 2. Place logs at decision points and boundaries — function entry/exit, before/after the suspect call, inside each branch of the `if`.
13
+ 3. Log identifying context with each value: a label, the variable name, and a correlation id if multiple requests interleave.
14
+ 4. Run the repro, read the output, and narrow: each pass should let you delete some logs and add more around the surviving suspect.
15
+ 5. Once the root cause is confirmed, apply the fix.
16
+ 6. Remove every temporary log (grep for your unique marker), and re-run to confirm the fix holds without them.
17
+
18
+ ## Rules
19
+ - Tag temporary logs with a unique searchable string (e.g. `XDEBUG`) so you can find and delete all of them.
20
+ - Log values, not just "got here" — `console.log('count', count)` beats `console.log('here')`.
21
+ - For loops or hot paths, gate logging or log only the boundary case so output stays readable.
22
+ - Don't commit debug logs; if a log is genuinely worth keeping, promote it to a real logger at the right level deliberately.
23
+ - Beware that logging can mask timing bugs — see the heisenbug skill if the bug vanishes once logs are added.
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: add-metrics
3
+ description: Instrument code with Prometheus/OpenTelemetry metrics for counters, gauges, histograms
4
+ category: observability
5
+ ---
6
+
7
+ # Add Metrics
8
+
9
+ Reach for this when you need to measure rates, throughput, latency, or resource levels — request counts, error rates, queue depth, job durations.
10
+
11
+ 1. Pick the client matching the stack (prom-client for Node, prometheus-client for Python, OTel SDK for vendor-neutral) and add it as a dependency.
12
+ 2. Choose the right instrument per signal: counter for monotonic totals (requests, errors), gauge for point-in-time values (in-flight, queue size), histogram for distributions (latency, payload size).
13
+ 3. Define metrics once at module scope with a stable `name`, `help` text, and low-cardinality labels; never recreate them per request.
14
+ 4. Increment/observe at the call site — wrap handlers or middleware so every request records duration and outcome (`status`, `route`).
15
+ 5. Expose a `/metrics` endpoint (Prometheus) or wire an OTLP exporter (OpenTelemetry) and confirm it scrapes with `curl localhost:PORT/metrics`.
16
+ 6. Add a histogram for the critical path latency using sensible buckets (e.g. `0.005..10` seconds) rather than the defaults.
17
+
18
+ ## Rules
19
+ - Keep label cardinality bounded — never put user IDs, request IDs, emails, or raw URLs in labels; normalize routes to templates (`/users/:id`).
20
+ - Use base units and suffixes Prometheus expects: seconds (not ms), bytes, `_total` for counters, `_seconds` for durations.
21
+ - Initialize counters to 0 for all known label sets so absence vs. zero is distinguishable.
22
+ - Record duration in a `finally` block so errors still get measured.
23
+ - Don't block the request path on metric export; exporters must be async/buffered.