freeturtle 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 (135) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +392 -0
  3. package/dist/bin/freeturtle.d.ts +2 -0
  4. package/dist/bin/freeturtle.js +119 -0
  5. package/dist/bin/freeturtle.js.map +1 -0
  6. package/dist/src/approval.d.ts +38 -0
  7. package/dist/src/approval.js +140 -0
  8. package/dist/src/approval.js.map +1 -0
  9. package/dist/src/audit.d.ts +33 -0
  10. package/dist/src/audit.js +36 -0
  11. package/dist/src/audit.js.map +1 -0
  12. package/dist/src/channels/telegram.d.ts +10 -0
  13. package/dist/src/channels/telegram.js +41 -0
  14. package/dist/src/channels/telegram.js.map +1 -0
  15. package/dist/src/channels/terminal.d.ts +9 -0
  16. package/dist/src/channels/terminal.js +52 -0
  17. package/dist/src/channels/terminal.js.map +1 -0
  18. package/dist/src/channels/types.d.ts +6 -0
  19. package/dist/src/channels/types.js +2 -0
  20. package/dist/src/channels/types.js.map +1 -0
  21. package/dist/src/cli/approvals.d.ts +3 -0
  22. package/dist/src/cli/approvals.js +33 -0
  23. package/dist/src/cli/approvals.js.map +1 -0
  24. package/dist/src/cli/connect-farcaster.d.ts +5 -0
  25. package/dist/src/cli/connect-farcaster.js +265 -0
  26. package/dist/src/cli/connect-farcaster.js.map +1 -0
  27. package/dist/src/cli/connection-tests.d.ts +16 -0
  28. package/dist/src/cli/connection-tests.js +65 -0
  29. package/dist/src/cli/connection-tests.js.map +1 -0
  30. package/dist/src/cli/init.d.ts +1 -0
  31. package/dist/src/cli/init.js +729 -0
  32. package/dist/src/cli/init.js.map +1 -0
  33. package/dist/src/cli/install-service.d.ts +1 -0
  34. package/dist/src/cli/install-service.js +57 -0
  35. package/dist/src/cli/install-service.js.map +1 -0
  36. package/dist/src/cli/intake.d.ts +23 -0
  37. package/dist/src/cli/intake.js +68 -0
  38. package/dist/src/cli/intake.js.map +1 -0
  39. package/dist/src/cli/send.d.ts +1 -0
  40. package/dist/src/cli/send.js +16 -0
  41. package/dist/src/cli/send.js.map +1 -0
  42. package/dist/src/cli/start.d.ts +3 -0
  43. package/dist/src/cli/start.js +25 -0
  44. package/dist/src/cli/start.js.map +1 -0
  45. package/dist/src/cli/status.d.ts +2 -0
  46. package/dist/src/cli/status.js +54 -0
  47. package/dist/src/cli/status.js.map +1 -0
  48. package/dist/src/cli/update.d.ts +1 -0
  49. package/dist/src/cli/update.js +39 -0
  50. package/dist/src/cli/update.js.map +1 -0
  51. package/dist/src/config.d.ts +31 -0
  52. package/dist/src/config.js +93 -0
  53. package/dist/src/config.js.map +1 -0
  54. package/dist/src/daemon.d.ts +18 -0
  55. package/dist/src/daemon.js +272 -0
  56. package/dist/src/daemon.js.map +1 -0
  57. package/dist/src/heartbeat.d.ts +17 -0
  58. package/dist/src/heartbeat.js +60 -0
  59. package/dist/src/heartbeat.js.map +1 -0
  60. package/dist/src/llm.d.ts +29 -0
  61. package/dist/src/llm.js +225 -0
  62. package/dist/src/llm.js.map +1 -0
  63. package/dist/src/logger.d.ts +8 -0
  64. package/dist/src/logger.js +45 -0
  65. package/dist/src/logger.js.map +1 -0
  66. package/dist/src/memory.d.ts +3 -0
  67. package/dist/src/memory.js +36 -0
  68. package/dist/src/memory.js.map +1 -0
  69. package/dist/src/modules/database/client.d.ts +18 -0
  70. package/dist/src/modules/database/client.js +50 -0
  71. package/dist/src/modules/database/client.js.map +1 -0
  72. package/dist/src/modules/database/index.d.ts +9 -0
  73. package/dist/src/modules/database/index.js +32 -0
  74. package/dist/src/modules/database/index.js.map +1 -0
  75. package/dist/src/modules/database/tools.d.ts +2 -0
  76. package/dist/src/modules/database/tools.js +26 -0
  77. package/dist/src/modules/database/tools.js.map +1 -0
  78. package/dist/src/modules/farcaster/client.d.ts +43 -0
  79. package/dist/src/modules/farcaster/client.js +87 -0
  80. package/dist/src/modules/farcaster/client.js.map +1 -0
  81. package/dist/src/modules/farcaster/index.d.ts +14 -0
  82. package/dist/src/modules/farcaster/index.js +71 -0
  83. package/dist/src/modules/farcaster/index.js.map +1 -0
  84. package/dist/src/modules/farcaster/tools.d.ts +2 -0
  85. package/dist/src/modules/farcaster/tools.js +90 -0
  86. package/dist/src/modules/farcaster/tools.js.map +1 -0
  87. package/dist/src/modules/github/client.d.ts +21 -0
  88. package/dist/src/modules/github/client.js +80 -0
  89. package/dist/src/modules/github/client.js.map +1 -0
  90. package/dist/src/modules/github/index.d.ts +13 -0
  91. package/dist/src/modules/github/index.js +45 -0
  92. package/dist/src/modules/github/index.js.map +1 -0
  93. package/dist/src/modules/github/tools.d.ts +2 -0
  94. package/dist/src/modules/github/tools.js +74 -0
  95. package/dist/src/modules/github/tools.js.map +1 -0
  96. package/dist/src/modules/loader.d.ts +5 -0
  97. package/dist/src/modules/loader.js +35 -0
  98. package/dist/src/modules/loader.js.map +1 -0
  99. package/dist/src/modules/onchain/client.d.ts +8 -0
  100. package/dist/src/modules/onchain/client.js +46 -0
  101. package/dist/src/modules/onchain/client.js.map +1 -0
  102. package/dist/src/modules/onchain/index.d.ts +13 -0
  103. package/dist/src/modules/onchain/index.js +40 -0
  104. package/dist/src/modules/onchain/index.js.map +1 -0
  105. package/dist/src/modules/onchain/tools.d.ts +2 -0
  106. package/dist/src/modules/onchain/tools.js +61 -0
  107. package/dist/src/modules/onchain/tools.js.map +1 -0
  108. package/dist/src/modules/types.d.ts +24 -0
  109. package/dist/src/modules/types.js +2 -0
  110. package/dist/src/modules/types.js.map +1 -0
  111. package/dist/src/modules/xmtp/index.d.ts +8 -0
  112. package/dist/src/modules/xmtp/index.js +14 -0
  113. package/dist/src/modules/xmtp/index.js.map +1 -0
  114. package/dist/src/policy.d.ts +45 -0
  115. package/dist/src/policy.js +164 -0
  116. package/dist/src/policy.js.map +1 -0
  117. package/dist/src/redaction.d.ts +13 -0
  118. package/dist/src/redaction.js +75 -0
  119. package/dist/src/redaction.js.map +1 -0
  120. package/dist/src/reliability.d.ts +16 -0
  121. package/dist/src/reliability.js +124 -0
  122. package/dist/src/reliability.js.map +1 -0
  123. package/dist/src/runner.d.ts +37 -0
  124. package/dist/src/runner.js +257 -0
  125. package/dist/src/runner.js.map +1 -0
  126. package/dist/src/scheduler.d.ts +22 -0
  127. package/dist/src/scheduler.js +61 -0
  128. package/dist/src/scheduler.js.map +1 -0
  129. package/dist/src/setup.d.ts +8 -0
  130. package/dist/src/setup.js +179 -0
  131. package/dist/src/setup.js.map +1 -0
  132. package/dist/src/soul.d.ts +1 -0
  133. package/dist/src/soul.js +15 -0
  134. package/dist/src/soul.js.map +1 -0
  135. package/package.json +56 -0
