auggy 0.3.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 (121) hide show
  1. package/CHANGELOG.md +96 -0
  2. package/LICENSE +201 -0
  3. package/README.md +161 -0
  4. package/package.json +76 -0
  5. package/src/agent-card.ts +39 -0
  6. package/src/agent.ts +283 -0
  7. package/src/agentmail-client.ts +138 -0
  8. package/src/augments/bash/index.ts +463 -0
  9. package/src/augments/bash/skill/SKILL.md +156 -0
  10. package/src/augments/budgets/budget-store.ts +513 -0
  11. package/src/augments/budgets/index.ts +134 -0
  12. package/src/augments/budgets/preamble.ts +93 -0
  13. package/src/augments/budgets/types.ts +89 -0
  14. package/src/augments/file-memory/index.ts +71 -0
  15. package/src/augments/filesystem/index.ts +533 -0
  16. package/src/augments/filesystem/skill/SKILL.md +142 -0
  17. package/src/augments/filesystem/skill/references/mount-permissions.md +81 -0
  18. package/src/augments/layered-memory/extractor/buffer.ts +56 -0
  19. package/src/augments/layered-memory/extractor/frequency.ts +79 -0
  20. package/src/augments/layered-memory/extractor/inject-handler.ts +103 -0
  21. package/src/augments/layered-memory/extractor/parse.ts +75 -0
  22. package/src/augments/layered-memory/extractor/prompt.md +26 -0
  23. package/src/augments/layered-memory/index.ts +757 -0
  24. package/src/augments/layered-memory/skill/SKILL.md +153 -0
  25. package/src/augments/layered-memory/storage/migrations/README.md +16 -0
  26. package/src/augments/layered-memory/storage/migrations/supabase-add-fact-fields.sql +9 -0
  27. package/src/augments/layered-memory/storage/sqlite-store.ts +352 -0
  28. package/src/augments/layered-memory/storage/supabase-store.ts +263 -0
  29. package/src/augments/layered-memory/storage/types.ts +98 -0
  30. package/src/augments/link/index.ts +489 -0
  31. package/src/augments/link/translate.ts +261 -0
  32. package/src/augments/notify/adapters/agentmail.ts +70 -0
  33. package/src/augments/notify/adapters/telegram.ts +60 -0
  34. package/src/augments/notify/adapters/webhook.ts +55 -0
  35. package/src/augments/notify/index.ts +284 -0
  36. package/src/augments/notify/skill/SKILL.md +150 -0
  37. package/src/augments/org-context/index.ts +721 -0
  38. package/src/augments/org-context/skill/SKILL.md +96 -0
  39. package/src/augments/skills/index.ts +103 -0
  40. package/src/augments/supabase-memory/index.ts +151 -0
  41. package/src/augments/telegram-transport/index.ts +312 -0
  42. package/src/augments/telegram-transport/polling.ts +55 -0
  43. package/src/augments/telegram-transport/webhook.ts +56 -0
  44. package/src/augments/turn-control/index.ts +61 -0
  45. package/src/augments/turn-control/skill/SKILL.md +155 -0
  46. package/src/augments/visitor-auth/email-validation.ts +66 -0
  47. package/src/augments/visitor-auth/index.ts +779 -0
  48. package/src/augments/visitor-auth/rate-limiter.ts +90 -0
  49. package/src/augments/visitor-auth/skill/SKILL.md +55 -0
  50. package/src/augments/visitor-auth/storage/sqlite-store.ts +398 -0
  51. package/src/augments/visitor-auth/storage/types.ts +164 -0
  52. package/src/augments/visitor-auth/types.ts +123 -0
  53. package/src/augments/visitor-auth/verify-page.ts +179 -0
  54. package/src/augments/web-fetch/index.ts +331 -0
  55. package/src/augments/web-fetch/skill/SKILL.md +100 -0
  56. package/src/cli/agent-index.ts +289 -0
  57. package/src/cli/augment-catalog.ts +320 -0
  58. package/src/cli/augment-resolver.ts +597 -0
  59. package/src/cli/commands/add-skill.ts +194 -0
  60. package/src/cli/commands/add.ts +87 -0
  61. package/src/cli/commands/chat.ts +207 -0
  62. package/src/cli/commands/create.ts +462 -0
  63. package/src/cli/commands/dev.ts +139 -0
  64. package/src/cli/commands/eval.ts +180 -0
  65. package/src/cli/commands/ls.ts +66 -0
  66. package/src/cli/commands/remove.ts +95 -0
  67. package/src/cli/commands/restart.ts +40 -0
  68. package/src/cli/commands/start.ts +123 -0
  69. package/src/cli/commands/status.ts +104 -0
  70. package/src/cli/commands/stop.ts +84 -0
  71. package/src/cli/commands/visitors-revoke.ts +155 -0
  72. package/src/cli/commands/visitors.ts +101 -0
  73. package/src/cli/config-parser.ts +1034 -0
  74. package/src/cli/engine-resolver.ts +68 -0
  75. package/src/cli/index.ts +178 -0
  76. package/src/cli/model-picker.ts +89 -0
  77. package/src/cli/pid-registry.ts +146 -0
  78. package/src/cli/plist-generator.ts +117 -0
  79. package/src/cli/resolve-config.ts +56 -0
  80. package/src/cli/scaffold-skills.ts +158 -0
  81. package/src/cli/scaffold.ts +291 -0
  82. package/src/cli/skill-frontmatter.ts +51 -0
  83. package/src/cli/skill-validator.ts +151 -0
  84. package/src/cli/types.ts +228 -0
  85. package/src/cli/yaml-helpers.ts +66 -0
  86. package/src/engines/_shared/cost.ts +55 -0
  87. package/src/engines/_shared/schema-normalize.ts +75 -0
  88. package/src/engines/anthropic/pricing.ts +117 -0
  89. package/src/engines/anthropic.ts +483 -0
  90. package/src/engines/openai/pricing.ts +67 -0
  91. package/src/engines/openai.ts +446 -0
  92. package/src/engines/openrouter/pricing.ts +83 -0
  93. package/src/engines/openrouter.ts +185 -0
  94. package/src/helpers.ts +24 -0
  95. package/src/http.ts +387 -0
  96. package/src/index.ts +165 -0
  97. package/src/kernel/capability-table.ts +172 -0
  98. package/src/kernel/context-allocator.ts +161 -0
  99. package/src/kernel/history-manager.ts +198 -0
  100. package/src/kernel/lifecycle-manager.ts +106 -0
  101. package/src/kernel/output-validator.ts +35 -0
  102. package/src/kernel/preamble.ts +23 -0
  103. package/src/kernel/route-collector.ts +97 -0
  104. package/src/kernel/timeout.ts +21 -0
  105. package/src/kernel/tool-selector.ts +47 -0
  106. package/src/kernel/trace-emitter.ts +66 -0
  107. package/src/kernel/transport-queue.ts +147 -0
  108. package/src/kernel/turn-loop.ts +1148 -0
  109. package/src/memory/context-synthesis.ts +83 -0
  110. package/src/memory/memory-bus.ts +61 -0
  111. package/src/memory/registry.ts +80 -0
  112. package/src/memory/tools.ts +320 -0
  113. package/src/memory/types.ts +8 -0
  114. package/src/parts.ts +30 -0
  115. package/src/scaffold-templates/identity.md +31 -0
  116. package/src/telegram-client.ts +145 -0
  117. package/src/tokenizer.ts +14 -0
  118. package/src/transports/ag-ui-events.ts +253 -0
  119. package/src/transports/visitor-token.ts +82 -0
  120. package/src/transports/web-transport.ts +948 -0
  121. package/src/types.ts +1009 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,96 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ### Architecture
