kynetic-agents 0.2.0__tar.gz

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 (55) hide show
  1. kynetic_agents-0.2.0/.gitignore +20 -0
  2. kynetic_agents-0.2.0/LICENSE +22 -0
  3. kynetic_agents-0.2.0/PKG-INFO +211 -0
  4. kynetic_agents-0.2.0/README.md +169 -0
  5. kynetic_agents-0.2.0/kynetic_agents/__init__.py +3 -0
  6. kynetic_agents-0.2.0/kynetic_agents/api.py +55 -0
  7. kynetic_agents-0.2.0/kynetic_agents/app.py +1103 -0
  8. kynetic_agents-0.2.0/kynetic_agents/builtin_skills/__init__.py +105 -0
  9. kynetic_agents-0.2.0/kynetic_agents/builtin_skills/five-whys/CHAINLINK_SETUP.md +117 -0
  10. kynetic_agents-0.2.0/kynetic_agents/builtin_skills/five-whys/CHAINLINK_USAGE.md +167 -0
  11. kynetic_agents-0.2.0/kynetic_agents/builtin_skills/five-whys/SKILL.md +247 -0
  12. kynetic_agents-0.2.0/kynetic_agents/builtin_skills/introspection/SKILL.md +175 -0
  13. kynetic_agents-0.2.0/kynetic_agents/builtin_skills/introspection/debugging-communication.md +222 -0
  14. kynetic_agents-0.2.0/kynetic_agents/builtin_skills/introspection/debugging-drift.md +164 -0
  15. kynetic_agents-0.2.0/kynetic_agents/builtin_skills/introspection/debugging-jobs.md +144 -0
  16. kynetic_agents-0.2.0/kynetic_agents/builtin_skills/long-running-jobs/SKILL.md +281 -0
  17. kynetic_agents-0.2.0/kynetic_agents/builtin_skills/memory/SKILL.md +58 -0
  18. kynetic_agents-0.2.0/kynetic_agents/builtin_skills/memory/maintenance.md +25 -0
  19. kynetic_agents-0.2.0/kynetic_agents/builtin_skills/mountaineering/SKILL.md +101 -0
  20. kynetic_agents-0.2.0/kynetic_agents/builtin_skills/mountaineering/climb-design.md +152 -0
  21. kynetic_agents-0.2.0/kynetic_agents/builtin_skills/mountaineering/climber.py +500 -0
  22. kynetic_agents-0.2.0/kynetic_agents/builtin_skills/mountaineering/harness.md +209 -0
  23. kynetic_agents-0.2.0/kynetic_agents/builtin_skills/mountaineering/laws.md +132 -0
  24. kynetic_agents-0.2.0/kynetic_agents/builtin_skills/mountaineering/philosophy.md +122 -0
  25. kynetic_agents-0.2.0/kynetic_agents/builtin_skills/mountaineering/preflight.md +115 -0
  26. kynetic_agents-0.2.0/kynetic_agents/builtin_skills/onboarding/SKILL.md +150 -0
  27. kynetic_agents-0.2.0/kynetic_agents/builtin_skills/onboarding/establishing-goals.md +109 -0
  28. kynetic_agents-0.2.0/kynetic_agents/builtin_skills/onboarding/establishing-identity.md +106 -0
  29. kynetic_agents-0.2.0/kynetic_agents/builtin_skills/onboarding/establishing-schedules.md +262 -0
  30. kynetic_agents-0.2.0/kynetic_agents/builtin_skills/onboarding/establishing-skills.md +76 -0
  31. kynetic_agents-0.2.0/kynetic_agents/builtin_skills/pollers/SKILL.md +163 -0
  32. kynetic_agents-0.2.0/kynetic_agents/builtin_skills/pollers/design-patterns.md +333 -0
  33. kynetic_agents-0.2.0/kynetic_agents/builtin_skills/pollers/security.md +111 -0
  34. kynetic_agents-0.2.0/kynetic_agents/builtin_skills/prediction-review/SKILL.md +186 -0
  35. kynetic_agents-0.2.0/kynetic_agents/builtin_skills/scripts/file_frequency_report.py +424 -0
  36. kynetic_agents-0.2.0/kynetic_agents/builtin_skills/scripts/memory_dashboard.py +266 -0
  37. kynetic_agents-0.2.0/kynetic_agents/builtin_skills/scripts/prediction_review_log.py +102 -0
  38. kynetic_agents-0.2.0/kynetic_agents/builtin_skills/skill-acquisition/SKILL.md +198 -0
  39. kynetic_agents-0.2.0/kynetic_agents/builtin_skills/skill-acquisition/clawhub-reference.md +198 -0
  40. kynetic_agents-0.2.0/kynetic_agents/builtin_skills/skill-acquisition/skillflag-reference.md +217 -0
  41. kynetic_agents-0.2.0/kynetic_agents/builtin_skills/skill-creator/SKILL.md +45 -0
  42. kynetic_agents-0.2.0/kynetic_agents/builtin_skills/view-attachment/SKILL.md +90 -0
  43. kynetic_agents-0.2.0/kynetic_agents/cli.py +854 -0
  44. kynetic_agents-0.2.0/kynetic_agents/config.py +490 -0
  45. kynetic_agents-0.2.0/kynetic_agents/discord.py +684 -0
  46. kynetic_agents-0.2.0/kynetic_agents/mcp_client.py +211 -0
  47. kynetic_agents-0.2.0/kynetic_agents/models.py +20 -0
  48. kynetic_agents-0.2.0/kynetic_agents/phone_book.py +427 -0
  49. kynetic_agents-0.2.0/kynetic_agents/prompts.py +337 -0
  50. kynetic_agents-0.2.0/kynetic_agents/readonly_backend.py +307 -0
  51. kynetic_agents-0.2.0/kynetic_agents/release.py +102 -0
  52. kynetic_agents-0.2.0/kynetic_agents/scheduler.py +362 -0
  53. kynetic_agents-0.2.0/kynetic_agents/supervisor.py +466 -0
  54. kynetic_agents-0.2.0/kynetic_agents/tools.py +1463 -0
  55. kynetic_agents-0.2.0/pyproject.toml +46 -0