package/LICENSE ADDED
@@ -0,0 +1,190 @@
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 the 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 the 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 any 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 reasonable and customary use in describing the
141
+ origin of the Work and 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
+ Copyright 2025 FreeTurtle Contributors
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,392 @@
1
+ # FreeTurtle
2
+
3
+ An open-source framework for deploying autonomous AI CEOs that run onchain businesses.
4
+
5
+ ## Quick Start
6
+
7
+ ```bash
8
+ pnpm install -g freeturtle
9
+ freeturtle init
10
+ freeturtle start
11
+ ```
12
+
13
+ The setup wizard walks you through everything: naming your AI CEO, connecting Farcaster, Telegram, GitHub, a database, and onchain data.
14
+
15
+ ## What It Does
16
+
17
+ FreeTurtle gives you an autonomous AI CEO that:
18
+
19
+ - **Posts to Farcaster** on a schedule (or on demand)
20
+ - **Chats with you** via Terminal or Telegram
21
+ - **Writes strategy briefs** weekly
22
+ - **Queries databases** (read-only Postgres)
23
+ - **Creates GitHub issues, writes code and submits pull requests**
24
+ - **Reads onchain data** (balances, contracts, transactions on Base)
25
+ - **Stores identity and memory** as readable Markdown and JSON files
26
+
27
+ ## How It Works
28
+
29
+ FreeTurtle is a Node.js daemon that mostly sleeps and wakes up when:
30
+
31
+ 1. A **cron timer** fires (e.g. "post to Farcaster every 8 hours")
32
+ 2. A **heartbeat** fires (e.g. "check if anything needs attention every 30 minutes")
33
+ 3. The **founder sends a message** via Terminal or Telegram
34
+
35
+ All three route to the same **task runner**, which:
36
+
37
+ 1. Loads `soul.md` (the CEO's identity and voice)
38
+ 2. Loads recent memory (posting log, post queue)
39
+ 3. Collects tools from active modules
40
+ 4. Calls the LLM (Claude or OpenAI)
41
+ 5. Checks policy allowlists and approval requirements before executing tools
42
+ 6. Handles tool calls in a loop (with automatic retry on transient failures)
43
+ 7. Logs every tool call to the audit trail
44
+ 8. Persists results to workspace files
45
+
46
+ ```
47
+ ┌───────────────────────────────────────────────┐
48
+ │ FreeTurtle Daemon │
49
+ │ │
50
+ │ ┌──────────┐ ┌──────────┐ ┌─────────────┐ │
51
+ │ │ Scheduler │ │ Channels │ │ IPC │ │
52
+ │ │ (cron) │ │ Terminal │ │ send/approve│ │
53
+ │ │ │ │ Telegram │ │ /reject │ │
54
+ │ └─────┬─────┘ └────┬─────┘ └──────┬──────┘ │
55
+ │ │ │ │ │
56
+ │ └──────┬──────┘───────────────┘ │
57
+ │ ▼ │
58
+ │ ┌──────────────┐ │
59
+ │ │ Task Runner │ │
60
+ │ │ soul + memory│ │
61
+ │ │ + LLM + tools│ │
62
+ │ └──────┬───────┘ │
63
+ │ ▼ │
64
+ │ ┌─────────────────────────────────────┐ │
65
+ │ │ Policy ─► Approval ─► Retry │ │
66
+ │ │ allowlists founder gate backoff │ │
67
+ │ └──────────────────┬──────────────────┘ │
68
+ │ ▼ │
69
+ │ ┌─────────────────────────────────────┐ │
70
+ │ │ Modules │ │
71
+ │ │ Farcaster │ Database│ GitHub│Onchain│ │
72
+ │ └─────────────────────────────────────┘ │
73
+ │ │ │
74
+ │ ┌─────▼─────┐ │
75
+ │ │ Audit Log │ │
76
+ │ └───────────┘ │
77
+ └───────────────────────────────────────────────┘
78
+ ```
79
+
80
+ ## Modules
81
+
82
+ ### Farcaster
83
+
84
+ Post and read casts via the Neynar API.
85
+
86
+ | Tool | Description |
87
+ |------|-------------|
88
+ | `post_cast` | Post a cast, optionally to a channel with embeds |
89
+ | `read_channel` | Read recent casts from a channel |
90
+ | `read_mentions` | Read notifications and mentions |
91
+ | `reply_to_cast` | Reply to a cast by hash |
92
+ | `delete_cast` | Delete a cast (requires founder approval) |
93
+
94
+ **Env:** `NEYNAR_API_KEY`, `FARCASTER_SIGNER_UUID`, `FARCASTER_FID`
95
+
96
+ ### Database
97
+
98
+ Query a PostgreSQL database (read-only).
99
+
100
+ | Tool | Description |
101
+ |------|-------------|
102
+ | `query_database` | Execute a read-only SQL query (SELECT only) |
103
+ | `list_tables` | List all tables with column names and types |
104
+
105
+ **Env:** `DATABASE_URL`
106
+
107
+ ### GitHub
108
+
109
+ Create issues, list issues, and commit files.
110
+
111
+ | Tool | Description |
112
+ |------|-------------|
113
+ | `create_issue` | Create an issue on a repo |
114
+ | `list_issues` | List issues for a repo |
115
+ | `commit_file` | Create or update a file via commit (main branch requires approval) |
116
+
117
+ **Env:** `GITHUB_TOKEN`
118
+
119
+ ### Onchain
120
+
121
+ Read smart contracts, balances, and transactions on Base.
122
+
123
+ | Tool | Description |
124
+ |------|-------------|
125
+ | `read_contract` | Read data from a smart contract |
126
+ | `get_balance` | Get ETH balance of an address |
127
+ | `get_transactions` | Get recent transactions (requires BaseScan key) |
128
+
129
+ **Env:** `RPC_URL`, `BASESCAN_API_KEY` (optional)
130
+
131
+ ## Configuration
132
+
133
+ FreeTurtle stores everything in `~/.freeturtle/`:
134
+
135
+ ```
136
+ ~/.freeturtle/
137
+ ├── soul.md # CEO identity and voice
138
+ ├── config.md # Modules, cron schedules, LLM settings
139
+ ├── .env # API keys and secrets
140
+ └── workspace/
141
+ ├── HEARTBEAT.md # Heartbeat checklist
142
+ ├── memory/
143
+ │ ├── posting-log.json
144
+ │ ├── post-queue.json
145
+ │ └── session-notes/
146
+ ├── audit/ # Daily audit logs
147
+ ├── approvals/ # Pending/resolved approval requests
148
+ └── strategy/
149
+ ```
150
+
151
+ ### soul.md
152
+
153
+ Defines who your CEO is — name, voice, knowledge, goals, and boundaries. Written in plain Markdown. Edit it anytime.
154
+
155
+ ### config.md
156
+
157
+ Controls the daemon. Markdown format:
158
+
159
+ ```markdown
160
+ ## LLM
161
+ - provider: claude_api
162
+ - model: claude-sonnet-4-5-20250514
163
+ - max_tokens: 4096
164
+
165
+ ## Cron
166
+ ### post
167
+ - schedule: 0 */8 * * *
168
+ - prompt: Check for queued posts. If there's something worth sharing, share it.
169
+
170
+ ### strategy
171
+ - schedule: 0 4 * * 0
172
+ - prompt: Analyze posting history and engagement. Write a strategy brief.
173
+ - output: strategy/{{date}}.md
174
+
175
+ ## Modules
176
+ ### farcaster
177
+ - enabled: true
178
+
179
+ ### database
180
+ - enabled: true
181
+
182
+ ## Policy
183
+ ### github
184
+ - approval_required_branches: main
185
+
186
+ ### approvals
187
+ - timeout_seconds: 300
188
+ - fail_mode: deny
189
+ ```
190
+
191
+ The setup wizard (`freeturtle setup`) supports five LLM providers: Claude Pro/Max (subscription), ChatGPT Plus/Pro (subscription), Anthropic API, OpenAI API, and OpenRouter.
192
+
193
+ ### .env
194
+
195
+ API keys. Generated by `freeturtle init`. Never committed to git.
196
+
197
+ ```
198
+ ANTHROPIC_API_KEY=sk-...
199
+ NEYNAR_API_KEY=...
200
+ FARCASTER_SIGNER_UUID=...
201
+ FARCASTER_FID=...
202
+ TELEGRAM_BOT_TOKEN=...
203
+ TELEGRAM_OWNER_ID=...
204
+ GITHUB_TOKEN=...
205
+ DATABASE_URL=postgres://...
206
+ RPC_URL=https://mainnet.base.org
207
+ ```
208
+
209
+ ## CLI Commands
210
+
211
+ ```bash
212
+ freeturtle init # Set up a new AI CEO
213
+ freeturtle start # Start the daemon
214
+ freeturtle start --chat # Start with interactive terminal chat
215
+ freeturtle status # Show daemon status
216
+ freeturtle send "message" # Send a message to the running CEO
217
+ freeturtle setup # Reconfigure LLM provider
218
+ freeturtle connect farcaster # Set up Farcaster signer
219
+ freeturtle approvals # List pending approval requests
220
+ freeturtle approve <id> # Approve a pending action
221
+ freeturtle reject <id> # Reject a pending action
222
+ freeturtle update # Update to the latest version
223
+ freeturtle install-service # Install as a systemd service (Linux)
224
+ ```
225
+
226
+ ## Hosting
227
+
228
+ We recommend [Oracle Cloud's free ARM instance](docs/oracle-cloud-setup.md) — 4 CPUs, 24 GB RAM, always free. The setup guide walks through account creation, instance setup, networking, and installing FreeTurtle as a system service.
229
+
230
+ ```bash
231
+ # On your server
232
+ pnpm install -g freeturtle
233
+ freeturtle init
234
+ freeturtle start
235
+ freeturtle install-service # auto-restart on reboot
236
+ ```
237
+
238
+ ## Before You Begin
239
+
240
+ **Create a separate account for your CEO.** Start with a Google account, then use it to sign up for:
241
+
242
+ - Farcaster (the account your CEO will post from)
243
+ - Neynar (API access for Farcaster)
244
+ - GitHub (if your CEO will manage repos)
245
+ - Any other services your CEO needs
246
+
247
+ The CEO is effectively a team member who needs its own accounts. Identity separation keeps things clean.
248
+
249
+ ## Policy & Approvals
250
+
251
+ FreeTurtle enforces per-module allowlists and requires founder approval for destructive actions.
252
+
253
+ ### Policy Config
254
+
255
+ Add a `## Policy` section to `config.md`:
256
+
257
+ ```markdown
258
+ ## Policy
259
+ ### github
260
+ - allowed_repos: myorg/myrepo, myorg/other-repo
261
+ - allowed_paths: strategy/, docs/
262
+ - approval_required_branches: main
263
+
264
+ ### farcaster
265
+ - allowed_channels: tortoise, music
266
+
267
+ ### onchain
268
+ - allowed_contracts: 0x1234...
269
+ - allowed_read_functions: balanceOf, totalSupply
270
+
271
+ ### approvals
272
+ - timeout_seconds: 300
273
+ - fail_mode: deny
274
+ ```
275
+
276
+ **Allowlist rules:**
277
+ - Not set → allow all (no restriction)
278
+ - Empty list → deny everything
279
+ - Populated list → only allow listed values
280
+
281
+ ### Approval Flow
282
+
283
+ Some actions require founder approval before execution:
284
+
285
+ - `delete_cast` — always requires approval
286
+ - `commit_file` to a protected branch (default: `main`) — requires approval
287
+
288
+ When approval is needed, FreeTurtle notifies you via Telegram/terminal with the approval ID. You can then:
289
+
290
+ ```bash
291
+ freeturtle approvals # See pending requests
292
+ freeturtle approve <id> # Allow the action
293
+ freeturtle reject <id> # Block the action
294
+ ```
295
+
296
+ If no decision is made within the timeout (default 5 minutes), the action is denied (configurable via `fail_mode`).
297
+
298
+ ### Audit Log
299
+
300
+ Every task run is logged to `workspace/audit/YYYY-MM-DD/{runId}.json` with:
301
+ - Tool calls made (with redacted inputs)
302
+ - Duration, retries, approval decisions
303
+ - Success/error status
304
+
305
+ ### Reliability
306
+
307
+ All external API calls (Neynar, GitHub, Postgres, BaseScan, RPC) are wrapped with:
308
+ - Automatic retry with exponential backoff + jitter
309
+ - Timeout protection (30s default)
310
+ - Smart error classification (retry on 429/5xx/network errors, fail fast on 4xx)
311
+
312
+ ## Safety Architecture
313
+
314
+ FreeTurtle is designed to be safe to run locally:
315
+
316
+ - **No shell execution** — the CEO cannot run arbitrary commands
317
+ - **Closed tool set** — only the tools defined by enabled modules are available
318
+ - **Policy allowlists** — per-module restrictions on repos, paths, channels, contracts
319
+ - **Founder approval** — destructive actions require explicit approval before execution
320
+ - **Read-only database** — all SQL runs in read-only transactions
321
+ - **Read-only onchain** — no wallet, no signing, no transactions
322
+ - **Founder-only chat** — Telegram only responds to the configured founder ID
323
+ - **Audit trail** — every tool call is logged with redacted inputs
324
+
325
+ ## Security Best Practices
326
+
327
+ ### Secrets
328
+
329
+ Your `.env` file contains API keys and tokens. FreeTurtle automatically sets it to `chmod 600` (read-only by the file owner) when writing it.
330
+
331
+ - **Never commit `.env` to git.** It's in `.gitignore` by default — don't override this.
332
+ - **Never paste secrets into AI coding tools.** Tools like Claude Code, Codex, Cursor, and Copilot may log or transmit your input. If an AI tool asks you to paste an API key, token, or recovery phrase into chat — don't. Enter secrets only through FreeTurtle's setup wizard, which writes directly to `.env` on your local machine.
333
+ - **Rotate keys if exposed.** If a secret is accidentally committed, posted, or shared, revoke it immediately and generate a new one. Treat every key as compromised the moment it leaves your machine.
334
+ - **Your Farcaster recovery phrase is the most sensitive secret.** It controls the entire account. FreeTurtle only uses it once during `connect farcaster` to sign a key request locally — it is never stored or transmitted.
335
+
336
+ ### SSH Keys
337
+
338
+ - Download your SSH private key when creating the instance — you can't retrieve it later
339
+ - Store it securely (e.g. `~/.ssh/`) with `chmod 400`
340
+ - Don't share it or commit it to any repository
341
+ - If lost, you lose access to the server
342
+
343
+ ### Git
344
+
345
+ - `.env` is in `.gitignore` — don't remove it
346
+ - If you version-control your `~/.freeturtle/` config, exclude `.env`
347
+ - If you accidentally commit secrets, rotate them immediately — git history is permanent
348
+
349
+ ### Firewall
350
+
351
+ - Oracle Cloud has two firewalls: the cloud security list AND the OS-level iptables
352
+ - Only open ports you actually need
353
+ - SSH (port 22) is open by default — everything else is closed
354
+ - See the [Oracle setup guide](docs/oracle-cloud-setup.md) for details
355
+
356
+ ### Cloud Provider Access
357
+
358
+ Your cloud provider (Oracle, AWS, GCP) has full access to the underlying infrastructure — they can technically read any file on your VM. This is true of all cloud computing and is covered by their terms of service. For most use cases this is fine. If this is unacceptable for your threat model, run FreeTurtle on hardware you physically control.
359
+
360
+ ## The Two-Turtle Vision (v0.2)
361
+
362
+ The current v0.1 is a single-process CEO. v0.2 will split it into two:
363
+
364
+ - **Inner Turtle** — has all the tools, writes to an outbox, never posts directly
365
+ - **Outer Turtle** — reads the outbox, reviews actions, executes approved ones
366
+
367
+ This creates **security by architecture, not by instruction**. The inner turtle can reason freely without risk because it literally cannot post or commit — only propose. The outer turtle is a simple approval layer.
368
+
369
+ This pattern, proven by tortOS, means you can give your CEO powerful tools without worrying about rogue actions.
370
+
371
+ ## tortOS — Proof of Concept
372
+
373
+ FreeTurtle generalizes the patterns proven by [tortOS](https://tortoise.xyz), which runs the Tortoise music platform on Farcaster/Base:
374
+
375
+ - Autonomous posting and community engagement
376
+ - Weekly strategy briefs
377
+ - Database queries for platform analytics
378
+ - GitHub issue management
379
+ - All controlled by a soul config and readable memory files
380
+
381
+ tortOS has been running autonomously for months. FreeTurtle packages those patterns into a framework anyone can use.
382
+
383
+ ## Roadmap
384
+
385
+ - **v0.1** — Single-process CEO (this release)
386
+ - **v0.2** — Two-turtle architecture (inner/outer split, outbox, approval queue)
387
+ - **v0.3** — XMTP integration (public-facing DMs)
388
+ - **Future** — Hosted dashboard, multi-CEO management
389
+
390
+ ## License
391
+
392
+ Apache 2.0 — see [LICENSE](./LICENSE).
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};