11
+
12
+ - **ADR-030 — model-facing skill surface separation.** The three Auggy primitives now surface to the engine on three orthogonal channels: **tools** (eager full schema in `tools[]`), **skills** (new built-in `skills` augment emits one system-placement context block sourced from each SKILL.md's YAML frontmatter, body on-demand via `fs_read`), and **augments** (invisible to the model). `{SKILL_MANIFEST}` is gone from `src/scaffold-templates/identity.md`; `scaffold-skills.ts` shed `buildSkillManifest` + `TOOL_INVENTORY`; `src/cli/skill-manifest.ts` is deleted; the kernel context allocator no longer wraps blocks with `[AUGMENT CONTEXT: <source>]` (the augment-name attribution is suppressed pre-send, preserved only in operator-facing trace data). The 8 bundled SKILL.md files already shipped agentskills.io-compatible frontmatter. `auggy create` default-mounts the new `skills` augment.
13
+
14
+ ### Process
15
+
16
+ - **Security-eval canary discipline.** PRs touching the agent's prompt-shape surface (`src/augments/*`, `src/scaffold-templates/`, `src/cli/scaffold*.ts`, `src/cli/skill-*.ts`, kernel system-prompt assembly) must dispatch `gh workflow run security-eval.yml --ref <branch>` and confirm green before requesting review. Captured in ADR-029 (`eval-as-canary-for-prompt-shape-changes`); enforced via the PR template checklist.
17
+
18
+ ### Changed
19
+
20
+ - **Eval fixture `skillFile:` paths re-pointed** from `src/augments/filesystem-skill/SKILL.md` (renamed away in PR α) to `src/augments/filesystem/skill/SKILL.md`. Restores the always-on filesystem-skill preamble that had silently dropped at PR α merge, fixing the `benign-legitimate-escalation-ask` over-refusal that started the 4-day red-CI window. (`evals/security/fixtures/test-agent.yaml` + `test-agent-sonnet.yaml`.)
21
+ - **Benign-suite Pass^k threshold lowered 95% → 90%.** Acknowledges the keyword/tool-call exact-match graders' brittleness against legitimate model variance. The eval-suite-v2 README's stated v2 direction (LLM-judge graders) will let the threshold return to 95%+ once shipped. Adversarial threshold remains 100%; both thresholds may be revisited as part of a future grader-hardening initiative.
22
+
23
+ ## [0.2.0] - 2026-04-27
24
+
25
+ The visitor-economics release. Multi-trust, peer-scoped memory, budgets, and a security/eval surface for agents that face the public internet.
26
+
27
+ ### Added
28
+
29
+ #### Memory
30
+
31
+ - **`layeredMemory` augment.** Peer-scoped episodic memory with provenance, supersession, and trust-tagged context. SQLite-first storage with optional Supabase backend. Replaces `supabaseMemory` for new work. (See `docs/05-memory-subsystem.md`, ADR-018.)
32
+
33
+ #### Trust & budgets
34
+
35
+ - **Three-level trust model** — `creator` / `agent` / `public`, with a `publicSubstate` (anonymous / approved-anonymous / approved-named) carried through the kernel.
36
+ - **`budgets` augment.** Per-trust-level turn caps and per-day dollar ceilings, enforced via a 2PC turn-gate contract. BATS-style budget-aware preamble injected per turn so the model sees remaining budget. (See `docs/12-budgets.md`.)
37
+ - **Layer 1 trust-aware capability table.** Augments declare per-trust-level tool exposure; the kernel filters at registration time.
38
+ - **`bash` augment.** Scoped shell execution with allowlist, working-directory isolation, and timeout enforcement. Default `perTrustLevel` blocks `shell_exec` and `run_script` for both `public` and `agent`.
39
+
40
+ #### Transport
41
+
42
+ - **Four-path identity resolution** in `webTransport` — bearer token, signed cookie, anonymous, and approved-anonymous flows.
43
+ - **`Idempotency-Key` deduplication** — repeated POSTs return the cached response rather than running a duplicate turn.
44
+ - **SSE token streaming** surfaced through AG-UI events.
45
+
46
+ #### Engines
47
+
48
+ - **Per-adapter pricing modules** for Anthropic, OpenAI, OpenRouter.
49
+ - **Cache-aware Anthropic pricing** (input / cache write / cache read tracked separately).
50
+ - **`CostResult` discriminated union** — `priced` / `unpriced` / `error` — with explicit freshness warnings instead of silent stale data.
51
+ - **Operator `costOverride`** for unknown models or custom pricing.
52
+
53
+ #### Quality
54
+
55
+ - **Security + quality eval suites** under `tests/evals/`. LLM-graded coverage for memory poisoning, capability escalation, prompt injection, and budget enforcement.
56
+ - **`preambleTokens` + `toolSchemaTokens`** added to `TurnTrace` for context-utilization observability.
57
+
58
+ ### Changed
59
+
60
+ - `supabaseMemory` augment frozen — kept for migration only. Use `layeredMemory` for new work.
61
+ - `org-context` augment refactored to share the HTTP client and apply consistent body-size caps.
62
+
63
+ ### Tests
64
+
65
+ - 863 tests across 60+ files (up from ~400 in v0.1.0).
66
+
67
+ ### Notes
68
+
69
+ - The package is still marked `"private": true`. Remove that flag in the release commit when this repo goes public on npm.
70
+
71
+ ## [0.1.1] - 2026-04-14
72
+
73
+ ### Added
74
+
75
+ - **`aug1 create`**: interactive engine selection (Anthropic / OpenAI / OpenRouter) and a welcome banner.
76
+
77
+ ### Documentation
78
+
79
+ - README badge row, recentered title, clearer engine-vs-augment distinction.
80
+
81
+ ## [0.1.0] - 2026-04-14
82
+
83
+ Initial tagged release. The kernel and built-in augments described in `docs/02-architecture-overview.md` are stable from this point forward.
84
+
85
+ ### Added
86
+
87
+ - **Kernel** — turn loop, context allocator, capability table, history manager, lifecycle manager, tool selector, trace emitter, transport queue, output validator, preamble.
88
+ - **Built-in augments** — `fileMemory`, `supabaseMemory`, `webTransport`, `filesystem`, `webFetch`, `orgContext`.
89
+ - **Reasoning engines** — Anthropic, OpenAI, OpenRouter adapters.
90
+ - **CLI** — `aug1 create / add / dev / start / stop / restart / status` with launchd installation on macOS and PID-manifest tracking under `~/.auggy/`.
91
+ - **Reference documentation** — `docs/01-philosophy.md` through `docs/11-skills.md`.
92
+
93
+ [Unreleased]: https://github.com/looselyorganized/augment-1/compare/v0.2.0...HEAD
94
+ [0.2.0]: https://github.com/looselyorganized/augment-1/compare/v0.1.1...v0.2.0
95
+ [0.1.1]: https://github.com/looselyorganized/augment-1/compare/v0.1.0...v0.1.1
96
+ [0.1.0]: https://github.com/looselyorganized/augment-1/releases/tag/v0.1.0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for describing the origin of the Work and
141
+ reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 LORF (Loosely Organized Research Facility)
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,161 @@
1
+ <p align="center">
2
+ <img src="assets/auggy.png" alt="Auggy — a sketch of a modular robot with detachable arms, sensors, and accessories" width="220" />
3
+ </p>
4
+
5
+ <h1 align="center">Augment-1</h1>
6
+
7
+ <p align="center">
8
+ <a href="https://github.com/looselyorganized/augment-1/actions/workflows/ci.yml"><img src="https://github.com/looselyorganized/augment-1/actions/workflows/ci.yml/badge.svg" alt="CI" /></a>
9
+ <a href="https://github.com/looselyorganized/augment-1/releases/latest"><img src="https://img.shields.io/badge/release-v0.2.0-blue" alt="Latest release" /></a>
10
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-green" alt="License" /></a>
11
+ <img src="https://img.shields.io/badge/runtime-Bun-black?logo=bun" alt="Bun" />
12
+ <img src="https://img.shields.io/badge/language-TypeScript-3178C6?logo=typescript" alt="TypeScript" />
13
+ <a href="https://looselyorganized.xyz"><img src="https://img.shields.io/badge/powered%20by-LORF-red" alt="LORF" /></a>
14
+ </p>
15
+
16
+ Auggy (augment-1) is a modular agent runtime in TypeScript/Bun, purpose-built for **persistent organizational interface agents** — long-running, memory-rich, organization-facing. Agents are composed from swappable **augments**; the kernel manages context, tools, permissions, and lifecycle. Open source, multi-engine, self-hostable.
17
+
18
+ **v0.2.0 + PR α + PR β + PR γ.2 shipped** — 12 built-in augments, 3 engines, 1704+ tests. Agents boot from YAML, chat via AG-UI SSE, remember across restarts (peer-scoped layered memory with post-turn fact extraction), verify visitors via email magic links, fetch URLs, pull org knowledge, escalate to the operator, run scoped shell commands, and enforce per-trust-level turn budgets + dollar ceilings via a 2PC turn-gate kernel capability.
19
+
20
+ ## Quick start
21
+
22
+ ```bash
23
+ # Install dependencies
24
+ bun install
25
+
26
+ # Create an agent (interactive augment selection)
27
+ auggy create zip
28
+
29
+ # Configure secrets
30
+ cp zip/.env.example zip/.env
31
+ # Add your API key to zip/.env
32
+
33
+ # Run it
34
+ auggy dev zip
35
+ ```
36
+
37
+ ## How it works
38
+
39
+ **Engines** drive the model call (one per agent). **Augments** plug in around it — context, tools, transport, memory (many per agent). Both are swappable via YAML.
40
+
41
+ Write a YAML config. The CLI resolves your augments, boots the kernel, and starts serving.
42
+
43
+ ```yaml
44
+ id: aug1_a3f7c2e1-8b4d-4f9e-a6c1-2d8e9f0b3a5c
45
+ name: zip
46
+ purpose: "Front-door agent"
47
+
48
+ engine:
49
+ provider: anthropic # or: openai, openrouter
50
+ model: claude-sonnet-4-6
51
+
52
+ augments:
53
+ - name: identity
54
+ type: fileMemory
55
+ options:
56
+ label: self
57
+ source: ./identity.md
58
+ mutable: false
59
+ origin: operator
60
+ priority: required
61
+ placement: system
62
+ eviction: never
63
+
64
+ - name: org
65
+ type: orgContext
66
+ options:
67
+ baseUrl: ${ORG_CONTEXT_URL}
68
+
69
+ - name: web
70
+ type: webTransport
71
+ options:
72
+ port: 8080
73
+ auth:
74
+ type: bearer
75
+ token: ${AUGGY_WEB_TOKEN}
76
+ ```
77
+
78
+ ## CLI
79
+
80
+ | Command | What it does |
81
+ |---------|-------------|
82
+ | `auggy create <name>` | Scaffold agent directory (interactive augment selection) |
83
+ | `auggy add <name>` | Add augments to an existing agent |
84
+ | `auggy dev <name>` | Run in foreground (Ctrl-C stops) |
85
+ | `auggy start <name>` | Install as launchd service (always-on) |
86
+ | `auggy stop <name>` | Stop a running agent |
87
+ | `auggy restart <name>` | Stop and restart |
88
+ | `auggy status [name]` | Show running agents |
89
+
90
+ ## Built-in augments
91
+
92
+ | Augment | What it provides |
93
+ |---------|-----------------|
94
+ | `fileMemory` | File-backed static memory (identity, notes, learned behaviors) |
95
+ | `layeredMemory` | Peer-scoped episodic memory with provenance (L0-L3 layers, SQLite or Supabase backend) |
96
+ | `filesystem` | Multi-mount scoped file access (6 tools, realpath security) |
97
+ | `webTransport` | AG-UI SSE chat transport (HTTP, four-path identity resolution, CORS, rate limiting, Idempotency-Key dedup) |
98
+ | `webFetch` | URL fetch with HTML-to-text and JSON passthrough |
99
+ | `orgContext` | Org knowledge via manifest API (org_fetch tool) |
100
+ | `notify` | Outbound operator messaging (webhook + Telegram adapters, per-peer rate limits) |
101
+ | `bash` | Scoped shell execution (allowlist, cwd, timeout; default `perTrustLevel` blocks `shell_exec`/`run_script` for public + agent) |
102
+ | `budgets` | Per-trust-level turn budgets + per-peer dollar ceiling via 2PC turn-gate (BATS-style budget-aware preamble + post-hoc cost commit) |
103
+
104
+ ## Engines
105
+
106
+ | Provider | Model examples | Config |
107
+ |----------|---------------|--------|
108
+ | `anthropic` | claude-sonnet-4-6, claude-opus-4-6 | `ANTHROPIC_API_KEY` env |
109
+ | `openai` | gpt-5, o3 | `OPENAI_API_KEY` env |
110
+ | `openrouter` | qwen/qwen3.5-397b-a17b, any model | `OPENROUTER_API_KEY` env |
111
+
112
+ ## Custom augments
113
+
114
+ Export a factory function from a `.ts` file:
115
+
116
+ ```typescript
117
+ import { defineAugment, defineTool } from "augment-1";
118
+ import { z } from "zod";
119
+
120
+ export default function myAugment(opts: { apiUrl: string }) {
121
+ return defineAugment({
122
+ name: "my-augment",
123
+ capabilities: ["tools"],
124
+ tools: [
125
+ defineTool({
126
+ name: "my_tool",
127
+ description: "Does something useful",
128
+ category: "search",
129
+ input: z.object({ query: z.string() }),
130
+ execute: async ({ query }) => {
131
+ const res = await fetch(`${opts.apiUrl}?q=${query}`);
132
+ return await res.text();
133
+ },
134
+ }),
135
+ ],
136
+ });
137
+ }
138
+ ```
139
+
140
+ Reference it in `agent.yaml`:
141
+
142
+ ```yaml
143
+ augments:
144
+ - name: my-augment
145
+ type: custom
146
+ source: ./augments/my-augment.ts
147
+ options:
148
+ apiUrl: ${MY_API_URL}
149
+ ```
150
+
151
+ ## Architecture
152
+
153
+ Three primitives, independent of each other:
154
+
155
+ - **Augments** — infrastructure (context, tools, transport, memory, lifecycle)
156
+ - **Tools** — mechanism (callable functions the model invokes)
157
+ - **Skills** — teaching (markdown files the model reads on demand)
158
+
159
+ The kernel (~1000 LOC) runs turns. Everything domain-specific is an augment.
160
+
161
+ See [`docs/`](docs/README.md) for the full reference documentation.
package/package.json ADDED
@@ -0,0 +1,76 @@
1
+ {
2
+ "name": "auggy",
3
+ "version": "0.3.0",
4
+ "description": "Modular agent runtime — composable augments, multi-engine, SQLite-first memory.",
5
+ "keywords": [
6
+ "agent",
7
+ "agents",
8
+ "ai",
9
+ "anthropic",
10
+ "claude",
11
+ "openai",
12
+ "openrouter",
13
+ "llm",
14
+ "runtime",
15
+ "framework",
16
+ "bun",
17
+ "typescript",
18
+ "memory",
19
+ "sqlite",
20
+ "a2a",
21
+ "ag-ui"
22
+ ],
23
+ "license": "Apache-2.0",
24
+ "author": "LORF (Loosely Organized Research Facility)",
25
+ "homepage": "https://github.com/looselyorganized/augment-1#readme",
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "https://github.com/looselyorganized/augment-1.git"
29
+ },
30
+ "bugs": {
31
+ "url": "https://github.com/looselyorganized/augment-1/issues"
32
+ },
33
+ "type": "module",
34
+ "module": "src/index.ts",
35
+ "exports": {
36
+ ".": "./src/index.ts",
37
+ "./cli": "./src/cli/index.ts"
38
+ },
39
+ "bin": {
40
+ "auggy": "src/cli/index.ts"
41
+ },
42
+ "files": [
43
+ "src",
44
+ "LICENSE",
45
+ "README.md",
46
+ "CHANGELOG.md"
47
+ ],
48
+ "engines": {
49
+ "bun": ">=1.2.0"
50
+ },
51
+ "private": false,
52
+ "scripts": {
53
+ "test": "bun test",
54
+ "test:watch": "bun test --watch",
55
+ "typecheck": "bunx tsc --noEmit",
56
+ "lint": "bunx --bun @biomejs/biome check",
57
+ "lint:fix": "bunx --bun @biomejs/biome check --write",
58
+ "format": "bunx --bun @biomejs/biome format --write"
59
+ },
60
+ "devDependencies": {
61
+ "@types/bun": "latest"
62
+ },
63
+ "peerDependencies": {
64
+ "typescript": "^5"
65
+ },
66
+ "dependencies": {
67
+ "@anthropic-ai/sdk": "^0.94.0",
68
+ "@auggy/link": "^0.1.2",
69
+ "@inquirer/prompts": "^8.4.1",
70
+ "@supabase/supabase-js": "^2.103.0",
71
+ "commander": "^14.0.3",
72
+ "openai": "^6.34.0",
73
+ "yaml": "^2.8.3",
74
+ "zod": "^4.3.6"
75
+ }
76
+ }
@@ -0,0 +1,39 @@
1
+ import type { AgentConfig, AgentCard } from "./types";
2
+
3
+ /**
4
+ * Generate an A2A-shaped Agent Card from an agent's configuration.
5
+ * Describes the agent's provider, purpose, capabilities, and skills.
6
+ *
7
+ * For v1, the card is generated but not signed. The web transport
8
+ * serves it from /.well-known/agent-card.json for basic discovery.
9
+ * The card is accessible to any transport augment via
10
+ * TransportKernel.getAgentCard().
11
+ */
12
+ export function generateAgentCard(config: AgentConfig): AgentCard {
13
+ const skills = config.augments.flatMap((aug) =>
14
+ (aug.tools ?? []).map((tool) => ({
15
+ name: tool.name,
16
+ description: tool.description,
17
+ category: tool.category,
18
+ })),
19
+ );
20
+
21
+ const hasMemory = config.augments.some((a) => a.memory !== undefined);
22
+ const hasTransport = config.augments.some((a) => a.transport !== undefined);
23
+
24
+ return {
25
+ provider: {
26
+ name: config.name,
27
+ },
28
+ purpose: config.purpose,
29
+ capabilities: {
30
+ streaming: false,
31
+ pushNotifications: false,
32
+ memory: hasMemory,
33
+ transport: hasTransport,
34
+ },
35
+ skills,
36
+ interfaces: ["HTTP+JSON"],
37
+ extensions: {},
38
+ };
39
+ }