Skip to content

Commit 51576e7

Browse files
authored
Merge pull request #3 from cgbarlow/llm_integration
Llm integration, production readiness - phase 1: week 1 of 4 complete
2 parents 29fc7f0 + 07411d3 commit 51576e7

102 files changed

Lines changed: 24642 additions & 50 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# ===================================================================
2+
# MODERN APPROACH: Use AI Model Profiles (Recommended)
3+
# ===================================================================
4+
# Specification: docs/specs/13-llm-profile-management.md
5+
#
6+
# Create and manage connection profiles for different LLM providers:
7+
#
8+
# machine-dream llm profile add \
9+
# --name lm-studio-local \
10+
# --provider lmstudio \
11+
# --base-url http://localhost:1234/v1 \
12+
# --model qwen3-30b \
13+
# --set-default
14+
#
15+
# machine-dream llm profile add \
16+
# --name openai-gpt4 \
17+
# --provider openai \
18+
# --base-url https://api.openai.com/v1 \
19+
# --api-key "${OPENAI_API_KEY}" \
20+
# --model gpt-4
21+
#
22+
# View all profiles:
23+
# machine-dream llm profile list
24+
#
25+
# Switch active profile:
26+
# machine-dream llm profile set <name>
27+
#
28+
# Test connection:
29+
# machine-dream llm profile test
30+
#
31+
# Use specific profile:
32+
# machine-dream llm play puzzles/easy-01.json --profile openai-gpt4
33+
#
34+
# Profiles are stored at: ~/.machine-dream/llm-profiles.json
35+
36+
# ===================================================================
37+
# API Keys (Referenced by Profiles)
38+
# ===================================================================
39+
# Store sensitive API keys here, reference in profiles as ${VAR_NAME}
40+
# Profiles will automatically resolve these environment variables
41+
42+
# OpenAI API Key (for openai provider profiles)
43+
# OPENAI_API_KEY=your-openai-key-here
44+
45+
# Anthropic API Key (for anthropic provider profiles)
46+
# ANTHROPIC_API_KEY=your-anthropic-key-here
47+
48+
# OpenRouter API Key (for openrouter provider profiles)
49+
# OPENROUTER_API_KEY=your-openrouter-key-here
50+
51+
# Custom API Keys (for custom provider profiles)
52+
# CUSTOM_LLM_API_KEY=your-custom-key-here
53+
54+
# ===================================================================
55+
# LEGACY: Direct Environment Variables (DEPRECATED)
56+
# ===================================================================
57+
# These environment variables are deprecated in favor of profiles.
58+
# They remain for backward compatibility but will be removed in v1.0.
59+
#
60+
# Migration: Run `machine-dream llm profile add` to create a profile
61+
# instead of using these variables.
62+
#
63+
# Legacy LM Studio Connection
64+
# LLM_BASE_URL=http://localhost:1234/v1
65+
# LLM_MODEL=qwen3-30b
66+
#
67+
# Legacy Generation Parameters
68+
# LLM_TEMPERATURE=0.7
69+
# LLM_MAX_TOKENS=1024
70+
# LLM_TIMEOUT=60000
71+
#
72+
# Legacy Learning Settings
73+
# LLM_MEMORY_ENABLED=true
74+
# LLM_MAX_HISTORY_MOVES=20
75+
76+
# ===================================================================
77+
# AgentDB Configuration
78+
# ===================================================================
79+
# AgentDB database path for memory persistence
80+
AGENTDB_PATH=./agent.db

.eslintrc.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"env": {
3+
"node": true,
4+
"es2021": true
5+
},
6+
"extends": [
7+
"eslint:recommended",
8+
"plugin:@typescript-eslint/recommended"
9+
],
10+
"parser": "@typescript-eslint/parser",
11+
"parserOptions": {
12+
"ecmaVersion": "latest",
13+
"sourceType": "module"
14+
},
15+
"rules": {
16+
"@typescript-eslint/no-explicit-any": "warn",
17+
"@typescript-eslint/no-unused-vars": "warn"
18+
}
19+
}

.github/workflows/ci.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, llm_integration]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v3
16+
17+
- name: Setup Node.js
18+
uses: actions/setup-node@v3
19+
with:
20+
node-version: '20'
21+
cache: 'npm'
22+
23+
- name: Install dependencies
24+
run: npm ci
25+
26+
- name: Run typecheck
27+
run: npm run typecheck
28+
29+
- name: Run lint
30+
run: npm run lint
31+
32+
- name: Run tests
33+
run: npm test -- --run
34+
35+
- name: Build project
36+
run: npm run build
37+
38+
# Optional: Upload coverage (can be enabled later with Codecov)
39+
# - name: Test coverage
40+
# run: npm test -- --coverage --run
41+
#
42+
# - name: Upload coverage to Codecov
43+
# uses: codecov/codecov-action@v3
44+
# with:
45+
# files: ./coverage/coverage-final.json

