kairn-cli 1.0.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ashton Perlroth
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,169 @@
1
+ # Kairn
2
+
3
+ > Describe what you want done. Get an optimized Claude Code environment.
4
+
5
+ Kairn is a CLI that compiles natural language workflow descriptions into minimal, optimal [Claude Code](https://code.claude.com/) agent environments — complete with MCP servers, slash commands, skills, subagents, and security rules.
6
+
7
+ **No server. No account. Runs locally with your own LLM key.**
8
+
9
+ ## Why
10
+
11
+ Every agent needs an environment before it can work. Today, building that environment is manual and generic. The harness repos on GitHub give you 136 skills and hope you figure out which 6 matter for your task.
12
+
13
+ Kairn selects the right tools, generates workflow-specific instructions, and writes a production-quality `.claude/` directory in one command.
14
+
15
+ ## Install
16
+
17
+ ```bash
18
+ npm install -g kairn-cli
19
+ ```
20
+
21
+ Requires Node.js 18+. The command is `kairn`.
22
+
23
+ ## Quick Start
24
+
25
+ ```bash
26
+ # 1. Set up your LLM key (Anthropic, OpenAI, or Google)
27
+ kairn init
28
+
29
+ # 2. Describe your workflow
30
+ kairn describe "Build a Next.js app with Supabase auth"
31
+
32
+ # 3. Start coding
33
+ claude
34
+ ```
35
+
36
+ That's it. Kairn generates the entire `.claude/` directory — CLAUDE.md, MCP servers, slash commands, skills, agents, rules — tailored to your specific workflow.
37
+
38
+ ## What Gets Generated
39
+
40
+ ```
41
+ .claude/
42
+ ├── CLAUDE.md # Workflow-specific system prompt (<100 lines)
43
+ ├── settings.json # Permissions and security deny rules
44
+ ├── commands/ # Slash commands (show up when you type /)
45
+ │ ├── help.md # /project:help — environment guide
46
+ │ ├── tasks.md # /project:tasks — manage TODOs
47
+ │ ├── plan.md # /project:plan — plan before coding
48
+ │ └── ... # workflow-specific commands
49
+ ├── rules/ # Auto-loaded instructions
50
+ │ ├── security.md # Security best practices
51
+ │ └── continuity.md # Session memory (DECISIONS.md, LEARNINGS.md)
52
+ ├── skills/ # Model-controlled capabilities
53
+ │ └── {skill}/SKILL.md
54
+ ├── agents/ # Specialized subagents
55
+ │ └── {agent}.md
56
+ └── docs/ # Pre-initialized project memory
57
+ ├── TODO.md
58
+ ├── DECISIONS.md
59
+ └── LEARNINGS.md
60
+ .mcp.json # Project-scoped MCP server config
61
+ ```
62
+
63
+ ## Commands
64
+
65
+ ### `kairn init`
66
+
67
+ Interactive setup. Pick your LLM provider and model, paste your API key. Key stays local at `~/.kairn/config.json`.
68
+
69
+ Supported providers:
70
+ - **Anthropic** — Claude Sonnet 4, Opus 4, Haiku 3.5
71
+ - **OpenAI** — GPT-4o, GPT-4o mini, o3
72
+ - **Google** — Gemini 2.5 Flash, Gemini 2.5 Pro
73
+
74
+ ### `kairn describe [intent]`
75
+
76
+ The main command. Describe what you want your agent to do, and Kairn compiles an optimal environment.
77
+
78
+ ```bash
79
+ # Interactive
80
+ kairn describe
81
+
82
+ # Inline
83
+ kairn describe "Research ML papers on GRPO training and write a summary"
84
+
85
+ # Skip confirmation
86
+ kairn describe "Draft outreach emails from a CSV" --yes
87
+ ```
88
+
89
+ Kairn selects the minimal set of tools from a curated registry of 18 MCP servers, plugins, and hooks — then generates every file Claude Code needs.
90
+
91
+ ### `kairn list`
92
+
93
+ Show all saved environments.
94
+
95
+ ```
96
+ $ kairn list
97
+
98
+ nextjs-supabase-auth
99
+ Next.js app with Supabase authentication
100
+ 3/30/2026 · 7 tools · env_df2c0a23...
101
+
102
+ grpo-research
103
+ Research ML papers on GRPO training
104
+ 3/30/2026 · 4 tools · env_1638c54e...
105
+ ```
106
+
107
+ ### `kairn activate <env_id>`
108
+
109
+ Re-deploy a saved environment to any directory. Use the ID from `kairn list`.
110
+
111
+ ```bash
112
+ mkdir new-project && cd new-project
113
+ kairn activate env_df2c0a23
114
+ ```
115
+
116
+ ### `kairn update-registry`
117
+
118
+ Fetch the latest tool catalog from GitHub.
119
+
120
+ ```bash
121
+ kairn update-registry
122
+ ```
123
+
124
+ ## Tool Registry
125
+
126
+ Kairn ships with 18 curated tools across 6 tiers:
127
+
128
+ | Category | Tools |
129
+ |----------|-------|
130
+ | **Universal** | Context7, Sequential Thinking, security-guidance |
131
+ | **Code** | GitHub MCP, Playwright, Semgrep |
132
+ | **Search** | Exa, Brave Search, Firecrawl, Perplexity |
133
+ | **Data** | PostgreSQL (Bytebase), Supabase |
134
+ | **Communication** | Slack, Notion, Linear, AgentMail |
135
+ | **Design** | Figma, Frontend Design |
136
+
137
+ Tools are selected based on your workflow description. Fewer tools = less context bloat = better agent performance.
138
+
139
+ ## How It Works
140
+
141
+ 1. You describe your workflow in natural language
142
+ 2. Kairn sends your intent + its tool registry to an LLM
143
+ 3. The LLM selects the minimal tool set and generates a complete `EnvironmentSpec`
144
+ 4. Kairn writes the `.claude/` directory and `.mcp.json` from the spec
145
+ 5. The spec is saved locally so you can re-deploy it anywhere
146
+
147
+ The LLM call uses your own API key. Nothing is sent to Kairn servers (there are none).
148
+
149
+ ## Security
150
+
151
+ - **API keys stay local.** Stored at `~/.kairn/config.json`, never transmitted anywhere.
152
+ - **Every environment includes security rules.** Deny rules for `rm -rf`, `curl | sh`, reading `.env` and `secrets/`.
153
+ - **Curated registry only.** Every MCP server in the registry is manually verified. No auto-inclusion of unvetted tools.
154
+ - **Environment variable references.** MCP configs use `${ENV_VAR}` syntax — secrets never written to files.
155
+
156
+ ## Philosophy
157
+
158
+ - **Minimal over complete.** 5 well-chosen tools beat 50 generic ones.
159
+ - **Workflow-specific over generic.** Every file generated relates to your actual task.
160
+ - **Local-first.** No accounts, no servers, no telemetry.
161
+ - **Transparent.** You can inspect every generated file. Nothing is hidden.
162
+
163
+ ## License
164
+
165
+ MIT
166
+
167
+ ---
168
+
169
+ *Kairn — from kairos (the right moment) and cairn (the stack of stones marking the path).*
package/bin/kairn.js ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import "../dist/cli.js";