@phartmann80/klaw 0.1.1 → 0.1.3

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/README.md CHANGED
@@ -1,34 +1,83 @@
1
- KLAW
2
-
3
- Local AI runtime for running agents with your own models and APIs.
4
-
5
- Usage
6
-
7
- npx klaw init
8
- npx klaw run "build a Next.js landing page"
9
-
10
- How it works
11
-
12
- KLAW executes tasks through a chain of agents. Each agent handles a specific part of the work.
13
-
14
- Agents
15
-
16
- Architect: Plans task steps
17
- Writer: Creates and modifies files
18
- Shell: Runs commands with permission prompts
19
- Fixer: Handles basic errors and retries
20
-
21
- Security
22
-
23
- Workspace isolation by default
24
- Permission prompts for shell commands
25
- No file writes outside workspace root
26
-
27
- Author
28
-
29
- Built by Paul Hartmann
30
- GitHub: @janpaul80
31
-
32
- License
33
-
34
- MIT
1
+ # KLAW
2
+
3
+ Local AI runtime for running agents with your own models and APIs.
4
+
5
+ KLAW is a lightweight local-first runtime that executes agents visibly in the terminal.
6
+
7
+ It focuses on:
8
+ - transparent execution
9
+ - visible shell actions
10
+ - workspace isolation
11
+ - simple agent flows
12
+ - developer control
13
+
14
+ No dashboards.
15
+ No cloud dependency.
16
+ No hidden orchestration layers.
17
+
18
+ ## Install
19
+
20
+ npm install -g @phartmann80/klaw
21
+
22
+ ## Quickstart
23
+
24
+ Initialize KLAW:
25
+
26
+ ```bash
27
+ klaw init
28
+ klaw doctor
29
+ klaw run "build a Next.js landing page"
30
+
31
+ What it does
32
+
33
+ KLAW runs tasks through a simple agent chain.
34
+
35
+ Architect: plans task steps
36
+ Writer: creates and modifies files
37
+ Shell: runs commands with permission prompts
38
+ Fixer: handles basic errors and retries
39
+
40
+ Current features
41
+ Local-first execution
42
+ Workspace isolation
43
+ Shell permission prompts
44
+ Live terminal output
45
+ Human-readable memory log
46
+ Minimal agent runtime
47
+ Example output
48
+ [KLAW][SYSTEM] Checking system status
49
+ [KLAW][SYSTEM] CLI initialized
50
+ [KLAW][ARCHITECT] Starting task: build a Next.js landing page
51
+ [KLAW][WRITER] Created: package.json
52
+ [KLAW][WRITER] Created: pages/index.js
53
+ [KLAW][SYSTEM] Demo complete
54
+ Philosophy
55
+
56
+ KLAW is built to stay small, transparent, and hackable.
57
+
58
+ No dashboards.
59
+ No cloud lock-in.
60
+ No heavy orchestration layer.
61
+
62
+ Package
63
+
64
+ npm: https://www.npmjs.com/package/@phartmann80/klaw
65
+
66
+ GitHub: https://github.com/janpaul80/klaw
67
+
68
+ Author
69
+
70
+ Built by Paul Hartmann
71
+ GitHub: @janpaul80
72
+
73
+ License
74
+
75
+ MIT
76
+
77
+
78
+ Then save it and push:
79
+
80
+ ```bash
81
+ git add README.md
82
+ git commit -m "improve README"
83
+ git push origin main
package/index.js CHANGED
@@ -3,23 +3,24 @@
3
3
  const { Command } = require('commander');
4
4
  const chalk = require('chalk');
5
5
  const path = require('path');
6
+ const os = require('os');
6
7
  const fs = require('fs');
7
8
  const { executeTask } = require('./src/agents/demo');
8
9
 
9
10
  const program = new Command();
10
- program.version('0.1.0');
11
+ program.version('0.1.3');
11
12
 
12
13
  program
13
14
  .command('init')
14
15
  .description('Initialize KLAW configuration')
15
16
  .action(() => {
16
- const configDir = path.join(process.env.HOME, '.klaw');
17
+ const configDir = path.join(os.homedir(), '.klaw');
17
18
  if (!fs.existsSync(configDir)) {
18
19
  fs.mkdirSync(configDir);
19
20
  }
20
21
 
21
22
  const config = {
22
- version: '0.1.0',
23
+ version: '0.1.3',
23
24
  defaultProvider: 'openai',
24
25
  workspace: path.join(process.cwd(), 'klaw-workspace'),
25
26
  providers: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phartmann80/klaw",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Local AI runtime for running agents with your own models and APIs",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -1,3 +1,5 @@
1
+ const { appendMemory } = require('../memory');
2
+
1
3
  class ArchitectAgent {
2
4
  constructor(task) {
3
5
  this.task = task;
@@ -1,3 +1,5 @@
1
+ const { appendMemory } = require('../memory');
2
+
1
3
  class FixerAgent {
2
4
  constructor(maxRetries = 3) {
3
5
  this.maxRetries = maxRetries;
@@ -9,6 +9,11 @@ class ShellAgent {
9
9
  }
10
10
 
11
11
  async run(command, reason) {
12
+ // Bypass npm install in the demo environment to avoid ENOENT errors
13
+ if (command.trim().startsWith('npm install') || command.trim().startsWith('npm run dev')) {
14
+ console.log(`[KLAW][SHELL] Skipping npm install in demo mode`);
15
+ return '';
16
+ }
12
17
  console.log(`[KLAW][SHELL] Command: ${command}`);
13
18
  console.log(`[KLAW][SHELL] Reason: ${reason}`);
14
19
 
@@ -1,4 +1,5 @@
1
1
  const fs = require('fs');
2
+ const { appendMemory } = require('../memory');
2
3
  const path = require('path');
3
4
 
4
5
  function isValidPath(workspaceRoot, targetPath) {
Binary file