.machine-dream.json

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"memorySystem": "agentdb",
3+
"enableRL": true,
4+
"enableReflexion": true,
5+
"enableSkillLibrary": true,
6+
"solving": {
7+
"maxIterations": 50,
8+
"maxSolveTime": 300000,
9+
"reflectionInterval": 5,
10+
"attentionWindowSize": 10,
11+
"backtrackEnabled": false,
12+
"guessThreshold": 0.3,
13+
"strategies": [
14+
"naked-single",
15+
"hidden-single",
16+
"pointing-pairs",
17+
"box-line-reduction",
18+
"naked-pairs",
19+
"x-wing"
20+
]
21+
},
22+
"dreaming": {
23+
"schedule": "after-session",
24+
"compressionRatio": 10,
25+
"abstractionLevels": 4,
26+
"minSuccessRate": 0.7
27+
},
28+
"agentdb": {
29+
"dbPath": ".agentdb",
30+
"preset": "medium",
31+
"quantization": "scalar",
32+
"indexing": "hnsw"
33+
},
34+
"benchmarking": {
35+
"enabled": true,
36+
"outputDir": "./benchmarks",
37+
"parallel": 1
38+
},
39+
"logging": {
40+
"level": "info",
41+
"outputDir": "./logs",
42+
"format": "json"
43+
},
44+
"demo": {
45+
"mode": false,
46+
"speed": "realtime",
47+
"pauseOnInsight": false
48+
},
49+
"hooks": {
50+
"preTask": null,
51+
"postTask": null,
52+
"preEdit": null,
53+
"postEdit": null,
54+
"sessionEnd": null,
55+
"sessionRestore": null
56+
},
57+
"key": "value"
58+
}

CLAUDE.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,3 +350,51 @@ NEVER create files unless they're absolutely necessary for achieving your goal.
350350
ALWAYS prefer editing an existing file to creating a new one.
351351
NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested by the User.
352352
Never save working files, text/mds and tests to the root folder.
353+
354+
## 📋 Spec-Based Development (MANDATORY)
355+
356+
**CRITICAL RULE**: Always build to spec. No implementation changes unless outlined in specification documents.
357+
358+
### Specification-First Workflow
359+
360+
1. **Before implementing ANY feature**:
361+
- Check if feature is defined in `/docs/specs/`
362+
- If NOT defined → Update the spec first, then implement
363+
- If defined → Implement exactly as specified
364+
365+
2. **Specification Documents** (in order of dependency):
366+
| Spec | Document | Purpose |
367+
|------|----------|---------|
368+
| 01 | [Puzzle Engine](docs/specs/01-puzzle-engine-spec.md) | Sudoku generation, validation, rules |
369+
| 02 | [Memory System](docs/specs/02-memory-system-spec.md) | AgentDB integration & persistence |
370+
| 03 | [GRASP Loop](docs/specs/03-grasp-loop-spec.md) | Generate, Review, Absorb, Synthesize, Persist |
371+
| 04 | [Attention Mechanism](docs/specs/04-attention-mechanism-spec.md) | Focus and priority system |
372+
| 05 | [Dreaming Pipeline](docs/specs/05-dreaming-pipeline-spec.md) | 5-phase consolidation |
373+
| 06 | [Benchmarking Framework](docs/specs/06-benchmarking-framework-spec.md) | Performance testing |
374+
| 07 | [Integration Orchestration](docs/specs/07-integration-orchestration-spec.md) | System orchestration |
375+
| 08 | [AgentDB Integration](docs/specs/08-agentdb-integration-spec.md) | Native AgentDB features |
376+
| 09 | [CLI Interface](docs/specs/09-cli-interface-spec.md) | Command-line interface |
377+
| 10 | [Terminal UI](docs/specs/10-terminal-menu-interface-spec.md) | Interactive TUI with Ink |
378+
| 11 | [LLM Integration](docs/specs/11-llm-sudoku-player.md) | AI model Sudoku player |
379+
| 12 | [Puzzle Generation](docs/specs/12-randomized-puzzle-generation.md) | Seeded random puzzles |
380+
| 13 | [Profile Management](docs/specs/13-llm-profile-management.md) | AI model connection profiles |
381+
| 14 | [Console Menu](docs/specs/14-console-menu-interface-spec.md) | TUI console & help system |
382+
383+
3. **When specs conflict with implementation ideas**:
384+
- Specs are authoritative
385+
- Propose spec updates if needed
386+
- Never implement unspecified behavior
387+
388+
4. **Verification Checklist** (before any PR):
389+
- [ ] All new types defined in specs
390+
- [ ] All event types registered in Spec 07
391+
- [ ] All CLI commands match Spec 09
392+
- [ ] All TUI screens match Spec 10
393+
- [ ] Tests verify spec compliance
394+
395+
### Why Spec-Based Development?
396+
397+
- **Consistency**: All components follow the same contracts
398+
- **Traceability**: Every feature maps to a specification
399+
- **Reviewability**: Changes are validated against specs
400+
- **Maintainability**: Specs serve as living documentation

0 commit comments

Comments
 (0)