@soederpop/luca 0.0.22 → 0.0.25
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/AGENTS.md +1 -1
- package/CLAUDE.md +6 -1
- package/assistants/codingAssistant/hooks.ts +0 -1
- package/assistants/lucaExpert/CORE.md +37 -0
- package/assistants/lucaExpert/hooks.ts +9 -0
- package/assistants/lucaExpert/tools.ts +177 -0
- package/commands/build-bootstrap.ts +41 -1
- package/docs/TABLE-OF-CONTENTS.md +0 -1
- package/docs/apis/clients/rest.md +5 -5
- package/docs/apis/features/agi/assistant.md +1 -1
- package/docs/apis/features/agi/conversation-history.md +6 -7
- package/docs/apis/features/agi/conversation.md +1 -1
- package/docs/apis/features/agi/semantic-search.md +1 -1
- package/docs/bootstrap/CLAUDE.md +1 -1
- package/docs/bootstrap/SKILL.md +7 -3
- package/docs/bootstrap/templates/luca-cli.ts +5 -0
- package/docs/mcp/readme.md +1 -1
- package/docs/prompts/check-for-undocumented-features.md +27 -0
- package/docs/tutorials/00-bootstrap.md +18 -0
- package/package.json +2 -2
- package/scripts/stamp-build.sh +12 -0
- package/scripts/test-docs-reader.ts +10 -0
- package/src/agi/container.server.ts +8 -5
- package/src/agi/features/assistant.ts +208 -55
- package/src/agi/features/assistants-manager.ts +138 -66
- package/src/agi/features/conversation.ts +46 -14
- package/src/agi/features/docs-reader.ts +142 -0
- package/src/agi/features/openapi.ts +1 -1
- package/src/agi/features/skills-library.ts +257 -313
- package/src/bootstrap/generated.ts +8163 -6
- package/src/cli/build-info.ts +4 -0
- package/src/cli/cli.ts +2 -1
- package/src/commands/bootstrap.ts +16 -1
- package/src/commands/eval.ts +6 -1
- package/src/commands/prompt.ts +4 -1
- package/src/commands/sandbox-mcp.ts +17 -7
- package/src/helper.ts +56 -2
- package/src/introspection/generated.agi.ts +2409 -1608
- package/src/introspection/generated.node.ts +902 -594
- package/src/introspection/generated.web.ts +1 -1
- package/src/node/container.ts +1 -1
- package/src/node/features/content-db.ts +251 -13
- package/src/node/features/git.ts +90 -0
- package/src/node/features/grep.ts +1 -1
- package/src/node/features/proc.ts +1 -0
- package/src/node/features/tts.ts +1 -1
- package/src/node/features/vm.ts +48 -0
- package/src/scaffolds/generated.ts +2 -2
- package/assistants/architect/CORE.md +0 -3
- package/assistants/architect/hooks.ts +0 -3
- package/assistants/architect/tools.ts +0 -10
- package/docs/apis/features/agi/skills-library.md +0 -234
- package/docs/reports/assistant-bugs.md +0 -38
- package/docs/reports/attach-pattern-usage.md +0 -18
- package/docs/reports/code-audit-results.md +0 -391
- package/docs/reports/console-hmr-design.md +0 -170
- package/docs/reports/helper-semantic-search.md +0 -72
- package/docs/reports/introspection-audit-tasks.md +0 -378
- package/docs/reports/luca-mcp-improvements.md +0 -128
- package/test-integration/skills-library.test.ts +0 -157
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
tags:
|
|
3
|
-
- mcp
|
|
4
|
-
- testing
|
|
5
|
-
- scaffolding
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## Problem
|
|
9
|
-
|
|
10
|
-
The luca MCP server (`luca sandbox-mcp`) had 5 introspection tools that Claude Code rarely used. When given tasks in luca projects, Claude Code would default to vanilla Node.js patterns — importing `fs`, `path`, installing npm packages — instead of using the container. The MCP wasn't teaching Claude Code *how* to work in the luca ecosystem.
|
|
11
|
-
|
|
12
|
-
The root cause: tool descriptions were informational but not prescriptive. They described what the tools do, but didn't tell Claude Code *when* to use them or *what workflow to follow*.
|
|
13
|
-
|
|
14
|
-
## What We Changed
|
|
15
|
-
|
|
16
|
-
### New MCP Tools
|
|
17
|
-
|
|
18
|
-
| Tool | Purpose | Why It Matters |
|
|
19
|
-
|---|---|---|
|
|
20
|
-
| `read_me` | Returns the behavioral contract — import rules, capability map, workflow | Gives Claude Code the "rules of the road" at session start. Verbose description tells it to call this BEFORE writing code. |
|
|
21
|
-
| `find_capability` | Returns full catalog of all features/clients/servers with descriptions | Single call that shows everything the container provides. Prevents the "I don't know what's available so I'll use npm" failure mode. |
|
|
22
|
-
| `scaffold` | Generates convention-correct boilerplate for any helper type | Eliminates guessing at patterns. Output includes schemas, JSDoc, module augmentation, registration — all the pieces Claude Code would otherwise get wrong. |
|
|
23
|
-
|
|
24
|
-
### Improved Existing Tools
|
|
25
|
-
|
|
26
|
-
- **`eval`**: Added "Use this to prototype and test container API calls before writing them into files" to the description
|
|
27
|
-
- **`describe_helper`**: Added "This is the API documentation — there is no other documentation available" to make it the authoritative source
|
|
28
|
-
- **`inspect_helper_instance`**: Added "Use this to inspect a live, running instance" to distinguish from static docs
|
|
29
|
-
|
|
30
|
-
### Scaffold System
|
|
31
|
-
|
|
32
|
-
Created `docs/scaffolds/` with tutorial+template markdown files for each helper type:
|
|
33
|
-
- `feature.md`, `client.md`, `server.md`, `command.md`, `endpoint.md`
|
|
34
|
-
|
|
35
|
-
Each scaffold:
|
|
36
|
-
- Explains WHY each section exists (for human learning)
|
|
37
|
-
- Uses `{{PascalName}}`, `{{camelName}}`, `{{description}}` template variables
|
|
38
|
-
- Includes a "Complete Example" that becomes the scaffold output
|
|
39
|
-
- Lists conventions and common mistakes
|
|
40
|
-
|
|
41
|
-
Build pipeline: `luca build-scaffolds` reads the markdown, extracts code blocks, generates `src/scaffolds/generated.ts`. This is imported by `sandbox-mcp.ts` and baked into the binary.
|
|
42
|
-
|
|
43
|
-
### z Re-export
|
|
44
|
-
|
|
45
|
-
Added `export { z } from 'zod'` to `src/node.ts` so consumer code can write `import { z } from '@soederpop/luca'` without needing zod installed.
|
|
46
|
-
|
|
47
|
-
### CLI Command
|
|
48
|
-
|
|
49
|
-
`luca scaffold <type> <name>` also available from the terminal, not just the MCP. Supports `--output` to write directly to a file and `--tutorial` to show the full teaching doc.
|
|
50
|
-
|
|
51
|
-
## Design Principles
|
|
52
|
-
|
|
53
|
-
1. **Prescriptive over informational** — Tool descriptions tell Claude Code exactly when and why to call each tool, not just what it returns
|
|
54
|
-
2. **One call to orient** — `read_me` + `find_capability` in two calls gives a complete picture. No need to explore incrementally.
|
|
55
|
-
3. **Correct by construction** — `scaffold` output is valid, convention-following code. The LLM fills in implementation, not boilerplate.
|
|
56
|
-
4. **Source of truth in markdown** — Scaffold templates live in `docs/scaffolds/*.md` as human-readable tutorials. The build script extracts code. One source, two consumers.
|
|
57
|
-
|
|
58
|
-
## Testing Approach
|
|
59
|
-
|
|
60
|
-
### Test Harness
|
|
61
|
-
|
|
62
|
-
Located in `playground/mcp-test/`. Simulates a consumer project:
|
|
63
|
-
- `.mcp.json` pointing at `luca sandbox-mcp`
|
|
64
|
-
- Minimal `CLAUDE.md` saying "this is a luca project, use the MCP"
|
|
65
|
-
- No luca source to read — the MCP is the only interface
|
|
66
|
-
|
|
67
|
-
### Challenges (Progressive Difficulty)
|
|
68
|
-
|
|
69
|
-
| # | Challenge | What It Tests |
|
|
70
|
-
|---|---|---|
|
|
71
|
-
| 01 | Build a `greet` command | Basic: Does it use the command pattern? Correct imports? |
|
|
72
|
-
| 02 | Build a `stopwatch` feature | Medium: Schemas, state, events, JSDoc, module augmentation |
|
|
73
|
-
| 03 | Build a todo REST API with endpoints | Hard: File-based routing, Zod validation, endpoint conventions |
|
|
74
|
-
| 04 | Build a REST client + command that uses it | Expert: Client pattern, cross-helper composition |
|
|
75
|
-
|
|
76
|
-
### Workflow
|
|
77
|
-
|
|
78
|
-
```
|
|
79
|
-
# 1. Run a challenge (Claude Code session in the test folder)
|
|
80
|
-
luca run-test --challenge 01-easy-command --clean
|
|
81
|
-
|
|
82
|
-
# 2. Review the output (separate Claude Code session grades it)
|
|
83
|
-
luca run-test --challenge 01-easy-command --review
|
|
84
|
-
|
|
85
|
-
# 3. Read the review
|
|
86
|
-
cat output/review-01-easy-command.md
|
|
87
|
-
|
|
88
|
-
# 4. Apply MCP improvements based on findings
|
|
89
|
-
# Edit docs/mcp/readme.md, docs/scaffolds/*.md, or tool descriptions
|
|
90
|
-
|
|
91
|
-
# 5. Rebuild scaffolds
|
|
92
|
-
luca build-scaffolds
|
|
93
|
-
|
|
94
|
-
# 6. Re-run the same challenge to see if improvements helped
|
|
95
|
-
luca run-test --challenge 01-easy-command --clean
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
### Grading Criteria
|
|
99
|
-
|
|
100
|
-
Each review evaluates:
|
|
101
|
-
- **Import compliance** — Only `@soederpop/luca` imports, no Node builtins, no npm
|
|
102
|
-
- **Pattern compliance** — Correct base class, schemas, static properties, registration
|
|
103
|
-
- **Convention compliance** — `.describe()` on Zod fields, JSDoc, naming conventions
|
|
104
|
-
- **MCP tool usage** — Did it call `read_me` first? Use `scaffold`? Use `find_capability`?
|
|
105
|
-
|
|
106
|
-
### Success Criteria
|
|
107
|
-
|
|
108
|
-
The MCP is "done" when:
|
|
109
|
-
1. All four challenges pass import + pattern compliance on the first run
|
|
110
|
-
2. Claude Code calls `read_me` and at least one discovery tool before writing code
|
|
111
|
-
3. The generated code could be copy-pasted into any luca project and work
|
|
112
|
-
|
|
113
|
-
## Files Created/Modified
|
|
114
|
-
|
|
115
|
-
### New files
|
|
116
|
-
- `docs/mcp/readme.md` — Behavioral contract
|
|
117
|
-
- `docs/scaffolds/{feature,client,server,command,endpoint}.md` — Scaffold templates
|
|
118
|
-
- `commands/build-scaffolds.ts` — Build script
|
|
119
|
-
- `src/scaffolds/generated.ts` — Generated template data
|
|
120
|
-
- `src/scaffolds/template.ts` — Shared template helpers
|
|
121
|
-
- `src/commands/scaffold.ts` — CLI scaffold command
|
|
122
|
-
- `playground/mcp-test/` — End-to-end test harness
|
|
123
|
-
|
|
124
|
-
### Modified files
|
|
125
|
-
- `src/commands/sandbox-mcp.ts` — Added 3 tools, improved descriptions
|
|
126
|
-
- `src/commands/index.ts` — Registered scaffold command
|
|
127
|
-
- `src/node.ts` — Added z re-export
|
|
128
|
-
- `package.json` — Added build:scaffolds to pipeline
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import { createAGIContainer } from './helpers'
|
|
2
|
-
import { mkdtempSync, mkdirSync, writeFileSync, rmSync, realpathSync } from 'fs'
|
|
3
|
-
import { join } from 'path'
|
|
4
|
-
import { tmpdir } from 'os'
|
|
5
|
-
|
|
6
|
-
describe('Skills Library Integration', () => {
|
|
7
|
-
let container: any
|
|
8
|
-
let tempDir: string
|
|
9
|
-
let skillsDir: string
|
|
10
|
-
|
|
11
|
-
beforeAll(async () => {
|
|
12
|
-
tempDir = realpathSync(mkdtempSync(join(tmpdir(), 'luca-skills-test-')))
|
|
13
|
-
skillsDir = join(tempDir, '.claude', 'skills')
|
|
14
|
-
|
|
15
|
-
// Create a test skill
|
|
16
|
-
const testSkillDir = join(skillsDir, 'code-review')
|
|
17
|
-
mkdirSync(testSkillDir, { recursive: true })
|
|
18
|
-
writeFileSync(
|
|
19
|
-
join(testSkillDir, 'SKILL.md'),
|
|
20
|
-
`---
|
|
21
|
-
name: code-review
|
|
22
|
-
description: Reviews code for common issues and suggests improvements
|
|
23
|
-
version: 1.0.0
|
|
24
|
-
tags:
|
|
25
|
-
- code
|
|
26
|
-
- review
|
|
27
|
-
---
|
|
28
|
-
|
|
29
|
-
## Instructions
|
|
30
|
-
|
|
31
|
-
Review the provided code for:
|
|
32
|
-
1. Common bugs and anti-patterns
|
|
33
|
-
2. Performance issues
|
|
34
|
-
3. Security vulnerabilities
|
|
35
|
-
`
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
// Create another test skill
|
|
39
|
-
const debugSkillDir = join(skillsDir, 'debug-helper')
|
|
40
|
-
mkdirSync(debugSkillDir, { recursive: true })
|
|
41
|
-
writeFileSync(
|
|
42
|
-
join(debugSkillDir, 'SKILL.md'),
|
|
43
|
-
`---
|
|
44
|
-
name: debug-helper
|
|
45
|
-
description: Helps debug runtime errors and exceptions
|
|
46
|
-
version: 1.0.0
|
|
47
|
-
tags:
|
|
48
|
-
- debug
|
|
49
|
-
- errors
|
|
50
|
-
---
|
|
51
|
-
|
|
52
|
-
## Instructions
|
|
53
|
-
|
|
54
|
-
Help the user debug their issue by asking clarifying questions.
|
|
55
|
-
`
|
|
56
|
-
)
|
|
57
|
-
|
|
58
|
-
container = createAGIContainer({ cwd: tempDir })
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
afterAll(() => {
|
|
62
|
-
rmSync(tempDir, { recursive: true, force: true })
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
it('loads skills from project directory', async () => {
|
|
66
|
-
const skills = container.feature('skillsLibrary', {
|
|
67
|
-
projectSkillsPath: join(tempDir, '.claude', 'skills'),
|
|
68
|
-
})
|
|
69
|
-
await skills.load()
|
|
70
|
-
|
|
71
|
-
const list = skills.list()
|
|
72
|
-
expect(list.length).toBeGreaterThanOrEqual(2)
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
it('finds a skill by name', async () => {
|
|
76
|
-
const skills = container.feature('skillsLibrary', {
|
|
77
|
-
projectSkillsPath: join(tempDir, '.claude', 'skills'),
|
|
78
|
-
})
|
|
79
|
-
await skills.load()
|
|
80
|
-
|
|
81
|
-
const entry = skills.find('code-review')
|
|
82
|
-
expect(entry).toBeDefined()
|
|
83
|
-
expect(entry!.name).toBe('code-review')
|
|
84
|
-
expect(entry!.description).toContain('Reviews code')
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
it('searches skills by keyword', async () => {
|
|
88
|
-
const skills = container.feature('skillsLibrary', {
|
|
89
|
-
projectSkillsPath: join(tempDir, '.claude', 'skills'),
|
|
90
|
-
})
|
|
91
|
-
await skills.load()
|
|
92
|
-
|
|
93
|
-
const results = skills.search('debug')
|
|
94
|
-
expect(results.length).toBeGreaterThanOrEqual(1)
|
|
95
|
-
expect(results[0].name).toBe('debug-helper')
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
it('creates a new skill', async () => {
|
|
99
|
-
const skills = container.feature('skillsLibrary', {
|
|
100
|
-
projectSkillsPath: join(tempDir, '.claude', 'skills'),
|
|
101
|
-
})
|
|
102
|
-
await skills.load()
|
|
103
|
-
|
|
104
|
-
const entry = await skills.create(
|
|
105
|
-
{
|
|
106
|
-
name: 'test-new-skill',
|
|
107
|
-
description: 'A skill created during testing',
|
|
108
|
-
body: '## Instructions\n\nDo test things.',
|
|
109
|
-
meta: { tags: ['test'], version: '0.1.0' },
|
|
110
|
-
},
|
|
111
|
-
'project'
|
|
112
|
-
)
|
|
113
|
-
|
|
114
|
-
expect(entry).toBeDefined()
|
|
115
|
-
expect(entry.name).toBe('test-new-skill')
|
|
116
|
-
|
|
117
|
-
// Verify it's findable
|
|
118
|
-
const found = skills.find('test-new-skill')
|
|
119
|
-
expect(found).toBeDefined()
|
|
120
|
-
})
|
|
121
|
-
|
|
122
|
-
it('removes a skill', async () => {
|
|
123
|
-
const skills = container.feature('skillsLibrary', {
|
|
124
|
-
projectSkillsPath: join(tempDir, '.claude', 'skills'),
|
|
125
|
-
})
|
|
126
|
-
await skills.load()
|
|
127
|
-
|
|
128
|
-
// Create one to remove
|
|
129
|
-
await skills.create(
|
|
130
|
-
{
|
|
131
|
-
name: 'to-remove',
|
|
132
|
-
description: 'Will be removed',
|
|
133
|
-
body: '## Instructions\n\nRemove me.',
|
|
134
|
-
meta: {},
|
|
135
|
-
},
|
|
136
|
-
'project'
|
|
137
|
-
)
|
|
138
|
-
|
|
139
|
-
const removed = await skills.remove('to-remove')
|
|
140
|
-
expect(removed).toBe(true)
|
|
141
|
-
|
|
142
|
-
const found = skills.find('to-remove')
|
|
143
|
-
expect(found).toBeUndefined()
|
|
144
|
-
})
|
|
145
|
-
|
|
146
|
-
it('generates system prompt block', async () => {
|
|
147
|
-
const skills = container.feature('skillsLibrary', {
|
|
148
|
-
projectSkillsPath: join(tempDir, '.claude', 'skills'),
|
|
149
|
-
})
|
|
150
|
-
await skills.load()
|
|
151
|
-
|
|
152
|
-
const block = skills.toSystemPromptBlock()
|
|
153
|
-
expect(typeof block).toBe('string')
|
|
154
|
-
expect(block).toContain('code-review')
|
|
155
|
-
expect(block).toContain('debug-helper')
|
|
156
|
-
})
|
|
157
|
-
})
|