opencarly 1.0.1 → 1.0.2

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 (2) hide show
  1. package/README.md +78 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,78 @@
1
+ # OpenCarly
2
+
3
+ **Context Augmentation & Reinforcement Layer for OpenCode**
4
+
5
+ OpenCarly is an intelligent plugin for [OpenCode](https://github.com/opencode-ai/opencode) that dynamically manages your AI's context window. Instead of dumping all your rules, API guidelines, and project instructions into a single massive prompt, OpenCarly loads rules *only when they are relevant* and seamlessly trims them from the chat history when they aren't.
6
+
7
+ This saves massive amounts of tokens, dramatically reduces your API costs, and keeps your AI laser-focused on the task at hand without being distracted by irrelevant guidelines. Heavily inspired by Claude Code - CARL.
8
+
9
+ ## 🚀 Features
10
+
11
+ - **Dynamic Rule Injection:** Automatically injects specific instructions based on the files currently loaded in your context (e.g., injects `React` rules only when a `.tsx` file is open).
12
+ - **Keyword Triggers:** Trigger rule injection simply by typing a keyword in your prompt (e.g., typing "*api" injects your backend API guidelines).
13
+ - **History Trimming:** Aggressively removes injected rules from previous messages in the chat history, ensuring you only pay for the context once.
14
+ - **Cost Estimation & Stats:** Run `*stats` at any time to see exactly how many tokens (and estimated dollars!) OpenCarly has saved you.
15
+
16
+ ## 📦 Installation
17
+
18
+ To install OpenCarly globally, use npm:
19
+
20
+ ```bash
21
+ npm install -g opencarly
22
+ ```
23
+
24
+ Then, initialize OpenCarly in your project directory:
25
+
26
+ ```bash
27
+ cd your-project-dir
28
+ npx opencarly init
29
+ ```
30
+
31
+ This will create an `.opencarly` configuration directory in your project containing a `config.json` file and a `rules/` folder where you can place your dynamic guidelines.
32
+
33
+ ## ⚙️ Configuration
34
+
35
+ Open your newly created `.opencarly/config.json` to start adding rules.
36
+
37
+ A rule consists of:
38
+ - `name`: A descriptive name for the rule.
39
+ - `files`: (Optional) An array of file globs. The rule will automatically inject if any file matching these globs is loaded in OpenCode.
40
+ - `keywords`: (Optional) An array of keywords. The rule will inject if any of these words (prefixed with a `*`, like `*sql`) are typed in your prompt.
41
+ - `content`: The path to the markdown file containing your instructions (relative to the `.opencarly/rules/` directory).
42
+
43
+ ### Example Configuration
44
+
45
+ ```json
46
+ {
47
+ "rules": [
48
+ {
49
+ "name": "React Guidelines",
50
+ "files": ["**/*.tsx", "**/*.jsx", "components/**/*"],
51
+ "content": "react.md"
52
+ },
53
+ {
54
+ "name": "Database Schema",
55
+ "keywords": ["db", "sql", "database"],
56
+ "content": "schema.md"
57
+ }
58
+ ]
59
+ }
60
+ ```
61
+
62
+ With this setup:
63
+ - Editing a `Button.tsx` file will automatically inject the rules from `react.md`.
64
+ - Asking the AI "Please write a *sql query" will automatically inject the rules from `schema.md`.
65
+
66
+ ## 📊 Viewing Token Savings
67
+
68
+ You can see how many tokens OpenCarly has saved you by using the built-in stats command inside OpenCode:
69
+
70
+ ```text
71
+ user: *stats
72
+ ```
73
+
74
+ OpenCarly will output a detailed report showing total tokens trimmed, prompts processed, and an estimated dollar amount saved based on your current AI model's input token pricing.
75
+
76
+ ## 📝 License
77
+
78
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencarly",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "type": "module",
5
5
  "description": "Context Augmentation & Reinforcement Layer for OpenCode - Dynamic rules that load when relevant, disappear when not.",
6
6
  "main": "dist/index.js",