triggeros 0.1.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 (73) hide show
  1. triggeros-0.1.0/LICENSE +201 -0
  2. triggeros-0.1.0/MANIFEST.in +3 -0
  3. triggeros-0.1.0/PKG-INFO +191 -0
  4. triggeros-0.1.0/README.md +160 -0
  5. triggeros-0.1.0/pyproject.toml +53 -0
  6. triggeros-0.1.0/setup.cfg +4 -0
  7. triggeros-0.1.0/triggeros/__init__.py +5 -0
  8. triggeros-0.1.0/triggeros/__main__.py +6 -0
  9. triggeros-0.1.0/triggeros/adapters/__init__.py +1 -0
  10. triggeros-0.1.0/triggeros/adapters/agents/__init__.py +1 -0
  11. triggeros-0.1.0/triggeros/adapters/agents/claude.py +176 -0
  12. triggeros-0.1.0/triggeros/adapters/agents/openai.py +325 -0
  13. triggeros-0.1.0/triggeros/adapters/base.py +34 -0
  14. triggeros-0.1.0/triggeros/cli/__init__.py +1 -0
  15. triggeros-0.1.0/triggeros/cli/app.py +59 -0
  16. triggeros-0.1.0/triggeros/cli/commands/__init__.py +5 -0
  17. triggeros-0.1.0/triggeros/cli/commands/chats_cmd.py +39 -0
  18. triggeros-0.1.0/triggeros/cli/commands/config_cmd.py +159 -0
  19. triggeros-0.1.0/triggeros/cli/commands/cost_cmd.py +112 -0
  20. triggeros-0.1.0/triggeros/cli/commands/doctor_cmd.py +59 -0
  21. triggeros-0.1.0/triggeros/cli/commands/init_cmd.py +349 -0
  22. triggeros-0.1.0/triggeros/cli/commands/keys_cmd.py +96 -0
  23. triggeros-0.1.0/triggeros/cli/commands/learning_cmd.py +57 -0
  24. triggeros-0.1.0/triggeros/cli/commands/memory_cmd.py +196 -0
  25. triggeros-0.1.0/triggeros/cli/commands/patterns_cmd.py +94 -0
  26. triggeros-0.1.0/triggeros/cli/commands/run_cmd.py +1620 -0
  27. triggeros-0.1.0/triggeros/cli/commands/skills_cmd.py +272 -0
  28. triggeros-0.1.0/triggeros/cli/commands/watch_cmd.py +351 -0
  29. triggeros-0.1.0/triggeros/cli/console.py +44 -0
  30. triggeros-0.1.0/triggeros/core/__init__.py +1 -0
  31. triggeros-0.1.0/triggeros/core/agent_action.py +113 -0
  32. triggeros-0.1.0/triggeros/core/auto_learner.py +486 -0
  33. triggeros-0.1.0/triggeros/core/behavior_engine.py +61 -0
  34. triggeros-0.1.0/triggeros/core/decomposer.py +248 -0
  35. triggeros-0.1.0/triggeros/core/learning_loop.py +40 -0
  36. triggeros-0.1.0/triggeros/core/observer.py +20 -0
  37. triggeros-0.1.0/triggeros/core/orchestrator.py +54 -0
  38. triggeros-0.1.0/triggeros/core/pattern_engine.py +279 -0
  39. triggeros-0.1.0/triggeros/core/proactive.py +273 -0
  40. triggeros-0.1.0/triggeros/core/project_knowledge.py +470 -0
  41. triggeros-0.1.0/triggeros/core/tooling.py +562 -0
  42. triggeros-0.1.0/triggeros/core/tools.py +691 -0
  43. triggeros-0.1.0/triggeros/core/trigger_object.py +99 -0
  44. triggeros-0.1.0/triggeros/patterns/__init__.py +1 -0
  45. triggeros-0.1.0/triggeros/patterns/base.py +123 -0
  46. triggeros-0.1.0/triggeros/skills/__init__.py +1 -0
  47. triggeros-0.1.0/triggeros/skills/base.py +143 -0
  48. triggeros-0.1.0/triggeros/skills/installer.py +145 -0
  49. triggeros-0.1.0/triggeros/skills/manager.py +255 -0
  50. triggeros-0.1.0/triggeros/skills/security.py +191 -0
  51. triggeros-0.1.0/triggeros/storage/__init__.py +1 -0
  52. triggeros-0.1.0/triggeros/storage/base.py +102 -0
  53. triggeros-0.1.0/triggeros/storage/chat_store.py +95 -0
  54. triggeros-0.1.0/triggeros/storage/migrations/__init__.py +1 -0
  55. triggeros-0.1.0/triggeros/storage/migrations/v001_initial.py +174 -0
  56. triggeros-0.1.0/triggeros/storage/seed.py +69 -0
  57. triggeros-0.1.0/triggeros/storage/sqlite_store.py +616 -0
  58. triggeros-0.1.0/triggeros/ui/__init__.py +5 -0
  59. triggeros-0.1.0/triggeros/ui/session_ui.py +409 -0
  60. triggeros-0.1.0/triggeros/utils/__init__.py +1 -0
  61. triggeros-0.1.0/triggeros/utils/config.py +164 -0
  62. triggeros-0.1.0/triggeros/utils/discovery.py +46 -0
  63. triggeros-0.1.0/triggeros/utils/logging_config.py +20 -0
  64. triggeros-0.1.0/triggeros/utils/model_select.py +76 -0
  65. triggeros-0.1.0/triggeros/utils/pricing.py +167 -0
  66. triggeros-0.1.0/triggeros/utils/project_meta.py +158 -0
  67. triggeros-0.1.0/triggeros/version.py +3 -0
  68. triggeros-0.1.0/triggeros.egg-info/PKG-INFO +191 -0
  69. triggeros-0.1.0/triggeros.egg-info/SOURCES.txt +71 -0
  70. triggeros-0.1.0/triggeros.egg-info/dependency_links.txt +1 -0
  71. triggeros-0.1.0/triggeros.egg-info/entry_points.txt +2 -0
  72. triggeros-0.1.0/triggeros.egg-info/requires.txt +9 -0
  73. triggeros-0.1.0/triggeros.egg-info/top_level.txt +1 -0