@@ -0,0 +1,20 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # Virtual environments
10
+ .venv
11
+
12
+ # Standard stuff
13
+ .env
14
+ CLAUDE.md
15
+
16
+ # OS Files
17
+ .DS_Store
18
+
19
+ # Jetbrains
20
+ .idea
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Tim Kellogg
4
+ Copyright (c) 2026 Miguel Alonso Jr.
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
@@ -0,0 +1,211 @@
1
+ Metadata-Version: 2.4
2
+ Name: kynetic-agents
3
+ Version: 0.2.0
4
+ Summary: Multi-agent Discord runtime for hub-and-spoke AI teams — forked from kynetic-agents
5
+ Project-URL: Homepage, https://github.com/kynetic-ai/kynetic-agents
6
+ Author-email: "Miguel Alonso Jr." <miguel@kynetic.ai>
7
+ Maintainer-email: "Miguel Alonso Jr." <miguel@kynetic.ai>
8
+ License: MIT License
9
+
10
+ Copyright (c) 2026 Tim Kellogg
11
+ Copyright (c) 2026 Miguel Alonso Jr.
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ of this software and associated documentation files (the "Software"), to deal
15
+ in the Software without restriction, including without limitation the rights
16
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ copies of the Software, and to permit persons to whom the Software is
18
+ furnished to do so, subject to the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be included in all
21
+ copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ SOFTWARE.
30
+ License-File: LICENSE
31
+ Classifier: License :: OSI Approved :: MIT License
32
+ Requires-Python: >=3.11
33
+ Requires-Dist: aiohttp>=3.12.15
34
+ Requires-Dist: apscheduler>=3.11.2
35
+ Requires-Dist: deepagents>=0.4.1
36
+ Requires-Dist: discord-py>=2.6.4
37
+ Requires-Dist: matplotlib>=3.8
38
+ Requires-Dist: mcp>=1.26.0
39
+ Requires-Dist: python-dotenv>=1.2.1
40
+ Requires-Dist: pyyaml>=6.0.3
41
+ Description-Content-Type: text/markdown
42
+
43
+ # kynetic-agents
44
+
45
+ > **Forked from [open-strix](https://github.com/open-strix/open-strix).** This project extends open-strix with first-class support for multi-agent interaction via Discord using a **hub-and-spoke topology**: a central hub agent coordinates a fleet of spoke agents, each living in its own Discord channel, communicating through mentions and configurable `home_channels` routing.
46
+
47
+ [![PyPI version](https://img.shields.io/pypi/v/kynetic-agents.svg)](https://pypi.org/project/kynetic-agents/)
48
+
49
+ A persistent AI companion framework that lives in Discord, remembers everything, and gets better over time. Designed for running multiple agents together.
50
+
51
+ ```bash
52
+ uvx kynetic-agents setup --home my-agent --github
53
+ cd my-agent
54
+ uv run kynetic-agents
55
+ ```
56
+
57
+ Two commands. You have an agent. Connect it to Discord and start talking.
58
+
59
+ ## What is this?
60
+
61
+ kynetic-agents is an opinionated framework for building long-running AI agents. Not chatbots — *companions*. Agents that develop personality through conversation, maintain memory across sessions, schedule their own work, and learn from their mistakes.
62
+
63
+ It runs on cheap models (MiniMax M2.5, ~$0.01/message), talks to you over Discord, and stores everything in git. No vector databases, no cloud services, no enterprise pricing. Just files, memory blocks, and a git history you can actually read.
64
+
65
+ **Hub-and-spoke multi-agent topology:** Each agent owns one or more Discord channels (`home_channels`). A hub agent coordinates the fleet — spokes communicate back to the hub by @mentioning it in their own channels. The hub has read access to spoke channels and picks up those messages automatically.
66
+
67
+ **How you interact with it:** You talk to agents on Discord. They talk back using tools (`send_message`, `react`). They have scheduled jobs that fire even when you're not around. Over time, they develop interests, track your projects, and start doing useful things without being asked.
68
+
69
+ ## Why this exists
70
+
71
+ Most agent frameworks optimize for tool-calling pipelines or enterprise orchestration. kynetic-agents optimizes for a different thing: **agents that know you and get better over time**, and that can work together without getting in each other's way.
72
+
73
+ Three design bets:
74
+
75
+ - **Focused.** Small core, everything else is skills — markdown files the agent reads and follows. Add capabilities by dropping a file in `skills/`, or let the agent discover and install them at runtime.
76
+ - **Cheap.** Defaults to MiniMax M2.5 via the Anthropic-compatible API. Pennies per message. Run it on a $5/month VPS.
77
+ - **Stable.** Ships with built-in skills for self-diagnosis — prediction calibration loops, event introspection, onboarding that fades into regular operation. The agent can read its own logs, check whether its predictions were right, and notice when it's drifting.
78
+
79
+ ## How it works
80
+
81
+ ### The home repo
82
+
83
+ When you run `uvx kynetic-agents setup`, it creates a directory — the agent's *home*. Everything the agent knows lives here:
84
+
85
+ ```
86
+ blocks/ # YAML memory blocks — identity, goals, patterns. In every prompt.
87
+ state/ # Markdown files — projects, notes, research. Read on demand.
88
+ skills/ # Markdown skill files. Drop one in, agent picks it up.
89
+ logs/
90
+ events.jsonl # Every tool call, error, and event. The agent can read this.
91
+ chat-history.jsonl # Append-only chat transcript.
92
+ journal.jsonl # Agent's own log — what happened, what it predicted.
93
+ scheduler.yaml # Cron jobs the agent manages itself.
94
+ config.yaml # Model, Discord config, prompt tuning.
95
+ ```
96
+
97
+ Everything except logs is committed to git after every turn. The git history *is* the audit trail.
98
+
99
+ ### Multi-agent routing with `home_channels`
100
+
101
+ Each agent can be configured with a list of channels it should respond in:
102
+
103
+ ```yaml
104
+ home_channels:
105
+ - my-agent-channel
106
+ - 1234567890123456789 # channel IDs also work
107
+ ```
108
+
109
+ When `home_channels` is set, the agent only processes messages in those channels — unless it is directly @mentioned or an `always_respond_bot_ids` bot explicitly addresses it by name or ID. When `home_channels` is empty, the agent responds in all channels (original behavior).
110
+
111
+ For hub-and-spoke deployments:
112
+ - Give each spoke agent its own `home_channels` entry
113
+ - The hub agent reads all spoke channels (via Discord permissions) and picks up spoke→hub messages via `@mention`
114
+ - Spokes communicate to the hub through their `collaboration.md` onboarding docs
115
+
116
+ ### Memory
117
+
118
+ Two layers:
119
+
120
+ - **Blocks** (`blocks/*.yaml`) — short text that appears in every prompt. Identity, communication style, current focus, relationships.
121
+ - **Files** (`state/`) — longer content the agent reads when relevant. Research notes, project tracking, world context.
122
+
123
+ No embeddings, no vector search. Just files and git.
124
+
125
+ ### Skills
126
+
127
+ A skill is a markdown file in `skills/` with a YAML header. The agent sees all skills in its prompt and invokes them by name.
128
+
129
+ ```yaml
130
+ ---
131
+ name: my-skill
132
+ description: What this skill does and when to use it.
133
+ ---
134
+ # Instructions for the agent
135
+ ...
136
+ ```
137
+
138
+ Built-in skills:
139
+
140
+ | Skill | Purpose |
141
+ |-------|---------|
142
+ | **onboarding** | Walks the agent through establishing identity, goals, and schedules |
143
+ | **memory** | How to maintain and organize memory blocks and state files |
144
+ | **skill-creator** | Create new skills from repeated workflows |
145
+ | **prediction-review** | Calibration loops — revisit past predictions against ground truth |
146
+ | **introspection** | Self-diagnosis from event logs and behavioral patterns |
147
+ | **five-whys** | Root-cause analysis when predictions or behaviors go wrong |
148
+
149
+ ### Scheduling
150
+
151
+ The agent has tools to create, modify, and remove its own scheduled jobs. Jobs are cron expressions stored in `scheduler.yaml`. When a job fires, it sends a prompt to the agent — even if no human is around.
152
+
153
+ ### Events API
154
+
155
+ Every tool call, incoming message, error, and scheduler trigger is logged to `logs/events.jsonl`. The agent can read its own event log — and the introspection skill teaches it how.
156
+
157
+ When `api_port` is set in `config.yaml`, a loopback REST API accepts events from external scripts.
158
+
159
+ ## Setup
160
+
161
+ Requires [uv](https://docs.astral.sh/uv/getting-started/installation/) and a Discord bot token.
162
+
163
+ ```bash
164
+ uvx kynetic-agents setup --home my-agent --github
165
+ cd my-agent
166
+ # Edit .env with your API key and DISCORD_TOKEN
167
+ uv run kynetic-agents
168
+ ```
169
+
170
+ The setup command handles everything: directory structure, git init, GitHub repo creation (with `--github`), service files for your OS, and a walkthrough for model/Discord configuration.
171
+
172
+ See [SETUP.md](SETUP.md) for detailed instructions on environment variables, model configuration, Discord setup, and deployment options.
173
+
174
+ ## Upgrading
175
+
176
+ ```bash
177
+ uv add -U kynetic-agents
178
+ ```
179
+
180
+ ## Configuration
181
+
182
+ `config.yaml`:
183
+
184
+ ```yaml
185
+ model: MiniMax-M2.5
186
+ model_max_retries: 6
187
+ journal_entries_in_prompt: 90
188
+ discord_messages_in_prompt: 10
189
+ discord_token_env: DISCORD_TOKEN
190
+ always_respond_bot_ids: []
191
+ home_channels: []
192
+ api_port: 0
193
+ ```
194
+
195
+ Models use the Anthropic-compatible API format. MiniMax M2.5 and Kimi K2.5 both work out of the box. Any model with an Anthropic-compatible endpoint will work — set `ANTHROPIC_BASE_URL` and `ANTHROPIC_API_KEY` in `.env`.
196
+
197
+ ## Tests
198
+
199
+ ```bash
200
+ uv run pytest -q
201
+ ```
202
+
203
+ ## Safety
204
+
205
+ Agent file writes are limited to `state/` and `skills/`. Reads use repository scope. Built-in skills are read-only.
206
+
207
+ There is no sandboxing. Agents have full shell access. This is intentionally simple and should not be treated as a security boundary.
208
+
209
+ ## License
210
+
211
+ MIT. See `LICENSE`.
@@ -0,0 +1,169 @@
1
+ # kynetic-agents
2
+
3
+ > **Forked from [open-strix](https://github.com/open-strix/open-strix).** This project extends open-strix with first-class support for multi-agent interaction via Discord using a **hub-and-spoke topology**: a central hub agent coordinates a fleet of spoke agents, each living in its own Discord channel, communicating through mentions and configurable `home_channels` routing.
4
+
5
+ [![PyPI version](https://img.shields.io/pypi/v/kynetic-agents.svg)](https://pypi.org/project/kynetic-agents/)
6
+
7
+ A persistent AI companion framework that lives in Discord, remembers everything, and gets better over time. Designed for running multiple agents together.
8
+
9
+ ```bash
10
+ uvx kynetic-agents setup --home my-agent --github
11
+ cd my-agent
12
+ uv run kynetic-agents
13
+ ```
14
+
15
+ Two commands. You have an agent. Connect it to Discord and start talking.
16
+
17
+ ## What is this?
18
+
19
+ kynetic-agents is an opinionated framework for building long-running AI agents. Not chatbots — *companions*. Agents that develop personality through conversation, maintain memory across sessions, schedule their own work, and learn from their mistakes.
20
+
21
+ It runs on cheap models (MiniMax M2.5, ~$0.01/message), talks to you over Discord, and stores everything in git. No vector databases, no cloud services, no enterprise pricing. Just files, memory blocks, and a git history you can actually read.
22
+
23
+ **Hub-and-spoke multi-agent topology:** Each agent owns one or more Discord channels (`home_channels`). A hub agent coordinates the fleet — spokes communicate back to the hub by @mentioning it in their own channels. The hub has read access to spoke channels and picks up those messages automatically.
24
+
25
+ **How you interact with it:** You talk to agents on Discord. They talk back using tools (`send_message`, `react`). They have scheduled jobs that fire even when you're not around. Over time, they develop interests, track your projects, and start doing useful things without being asked.
26
+
27
+ ## Why this exists
28
+
29
+ Most agent frameworks optimize for tool-calling pipelines or enterprise orchestration. kynetic-agents optimizes for a different thing: **agents that know you and get better over time**, and that can work together without getting in each other's way.
30
+
31
+ Three design bets:
32
+
33
+ - **Focused.** Small core, everything else is skills — markdown files the agent reads and follows. Add capabilities by dropping a file in `skills/`, or let the agent discover and install them at runtime.
34
+ - **Cheap.** Defaults to MiniMax M2.5 via the Anthropic-compatible API. Pennies per message. Run it on a $5/month VPS.
35
+ - **Stable.** Ships with built-in skills for self-diagnosis — prediction calibration loops, event introspection, onboarding that fades into regular operation. The agent can read its own logs, check whether its predictions were right, and notice when it's drifting.
36
+
37
+ ## How it works
38
+
39
+ ### The home repo
40
+
41
+ When you run `uvx kynetic-agents setup`, it creates a directory — the agent's *home*. Everything the agent knows lives here:
42
+
43
+ ```
44
+ blocks/ # YAML memory blocks — identity, goals, patterns. In every prompt.
45
+ state/ # Markdown files — projects, notes, research. Read on demand.
46
+ skills/ # Markdown skill files. Drop one in, agent picks it up.
47
+ logs/
48
+ events.jsonl # Every tool call, error, and event. The agent can read this.
49
+ chat-history.jsonl # Append-only chat transcript.
50
+ journal.jsonl # Agent's own log — what happened, what it predicted.
51
+ scheduler.yaml # Cron jobs the agent manages itself.
52
+ config.yaml # Model, Discord config, prompt tuning.
53
+ ```
54
+
55
+ Everything except logs is committed to git after every turn. The git history *is* the audit trail.
56
+
57
+ ### Multi-agent routing with `home_channels`
58
+
59
+ Each agent can be configured with a list of channels it should respond in:
60
+
61
+ ```yaml
62
+ home_channels:
63
+ - my-agent-channel
64
+ - 1234567890123456789 # channel IDs also work
65
+ ```
66
+
67
+ When `home_channels` is set, the agent only processes messages in those channels — unless it is directly @mentioned or an `always_respond_bot_ids` bot explicitly addresses it by name or ID. When `home_channels` is empty, the agent responds in all channels (original behavior).
68
+
69
+ For hub-and-spoke deployments:
70
+ - Give each spoke agent its own `home_channels` entry
71
+ - The hub agent reads all spoke channels (via Discord permissions) and picks up spoke→hub messages via `@mention`
72
+ - Spokes communicate to the hub through their `collaboration.md` onboarding docs
73
+
74
+ ### Memory
75
+
76
+ Two layers:
77
+
78
+ - **Blocks** (`blocks/*.yaml`) — short text that appears in every prompt. Identity, communication style, current focus, relationships.
79
+ - **Files** (`state/`) — longer content the agent reads when relevant. Research notes, project tracking, world context.
80
+
81
+ No embeddings, no vector search. Just files and git.
82
+
83
+ ### Skills
84
+
85
+ A skill is a markdown file in `skills/` with a YAML header. The agent sees all skills in its prompt and invokes them by name.
86
+
87
+ ```yaml
88
+ ---
89
+ name: my-skill
90
+ description: What this skill does and when to use it.
91
+ ---
92
+ # Instructions for the agent
93
+ ...
94
+ ```
95
+
96
+ Built-in skills:
97
+
98
+ | Skill | Purpose |
99
+ |-------|---------|
100
+ | **onboarding** | Walks the agent through establishing identity, goals, and schedules |
101
+ | **memory** | How to maintain and organize memory blocks and state files |
102
+ | **skill-creator** | Create new skills from repeated workflows |
103
+ | **prediction-review** | Calibration loops — revisit past predictions against ground truth |
104
+ | **introspection** | Self-diagnosis from event logs and behavioral patterns |
105
+ | **five-whys** | Root-cause analysis when predictions or behaviors go wrong |
106
+
107
+ ### Scheduling
108
+
109
+ The agent has tools to create, modify, and remove its own scheduled jobs. Jobs are cron expressions stored in `scheduler.yaml`. When a job fires, it sends a prompt to the agent — even if no human is around.
110
+
111
+ ### Events API
112
+
113
+ Every tool call, incoming message, error, and scheduler trigger is logged to `logs/events.jsonl`. The agent can read its own event log — and the introspection skill teaches it how.
114
+
115
+ When `api_port` is set in `config.yaml`, a loopback REST API accepts events from external scripts.
116
+
117
+ ## Setup
118
+
119
+ Requires [uv](https://docs.astral.sh/uv/getting-started/installation/) and a Discord bot token.
120
+
121
+ ```bash
122
+ uvx kynetic-agents setup --home my-agent --github
123
+ cd my-agent
124
+ # Edit .env with your API key and DISCORD_TOKEN
125
+ uv run kynetic-agents
126
+ ```
127
+
128
+ The setup command handles everything: directory structure, git init, GitHub repo creation (with `--github`), service files for your OS, and a walkthrough for model/Discord configuration.
129
+
130
+ See [SETUP.md](SETUP.md) for detailed instructions on environment variables, model configuration, Discord setup, and deployment options.
131
+
132
+ ## Upgrading
133
+
134
+ ```bash
135
+ uv add -U kynetic-agents
136
+ ```
137
+
138
+ ## Configuration
139
+
140
+ `config.yaml`:
141
+
142
+ ```yaml
143
+ model: MiniMax-M2.5
144
+ model_max_retries: 6
145
+ journal_entries_in_prompt: 90
146
+ discord_messages_in_prompt: 10
147
+ discord_token_env: DISCORD_TOKEN
148
+ always_respond_bot_ids: []
149
+ home_channels: []
150
+ api_port: 0
151
+ ```
152
+
153
+ Models use the Anthropic-compatible API format. MiniMax M2.5 and Kimi K2.5 both work out of the box. Any model with an Anthropic-compatible endpoint will work — set `ANTHROPIC_BASE_URL` and `ANTHROPIC_API_KEY` in `.env`.
154
+
155
+ ## Tests
156
+
157
+ ```bash
158
+ uv run pytest -q
159
+ ```
160
+
161
+ ## Safety
162
+
163
+ Agent file writes are limited to `state/` and `skills/`. Reads use repository scope. Built-in skills are read-only.
164
+
165
+ There is no sandboxing. Agents have full shell access. This is intentionally simple and should not be treated as a security boundary.
166
+
167
+ ## License
168
+
169
+ MIT. See `LICENSE`.
@@ -0,0 +1,3 @@
1
+ from .app import run_kynetic_agents
2
+
3
+ __all__ = ["run_kynetic_agents"]
@@ -0,0 +1,55 @@
1
+ """Loopback REST API for injecting events into the agent."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import TYPE_CHECKING
6
+
7
+ from aiohttp import web
8
+
9
+ from .models import AgentEvent
10
+
11
+ if TYPE_CHECKING:
12
+ from .app import OpenStrixApp
13
+
14
+
15
+ def _build_app(strix: OpenStrixApp) -> web.Application:
16
+ app = web.Application()
17
+
18
+ async def post_event(request: web.Request) -> web.Response:
19
+ try:
20
+ body = await request.json()
21
+ except Exception:
22
+ return web.json_response({"error": "invalid JSON"}, status=400)
23
+
24
+ source = body.get("source", "")
25
+ prompt = body.get("prompt", "")
26
+ if not prompt:
27
+ return web.json_response({"error": "prompt is required"}, status=400)
28
+
29
+ source_label = source or "api"
30
+ event = AgentEvent(
31
+ event_type="api_event",
32
+ prompt=prompt,
33
+ channel_id=body.get("channel_id"),
34
+ source_id=f"api:{source_label}",
35
+ )
36
+ await strix.enqueue_event(event)
37
+ return web.json_response({"status": "queued", "source": source_label})
38
+
39
+ async def health(request: web.Request) -> web.Response:
40
+ return web.json_response({"status": "ok"})
41
+
42
+ app.router.add_post("/api/event", post_event)
43
+ app.router.add_get("/api/health", health)
44
+ return app
45
+
46
+
47
+ async def start_api(strix: OpenStrixApp, port: int) -> web.AppRunner:
48
+ """Start the loopback API server. Returns the runner for cleanup."""
49
+ app = _build_app(strix)
50
+ runner = web.AppRunner(app)
51
+ await runner.setup()
52
+ site = web.TCPSite(runner, "127.0.0.1", port)
53
+ await site.start()
54
+ strix.log_event("api_started", port=port)
55
+ return runner