@@ -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 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 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 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
+ 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 2024 TriggerOS
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.
@@ -0,0 +1,3 @@
1
+ include README.md
2
+ include LICENSE
3
+ include pyproject.toml
@@ -0,0 +1,191 @@
1
+ Metadata-Version: 2.4
2
+ Name: triggeros
3
+ Version: 0.1.0
4
+ Summary: Behavioral Operating System for AI Agents — observe, learn, improve.
5
+ Author: TriggerOS
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/triggeros/triggeros
8
+ Project-URL: Repository, https://github.com/triggeros/triggeros
9
+ Project-URL: Documentation, https://github.com/triggeros/triggeros#readme
10
+ Project-URL: Issues, https://github.com/triggeros/triggeros/issues
11
+ Keywords: ai,agents,behavior,learning,cursor,claude
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Software Development
19
+ Requires-Python: >=3.10
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: typer>=0.9.0
23
+ Requires-Dist: rich>=13.0.0
24
+ Requires-Dist: anthropic>=0.18.0
25
+ Requires-Dist: openai>=1.0.0
26
+ Requires-Dist: PyYAML>=6.0
27
+ Provides-Extra: dev
28
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
29
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
30
+ Dynamic: license-file
31
+
32
+ # TriggerOS
33
+
34
+ **Behavioral Operating System for AI Agents** — observe, learn, improve.
35
+
36
+ Think: Git for code versioning → TriggerOS for behavioral intelligence versioning.
37
+
38
+ [![CI](https://github.com/triggeros/triggeros/actions/workflows/ci.yml/badge.svg)](https://github.com/triggeros/triggeros/actions/workflows/ci.yml)
39
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
40
+
41
+ ---
42
+
43
+ ## Why TriggerOS?
44
+
45
+ Why would a dev or engineer run TriggerOS instead of Claude or Codex directly?
46
+
47
+ - **Project memory** — Learns and reuses facts about *your* repo (e.g. “dashboard = CommandCenterLayout.tsx”, “auth lives in lib/auth”). Future runs start with that context instead of re-exploring. Claude/Codex alone start from zero each time.
48
+ - **Cost control** — Routes work by step: cheap model for planning, stronger one for implementation, mid-tier for tests. You see **total cost and tokens per run** (including multi-step). No more “one expensive model for everything” with no breakdown.
49
+ - **Fewer wrong edits** — File pinning (from task + learned facts) and “read once then patch” discipline reduce “it edited the wrong file.” The agent behaves like it knows your repo.
50
+ - **Learning from corrections** — When you fix agent output, TriggerOS can record it and turn it into conventions (e.g. “live dashboard is CommandCenterLayout, not Header”). Same mistake doesn’t keep happening.
51
+ - **Rules and guardrails** — Patterns can inject prompts, switch model, or block a run (e.g. “no prod deploy without review”). Encode team rules that apply to every run.
52
+ - **Audit and debugging** — `triggeros memory show <id>` shows the **tool-call trace**: which tools, which paths, success/fail, duration. Inspect what the agent did instead of a black box.
53
+ - **One interface, multiple models** — One CLI (`triggeros run "task"`) that can use Claude or OpenAI/Codex and route steps automatically. No switching apps or pasting context by hand.
54
+
55
+ **TL;DR:** TriggerOS is for when you want the agent to **get better at your project over time**, **spend less** (right model per step + visibility), and **follow rules and learn from corrections** — a project-aware, cost-aware, learning-aware layer on top of Claude/Codex.
56
+
57
+ ---
58
+
59
+ ## What it does
60
+
61
+ - **Observes** agent actions (prompts, tool calls, outcomes)
62
+ - **Detects** recurring patterns (missing tests, expensive model use, repeated failures)
63
+ - **Applies** learned behaviors (inject prompts, suggest cheaper models)
64
+ - **Learns** from your corrections so the agent gets better over time
65
+
66
+ TriggerOS agents are **tool-enabled**: they can search/read/write files and run terminal commands inside configured workspace roots (with confirmations by default).
67
+
68
+ On first run, `triggeros init` can ask your coding style: **vibe coder** (more suggestions), **power user** (fewer, higher-confidence nudges), or **mixed**. It can also discover agents (Claude, OpenAI, Codex) and set a default agent and routing strategy. All of this is stored in `~/.triggeros/config.json`.
69
+
70
+ ---
71
+
72
+ ## Quick start
73
+
74
+ ```bash
75
+ # Install (PyPI — no GitHub needed)
76
+ pip install triggeros
77
+
78
+ # Set API keys (pick the agents you use)
79
+ triggeros keys template --write # create .env in cwd
80
+ triggeros keys template --write --config-dir # or in ~/.triggeros/.env
81
+ # Or export ANTHROPIC_API_KEY / OPENAI_API_KEY in your shell
82
+
83
+ # Initialize (creates ~/.triggeros, optional questionnaire, agent discovery)
84
+ triggeros init
85
+
86
+ # Run a task (uses default agent from config if --agent omitted)
87
+ triggeros run "your task"
88
+ triggeros run --agent claude "your task"
89
+ ```
90
+
91
+ **Install from source (developers):** `git clone https://github.com/triggeros/triggeros.git && cd triggeros && pip install -e .`
92
+
93
+ Customize which env vars we check via `config.json`: set `env_var_names` (e.g. `{"claude": "MY_ANTHROPIC_KEY"}`).
94
+
95
+ ## Commands
96
+
97
+ | Command | Description |
98
+ |--------|-------------|
99
+ | `triggeros init` | Set up config, DB, optional questionnaire, default agent and routing |
100
+ | `triggeros run [--agent NAME] "<task>"` | Run task through TriggerOS; uses default agent if `--agent` omitted |
101
+ | `triggeros patterns list` | List active patterns (name, confidence, applied, success %) |
102
+ | `triggeros patterns show <name>` | Show one pattern: rules, behavior, stats |
103
+ | `triggeros patterns disable <name>` / `enable <name>` | Disable or re-enable a pattern |
104
+ | `triggeros config show` | Print current config (JSON) |
105
+ | `triggeros config set <key> <value>` | Set config key (e.g. confidence_threshold, default_agent) |
106
+ | `triggeros doctor` | Check config dir, DB, and discovered agents (no key values) |
107
+ | `triggeros keys` | Show API key status (present/missing). `keys template --write` to create .env |
108
+ | `triggeros memory list` | List recent agent actions (id, session, input, started_at, success) |
109
+ | `triggeros memory show <id>` | Full details for one action |
110
+ | `triggeros memory export [--path FILE]` | Export actions and patterns to JSON |
111
+ | `triggeros history` | Last 20 actions (alias for memory list) |
112
+ | `triggeros cost [--limit N] [--period 7d] [--backfill]` | Estimated spend from stored actions (optional backfill for missing cost) |
113
+ | `triggeros stats [--backfill] [--backfill-limit N]` | Sessions, actions, patterns applied, total/avg cost (optional backfill) |
114
+ | `triggeros chats` | List recent chat sessions (~/.triggeros/chats/) |
115
+ | `triggeros` (no args) | Interactive session: prompt loop, optional resume last session |
116
+ | `triggeros --version` | Show version |
117
+ | `triggeros skills ...` | List/install/create/export/import Anthropic-style SKILL bundles |
118
+ | `triggeros learning correction <action-id>` | Record a correction so patterns or skills evolve |
119
+ | `triggeros watch` | Start a local HTTP endpoint (`POST /events/run`, `/events/feedback`) for editors |
120
+
121
+ ## Config
122
+
123
+ - Config dir: `~/.triggeros` (or `TRIGGEROS_CONFIG_DIR`)
124
+ - `config.json`: `confidence_threshold`, `auto_apply_patterns`, `user_profile`, `default_agent`, `agents_enabled`, `routing_strategy`, `use_routing`, `env_var_names` (optional)
125
+ - `config.json` also tracks `preferred_model_profile` (power / balanced / vibe) and `model_profiles`, which map each profile to the agent/model names TriggerOS should prefer when applying patterns or running tasks. Edit these settings if you want to steer toward Codex/Opus, Claude Sonnet/Haiku, or your own favorites.
126
+ - Cost estimation keys:
127
+ - `model_pricing` (default `{}`): optional overrides/additions for per-model pricing used by `triggeros cost` / `triggeros stats` (USD per 1M input/output tokens). If a model isn't in TriggerOS' built-in snapshot, add it here.
128
+ - Routing keys:
129
+ - `use_llm_decomposer` (default true): when routing is enabled, use a cheap LLM call to break a prompt into steps (falls back to heuristic if unavailable)
130
+ - `decomposer_model_profile` (default vibe): which model profile to use for the decomposition call
131
+ - Tooling policy keys:
132
+ - `auto_apply_edits` (default false): require confirmation before writing files
133
+ - `allow_shell_commands` (default false): enable `run_command` / `start_process`
134
+ - `auto_run_commands` (default false): require confirmation before running commands
135
+ - `allowed_roots` (default []): extra filesystem roots allowed for tools (cwd is always allowed)
136
+
137
+ ## Setup questionnaire
138
+
139
+ During `triggeros init` (unless you pass `--yes`), we ask:
140
+
141
+ - What should TriggerOS call you? (display name used in nudges)
142
+ - How do you like to code? (`vibe`, `power`, `mixed`)
143
+ - Want more suggestions and nudges (tests, cost, etc.)?
144
+ - Which model profile should we lean on (`power`, `balanced`, `vibe`)?
145
+ - Whether TriggerOS can auto-apply edits and run commands, and whether it can access your home directory as an extra root.
146
+
147
+ Changing these answers updates `user_profile` plus `preferred_model_profile`. You can rerun `triggeros init` later to adjust or edit `~/.triggeros/config.json` directly.
148
+
149
+ ## Project structure
150
+
151
+ ```
152
+ triggeros/
153
+ core/ # TriggerObject, Pattern, AgentAction, Observer, PatternEngine, BehaviorEngine, LearningLoop, Orchestrator
154
+ patterns/ # Built-in patterns (missing_tests, cost, reliability)
155
+ storage/ # SQLite backend, migrations, seed
156
+ adapters/ # Agent adapters (Claude; OpenAI and routing in later phases)
157
+ cli/ # Typer CLI: init, run, patterns, config, doctor, memory, history, cost, stats
158
+ utils/ # Config, discovery (agent detection from env)
159
+ ```
160
+
161
+ ## Skills and learning
162
+
163
+ TriggerOS understands Anthropic-style skills out of the box. Built-in SKILLs live under `triggeros/skills/builtin/`, and the `triggeros skills ...` group lets you list them, install community or custom SKILLs, scaffold templates, and export/import metadata plus any learned improvements. Use `triggeros learning correction <action-id>` after overriding an agent run so the learning loop can create or update patterns and reinforce the relevant skill improvements.
164
+
165
+ ## Editor integration
166
+
167
+ Run `triggeros watch` to start a small HTTP server (default `http://127.0.0.1:18500`). Cursor or VS Code extensions can push prompts, context, and corrections via `POST /events/run` and `POST /events/feedback`; TriggerOS records those actions, triggers pattern detection, and replies with matched suggestions so editors can surface inline nudges while sharing the same SQLite history and skill data. A helper script `scripts/editor_client.py` demonstrates how to send both run events (`--task`) and feedback (`--feedback-action-id`, `--correction type=... message=... skill=...`) so you can prototype an extension without writing HTTP glue yourself.
168
+
169
+ For a fully tool-enabled run (TriggerOS executes the agent and tool calls), use `POST /run` with `{ "task": "...", "cwd": "...", "allowed_roots": ["..."], "agent": "openai|claude" }`. This endpoint is non-interactive; enable `auto_apply_edits` / `auto_run_commands` in config if you want it to modify files or run commands without confirmation.
170
+
171
+ ## Advanced CLI automation
172
+
173
+ `triggeros run` now accepts several automation helpers so you can instruct the CLI to scan directories, grab the files that matter, and tag the intent for the orchestrator before the agent runs:
174
+
175
+ - `--file/-F PATH`: include a specific file’s content in the run context.
176
+ - `--dir/-D DIR`: walk a directory and attach every file under it (up to 24 entries) so the agent sees the code in question.
177
+ - `--scan-root/-s DIR --find NAME`: search the root for files or folders whose name contains `NAME` (e.g. `–scan-root ~/projects --find receptionist-dashboard`) and feed those snippets into the run.
178
+ - `--tag/-T VALUE`: attach short intent tags such as `classic-dashboard`, `showings`, or `style-match` so patterns and skill learning recognize high-level workflows.
179
+
180
+ The CLI prints a “Collected context files” table after each run so you can see exactly which files were provided to the agent and preview the snippets that informed the behavior. Use these flags to say things like “scan home for the receptionist-dashboard project, focus on the classic dashboard showings section, and apply the same UI practice to the business page,” and TriggerOS will gather the relevant files, describe the intent, and send it all through the planner + coder pipeline you already built.
181
+
182
+ ## Links
183
+
184
+ - **Repository:** [github.com/triggeros/triggeros](https://github.com/triggeros/triggeros)
185
+ - **Issues:** [github.com/triggeros/triggeros/issues](https://github.com/triggeros/triggeros/issues)
186
+ - **Contributing:** [CONTRIBUTING.md](CONTRIBUTING.md)
187
+ - **Publishing to PyPI:** [PUBLISH.md](PUBLISH.md) (so users can `pip install triggeros` without GitHub)
188
+
189
+ ## License
190
+
191
+ Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) for the full text.
@@ -0,0 +1,160 @@
1
+ # TriggerOS
2
+
3
+ **Behavioral Operating System for AI Agents** — observe, learn, improve.
4
+
5
+ Think: Git for code versioning → TriggerOS for behavioral intelligence versioning.
6
+
7
+ [![CI](https://github.com/triggeros/triggeros/actions/workflows/ci.yml/badge.svg)](https://github.com/triggeros/triggeros/actions/workflows/ci.yml)
8
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
9
+
10
+ ---
11
+
12
+ ## Why TriggerOS?
13
+
14
+ Why would a dev or engineer run TriggerOS instead of Claude or Codex directly?
15
+
16
+ - **Project memory** — Learns and reuses facts about *your* repo (e.g. “dashboard = CommandCenterLayout.tsx”, “auth lives in lib/auth”). Future runs start with that context instead of re-exploring. Claude/Codex alone start from zero each time.
17
+ - **Cost control** — Routes work by step: cheap model for planning, stronger one for implementation, mid-tier for tests. You see **total cost and tokens per run** (including multi-step). No more “one expensive model for everything” with no breakdown.
18
+ - **Fewer wrong edits** — File pinning (from task + learned facts) and “read once then patch” discipline reduce “it edited the wrong file.” The agent behaves like it knows your repo.
19
+ - **Learning from corrections** — When you fix agent output, TriggerOS can record it and turn it into conventions (e.g. “live dashboard is CommandCenterLayout, not Header”). Same mistake doesn’t keep happening.
20
+ - **Rules and guardrails** — Patterns can inject prompts, switch model, or block a run (e.g. “no prod deploy without review”). Encode team rules that apply to every run.
21
+ - **Audit and debugging** — `triggeros memory show <id>` shows the **tool-call trace**: which tools, which paths, success/fail, duration. Inspect what the agent did instead of a black box.
22
+ - **One interface, multiple models** — One CLI (`triggeros run "task"`) that can use Claude or OpenAI/Codex and route steps automatically. No switching apps or pasting context by hand.
23
+
24
+ **TL;DR:** TriggerOS is for when you want the agent to **get better at your project over time**, **spend less** (right model per step + visibility), and **follow rules and learn from corrections** — a project-aware, cost-aware, learning-aware layer on top of Claude/Codex.
25
+
26
+ ---
27
+
28
+ ## What it does
29
+
30
+ - **Observes** agent actions (prompts, tool calls, outcomes)
31
+ - **Detects** recurring patterns (missing tests, expensive model use, repeated failures)
32
+ - **Applies** learned behaviors (inject prompts, suggest cheaper models)
33
+ - **Learns** from your corrections so the agent gets better over time
34
+
35
+ TriggerOS agents are **tool-enabled**: they can search/read/write files and run terminal commands inside configured workspace roots (with confirmations by default).
36
+
37
+ On first run, `triggeros init` can ask your coding style: **vibe coder** (more suggestions), **power user** (fewer, higher-confidence nudges), or **mixed**. It can also discover agents (Claude, OpenAI, Codex) and set a default agent and routing strategy. All of this is stored in `~/.triggeros/config.json`.
38
+
39
+ ---
40
+
41
+ ## Quick start
42
+
43
+ ```bash
44
+ # Install (PyPI — no GitHub needed)
45
+ pip install triggeros
46
+
47
+ # Set API keys (pick the agents you use)
48
+ triggeros keys template --write # create .env in cwd
49
+ triggeros keys template --write --config-dir # or in ~/.triggeros/.env
50
+ # Or export ANTHROPIC_API_KEY / OPENAI_API_KEY in your shell
51
+
52
+ # Initialize (creates ~/.triggeros, optional questionnaire, agent discovery)
53
+ triggeros init
54
+
55
+ # Run a task (uses default agent from config if --agent omitted)
56
+ triggeros run "your task"
57
+ triggeros run --agent claude "your task"
58
+ ```
59
+
60
+ **Install from source (developers):** `git clone https://github.com/triggeros/triggeros.git && cd triggeros && pip install -e .`
61
+
62
+ Customize which env vars we check via `config.json`: set `env_var_names` (e.g. `{"claude": "MY_ANTHROPIC_KEY"}`).
63
+
64
+ ## Commands
65
+
66
+ | Command | Description |
67
+ |--------|-------------|
68
+ | `triggeros init` | Set up config, DB, optional questionnaire, default agent and routing |
69
+ | `triggeros run [--agent NAME] "<task>"` | Run task through TriggerOS; uses default agent if `--agent` omitted |
70
+ | `triggeros patterns list` | List active patterns (name, confidence, applied, success %) |
71
+ | `triggeros patterns show <name>` | Show one pattern: rules, behavior, stats |
72
+ | `triggeros patterns disable <name>` / `enable <name>` | Disable or re-enable a pattern |
73
+ | `triggeros config show` | Print current config (JSON) |
74
+ | `triggeros config set <key> <value>` | Set config key (e.g. confidence_threshold, default_agent) |
75
+ | `triggeros doctor` | Check config dir, DB, and discovered agents (no key values) |
76
+ | `triggeros keys` | Show API key status (present/missing). `keys template --write` to create .env |
77
+ | `triggeros memory list` | List recent agent actions (id, session, input, started_at, success) |
78
+ | `triggeros memory show <id>` | Full details for one action |
79
+ | `triggeros memory export [--path FILE]` | Export actions and patterns to JSON |
80
+ | `triggeros history` | Last 20 actions (alias for memory list) |
81
+ | `triggeros cost [--limit N] [--period 7d] [--backfill]` | Estimated spend from stored actions (optional backfill for missing cost) |
82
+ | `triggeros stats [--backfill] [--backfill-limit N]` | Sessions, actions, patterns applied, total/avg cost (optional backfill) |
83
+ | `triggeros chats` | List recent chat sessions (~/.triggeros/chats/) |
84
+ | `triggeros` (no args) | Interactive session: prompt loop, optional resume last session |
85
+ | `triggeros --version` | Show version |
86
+ | `triggeros skills ...` | List/install/create/export/import Anthropic-style SKILL bundles |
87
+ | `triggeros learning correction <action-id>` | Record a correction so patterns or skills evolve |
88
+ | `triggeros watch` | Start a local HTTP endpoint (`POST /events/run`, `/events/feedback`) for editors |
89
+
90
+ ## Config
91
+
92
+ - Config dir: `~/.triggeros` (or `TRIGGEROS_CONFIG_DIR`)
93
+ - `config.json`: `confidence_threshold`, `auto_apply_patterns`, `user_profile`, `default_agent`, `agents_enabled`, `routing_strategy`, `use_routing`, `env_var_names` (optional)
94
+ - `config.json` also tracks `preferred_model_profile` (power / balanced / vibe) and `model_profiles`, which map each profile to the agent/model names TriggerOS should prefer when applying patterns or running tasks. Edit these settings if you want to steer toward Codex/Opus, Claude Sonnet/Haiku, or your own favorites.
95
+ - Cost estimation keys:
96
+ - `model_pricing` (default `{}`): optional overrides/additions for per-model pricing used by `triggeros cost` / `triggeros stats` (USD per 1M input/output tokens). If a model isn't in TriggerOS' built-in snapshot, add it here.
97
+ - Routing keys:
98
+ - `use_llm_decomposer` (default true): when routing is enabled, use a cheap LLM call to break a prompt into steps (falls back to heuristic if unavailable)
99
+ - `decomposer_model_profile` (default vibe): which model profile to use for the decomposition call
100
+ - Tooling policy keys:
101
+ - `auto_apply_edits` (default false): require confirmation before writing files
102
+ - `allow_shell_commands` (default false): enable `run_command` / `start_process`
103
+ - `auto_run_commands` (default false): require confirmation before running commands
104
+ - `allowed_roots` (default []): extra filesystem roots allowed for tools (cwd is always allowed)
105
+
106
+ ## Setup questionnaire
107
+
108
+ During `triggeros init` (unless you pass `--yes`), we ask:
109
+
110
+ - What should TriggerOS call you? (display name used in nudges)
111
+ - How do you like to code? (`vibe`, `power`, `mixed`)
112
+ - Want more suggestions and nudges (tests, cost, etc.)?
113
+ - Which model profile should we lean on (`power`, `balanced`, `vibe`)?
114
+ - Whether TriggerOS can auto-apply edits and run commands, and whether it can access your home directory as an extra root.
115
+
116
+ Changing these answers updates `user_profile` plus `preferred_model_profile`. You can rerun `triggeros init` later to adjust or edit `~/.triggeros/config.json` directly.
117
+
118
+ ## Project structure
119
+
120
+ ```
121
+ triggeros/
122
+ core/ # TriggerObject, Pattern, AgentAction, Observer, PatternEngine, BehaviorEngine, LearningLoop, Orchestrator
123
+ patterns/ # Built-in patterns (missing_tests, cost, reliability)
124
+ storage/ # SQLite backend, migrations, seed
125
+ adapters/ # Agent adapters (Claude; OpenAI and routing in later phases)
126
+ cli/ # Typer CLI: init, run, patterns, config, doctor, memory, history, cost, stats
127
+ utils/ # Config, discovery (agent detection from env)
128
+ ```
129
+
130
+ ## Skills and learning
131
+
132
+ TriggerOS understands Anthropic-style skills out of the box. Built-in SKILLs live under `triggeros/skills/builtin/`, and the `triggeros skills ...` group lets you list them, install community or custom SKILLs, scaffold templates, and export/import metadata plus any learned improvements. Use `triggeros learning correction <action-id>` after overriding an agent run so the learning loop can create or update patterns and reinforce the relevant skill improvements.
133
+
134
+ ## Editor integration
135
+
136
+ Run `triggeros watch` to start a small HTTP server (default `http://127.0.0.1:18500`). Cursor or VS Code extensions can push prompts, context, and corrections via `POST /events/run` and `POST /events/feedback`; TriggerOS records those actions, triggers pattern detection, and replies with matched suggestions so editors can surface inline nudges while sharing the same SQLite history and skill data. A helper script `scripts/editor_client.py` demonstrates how to send both run events (`--task`) and feedback (`--feedback-action-id`, `--correction type=... message=... skill=...`) so you can prototype an extension without writing HTTP glue yourself.
137
+
138
+ For a fully tool-enabled run (TriggerOS executes the agent and tool calls), use `POST /run` with `{ "task": "...", "cwd": "...", "allowed_roots": ["..."], "agent": "openai|claude" }`. This endpoint is non-interactive; enable `auto_apply_edits` / `auto_run_commands` in config if you want it to modify files or run commands without confirmation.
139
+
140
+ ## Advanced CLI automation
141
+
142
+ `triggeros run` now accepts several automation helpers so you can instruct the CLI to scan directories, grab the files that matter, and tag the intent for the orchestrator before the agent runs:
143
+
144
+ - `--file/-F PATH`: include a specific file’s content in the run context.
145
+ - `--dir/-D DIR`: walk a directory and attach every file under it (up to 24 entries) so the agent sees the code in question.
146
+ - `--scan-root/-s DIR --find NAME`: search the root for files or folders whose name contains `NAME` (e.g. `–scan-root ~/projects --find receptionist-dashboard`) and feed those snippets into the run.
147
+ - `--tag/-T VALUE`: attach short intent tags such as `classic-dashboard`, `showings`, or `style-match` so patterns and skill learning recognize high-level workflows.
148
+
149
+ The CLI prints a “Collected context files” table after each run so you can see exactly which files were provided to the agent and preview the snippets that informed the behavior. Use these flags to say things like “scan home for the receptionist-dashboard project, focus on the classic dashboard showings section, and apply the same UI practice to the business page,” and TriggerOS will gather the relevant files, describe the intent, and send it all through the planner + coder pipeline you already built.
150
+
151
+ ## Links
152
+
153
+ - **Repository:** [github.com/triggeros/triggeros](https://github.com/triggeros/triggeros)
154
+ - **Issues:** [github.com/triggeros/triggeros/issues](https://github.com/triggeros/triggeros/issues)
155
+ - **Contributing:** [CONTRIBUTING.md](CONTRIBUTING.md)
156
+ - **Publishing to PyPI:** [PUBLISH.md](PUBLISH.md) (so users can `pip install triggeros` without GitHub)
157
+
158
+ ## License
159
+
160
+ Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) for the full text.
@@ -0,0 +1,53 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "triggeros"
7
+ version = "0.1.0"
8
+ description = "Behavioral Operating System for AI Agents — observe, learn, improve."
9
+ readme = "README.md"
10
+ license = "Apache-2.0"
11
+ requires-python = ">=3.10"
12
+ authors = [{ name = "TriggerOS" }]
13
+ keywords = ["ai", "agents", "behavior", "learning", "cursor", "claude"]
14
+ classifiers = [
15
+ "Development Status :: 3 - Alpha",
16
+ "Intended Audience :: Developers",
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3.10",
19
+ "Programming Language :: Python :: 3.11",
20
+ "Programming Language :: Python :: 3.12",
21
+ "Topic :: Software Development",
22
+ ]
23
+ dependencies = [
24
+ "typer>=0.9.0",
25
+ "rich>=13.0.0",
26
+ "anthropic>=0.18.0",
27
+ "openai>=1.0.0",
28
+ "PyYAML>=6.0",
29
+ ]
30
+
31
+ [project.urls]
32
+ Homepage = "https://github.com/triggeros/triggeros"
33
+ Repository = "https://github.com/triggeros/triggeros"
34
+ Documentation = "https://github.com/triggeros/triggeros#readme"
35
+ Issues = "https://github.com/triggeros/triggeros/issues"
36
+
37
+ [project.optional-dependencies]
38
+ dev = [
39
+ "pytest>=7.0.0",
40
+ "pytest-asyncio>=0.21.0",
41
+ ]
42
+
43
+ [project.scripts]
44
+ triggeros = "triggeros.cli.app:app"
45
+
46
+ [tool.setuptools.packages.find]
47
+ where = ["."]
48
+ include = ["triggeros*"]
49
+
50
+ [tool.pytest.ini_options]
51
+ asyncio_mode = "auto"
52
+ testpaths = ["tests"]
53
+ pythonpath = ["."]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,5 @@
1
+ """TriggerOS — Behavioral Operating System for AI Agents."""
2
+
3
+ from triggeros.version import __version__
4
+
5
+ __all__ = ["__version__"]
@@ -0,0 +1,6 @@
1
+ """CLI entry: python -m triggeros."""
2
+
3
+ from triggeros.cli.app import app
4
+
5
+ if __name__ == "__main__":
6
+ app()
@@ -0,0 +1 @@
1
+ """Adapters: agents, tools, platforms."""
@@ -0,0 +1 @@
1
+ """Agent adapters."""