alma-memory 0.5.1__py3-none-any.whl → 0.7.0__py3-none-any.whl
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.
- alma/__init__.py +296 -226
- alma/compression/__init__.py +33 -0
- alma/compression/pipeline.py +980 -0
- alma/confidence/__init__.py +47 -47
- alma/confidence/engine.py +540 -540
- alma/confidence/types.py +351 -351
- alma/config/loader.py +157 -157
- alma/consolidation/__init__.py +23 -23
- alma/consolidation/engine.py +678 -678
- alma/consolidation/prompts.py +84 -84
- alma/core.py +1189 -430
- alma/domains/__init__.py +30 -30
- alma/domains/factory.py +359 -359
- alma/domains/schemas.py +448 -448
- alma/domains/types.py +272 -272
- alma/events/__init__.py +75 -75
- alma/events/emitter.py +285 -284
- alma/events/storage_mixin.py +246 -246
- alma/events/types.py +126 -126
- alma/events/webhook.py +425 -425
- alma/exceptions.py +49 -49
- alma/extraction/__init__.py +31 -31
- alma/extraction/auto_learner.py +265 -265
- alma/extraction/extractor.py +420 -420
- alma/graph/__init__.py +106 -106
- alma/graph/backends/__init__.py +32 -32
- alma/graph/backends/kuzu.py +624 -624
- alma/graph/backends/memgraph.py +432 -432
- alma/graph/backends/memory.py +236 -236
- alma/graph/backends/neo4j.py +417 -417
- alma/graph/base.py +159 -159
- alma/graph/extraction.py +198 -198
- alma/graph/store.py +860 -860
- alma/harness/__init__.py +35 -35
- alma/harness/base.py +386 -386
- alma/harness/domains.py +705 -705
- alma/initializer/__init__.py +37 -37
- alma/initializer/initializer.py +418 -418
- alma/initializer/types.py +250 -250
- alma/integration/__init__.py +62 -62
- alma/integration/claude_agents.py +444 -444
- alma/integration/helena.py +423 -423
- alma/integration/victor.py +471 -471
- alma/learning/__init__.py +101 -86
- alma/learning/decay.py +878 -0
- alma/learning/forgetting.py +1446 -1446
- alma/learning/heuristic_extractor.py +390 -390
- alma/learning/protocols.py +374 -374
- alma/learning/validation.py +346 -346
- alma/mcp/__init__.py +123 -45
- alma/mcp/__main__.py +156 -156
- alma/mcp/resources.py +122 -122
- alma/mcp/server.py +955 -591
- alma/mcp/tools.py +3254 -509
- alma/observability/__init__.py +91 -84
- alma/observability/config.py +302 -302
- alma/observability/guidelines.py +170 -0
- alma/observability/logging.py +424 -424
- alma/observability/metrics.py +583 -583
- alma/observability/tracing.py +440 -440
- alma/progress/__init__.py +21 -21
- alma/progress/tracker.py +607 -607
- alma/progress/types.py +250 -250
- alma/retrieval/__init__.py +134 -53
- alma/retrieval/budget.py +525 -0
- alma/retrieval/cache.py +1304 -1061
- alma/retrieval/embeddings.py +202 -202
- alma/retrieval/engine.py +850 -427
- alma/retrieval/modes.py +365 -0
- alma/retrieval/progressive.py +560 -0
- alma/retrieval/scoring.py +344 -344
- alma/retrieval/trust_scoring.py +637 -0
- alma/retrieval/verification.py +797 -0
- alma/session/__init__.py +19 -19
- alma/session/manager.py +442 -399
- alma/session/types.py +288 -288
- alma/storage/__init__.py +101 -90
- alma/storage/archive.py +233 -0
- alma/storage/azure_cosmos.py +1259 -1259
- alma/storage/base.py +1083 -583
- alma/storage/chroma.py +1443 -1443
- alma/storage/constants.py +103 -103
- alma/storage/file_based.py +614 -614
- alma/storage/migrations/__init__.py +21 -21
- alma/storage/migrations/base.py +321 -321
- alma/storage/migrations/runner.py +323 -323
- alma/storage/migrations/version_stores.py +337 -337
- alma/storage/migrations/versions/__init__.py +11 -11
- alma/storage/migrations/versions/v1_0_0.py +373 -373
- alma/storage/migrations/versions/v1_1_0_workflow_context.py +551 -0
- alma/storage/pinecone.py +1080 -1080
- alma/storage/postgresql.py +1948 -1559
- alma/storage/qdrant.py +1306 -1306
- alma/storage/sqlite_local.py +3041 -1457
- alma/testing/__init__.py +46 -46
- alma/testing/factories.py +301 -301
- alma/testing/mocks.py +389 -389
- alma/types.py +292 -264
- alma/utils/__init__.py +19 -0
- alma/utils/tokenizer.py +521 -0
- alma/workflow/__init__.py +83 -0
- alma/workflow/artifacts.py +170 -0
- alma/workflow/checkpoint.py +311 -0
- alma/workflow/context.py +228 -0
- alma/workflow/outcomes.py +189 -0
- alma/workflow/reducers.py +393 -0
- {alma_memory-0.5.1.dist-info → alma_memory-0.7.0.dist-info}/METADATA +210 -72
- alma_memory-0.7.0.dist-info/RECORD +112 -0
- alma_memory-0.5.1.dist-info/RECORD +0 -93
- {alma_memory-0.5.1.dist-info → alma_memory-0.7.0.dist-info}/WHEEL +0 -0
- {alma_memory-0.5.1.dist-info → alma_memory-0.7.0.dist-info}/top_level.txt +0 -0
alma/mcp/__init__.py
CHANGED
|
@@ -1,45 +1,123 @@
|
|
|
1
|
-
"""
|
|
2
|
-
ALMA MCP Server Module.
|
|
3
|
-
|
|
4
|
-
Exposes ALMA functionality to any Claude Code instance via the
|
|
5
|
-
Model Context Protocol (MCP).
|
|
6
|
-
|
|
7
|
-
Usage:
|
|
8
|
-
# stdio mode (for Claude Code integration)
|
|
9
|
-
python -m alma.mcp --config .alma/config.yaml
|
|
10
|
-
|
|
11
|
-
# HTTP mode (for remote access)
|
|
12
|
-
python -m alma.mcp --http --port 8765
|
|
13
|
-
|
|
14
|
-
Integration with Claude Code (.mcp.json):
|
|
15
|
-
{
|
|
16
|
-
"mcpServers": {
|
|
17
|
-
"alma-memory": {
|
|
18
|
-
"command": "python",
|
|
19
|
-
"args": ["-m", "alma.mcp", "--config", ".alma/config.yaml"]
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
1
|
+
"""
|
|
2
|
+
ALMA MCP Server Module.
|
|
3
|
+
|
|
4
|
+
Exposes ALMA functionality to any Claude Code instance via the
|
|
5
|
+
Model Context Protocol (MCP).
|
|
6
|
+
|
|
7
|
+
Usage:
|
|
8
|
+
# stdio mode (for Claude Code integration)
|
|
9
|
+
python -m alma.mcp --config .alma/config.yaml
|
|
10
|
+
|
|
11
|
+
# HTTP mode (for remote access)
|
|
12
|
+
python -m alma.mcp --http --port 8765
|
|
13
|
+
|
|
14
|
+
Integration with Claude Code (.mcp.json):
|
|
15
|
+
{
|
|
16
|
+
"mcpServers": {
|
|
17
|
+
"alma-memory": {
|
|
18
|
+
"command": "python",
|
|
19
|
+
"args": ["-m", "alma.mcp", "--config", ".alma/config.yaml"]
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
Async API:
|
|
25
|
+
Both sync and async variants of tools are available:
|
|
26
|
+
- Sync: alma_retrieve, alma_learn, etc.
|
|
27
|
+
- Async: async_alma_retrieve, async_alma_learn, etc.
|
|
28
|
+
|
|
29
|
+
Workflow Tools (v0.6.0):
|
|
30
|
+
Tools for AGtestari workflow integration:
|
|
31
|
+
- alma_checkpoint: Create crash recovery checkpoints
|
|
32
|
+
- alma_resume: Get checkpoint to resume from
|
|
33
|
+
- alma_merge_states: Merge parallel branch states
|
|
34
|
+
- alma_workflow_learn: Record workflow outcomes
|
|
35
|
+
- alma_link_artifact: Link artifacts to memories
|
|
36
|
+
- alma_get_artifacts: Get artifacts for a memory
|
|
37
|
+
- alma_cleanup_checkpoints: Clean up old checkpoints
|
|
38
|
+
- alma_retrieve_scoped: Scoped memory retrieval
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
from alma.mcp.server import ALMAMCPServer
|
|
42
|
+
from alma.mcp.tools import (
|
|
43
|
+
# Sync tools
|
|
44
|
+
alma_add_knowledge,
|
|
45
|
+
alma_add_preference,
|
|
46
|
+
# Workflow tools (v0.6.0)
|
|
47
|
+
alma_checkpoint,
|
|
48
|
+
alma_cleanup_checkpoints,
|
|
49
|
+
alma_consolidate,
|
|
50
|
+
alma_forget,
|
|
51
|
+
alma_get_artifacts,
|
|
52
|
+
alma_health,
|
|
53
|
+
alma_learn,
|
|
54
|
+
alma_link_artifact,
|
|
55
|
+
alma_merge_states,
|
|
56
|
+
alma_resume,
|
|
57
|
+
alma_retrieve,
|
|
58
|
+
# Mode-aware tools (v0.7.0)
|
|
59
|
+
alma_retrieve_for_mode,
|
|
60
|
+
alma_retrieve_scoped,
|
|
61
|
+
alma_retrieve_smart,
|
|
62
|
+
alma_stats,
|
|
63
|
+
alma_workflow_learn,
|
|
64
|
+
# Async tools
|
|
65
|
+
async_alma_add_knowledge,
|
|
66
|
+
async_alma_add_preference,
|
|
67
|
+
# Async workflow tools
|
|
68
|
+
async_alma_checkpoint,
|
|
69
|
+
async_alma_forget,
|
|
70
|
+
async_alma_health,
|
|
71
|
+
async_alma_learn,
|
|
72
|
+
async_alma_link_artifact,
|
|
73
|
+
async_alma_resume,
|
|
74
|
+
async_alma_retrieve,
|
|
75
|
+
# Async mode-aware tools (v0.7.0)
|
|
76
|
+
async_alma_retrieve_for_mode,
|
|
77
|
+
async_alma_retrieve_scoped,
|
|
78
|
+
async_alma_retrieve_smart,
|
|
79
|
+
async_alma_stats,
|
|
80
|
+
async_alma_workflow_learn,
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
__all__ = [
|
|
84
|
+
"ALMAMCPServer",
|
|
85
|
+
# Sync tools
|
|
86
|
+
"alma_retrieve",
|
|
87
|
+
"alma_learn",
|
|
88
|
+
"alma_add_preference",
|
|
89
|
+
"alma_add_knowledge",
|
|
90
|
+
"alma_forget",
|
|
91
|
+
"alma_stats",
|
|
92
|
+
"alma_health",
|
|
93
|
+
"alma_consolidate",
|
|
94
|
+
# Workflow tools (v0.6.0)
|
|
95
|
+
"alma_checkpoint",
|
|
96
|
+
"alma_resume",
|
|
97
|
+
"alma_merge_states",
|
|
98
|
+
"alma_workflow_learn",
|
|
99
|
+
"alma_link_artifact",
|
|
100
|
+
"alma_get_artifacts",
|
|
101
|
+
"alma_cleanup_checkpoints",
|
|
102
|
+
"alma_retrieve_scoped",
|
|
103
|
+
# Mode-aware tools (v0.7.0)
|
|
104
|
+
"alma_retrieve_for_mode",
|
|
105
|
+
"alma_retrieve_smart",
|
|
106
|
+
# Async tools
|
|
107
|
+
"async_alma_retrieve",
|
|
108
|
+
"async_alma_learn",
|
|
109
|
+
"async_alma_add_preference",
|
|
110
|
+
"async_alma_add_knowledge",
|
|
111
|
+
"async_alma_forget",
|
|
112
|
+
"async_alma_stats",
|
|
113
|
+
"async_alma_health",
|
|
114
|
+
# Async workflow tools
|
|
115
|
+
"async_alma_checkpoint",
|
|
116
|
+
"async_alma_resume",
|
|
117
|
+
"async_alma_workflow_learn",
|
|
118
|
+
"async_alma_link_artifact",
|
|
119
|
+
"async_alma_retrieve_scoped",
|
|
120
|
+
# Async mode-aware tools (v0.7.0)
|
|
121
|
+
"async_alma_retrieve_for_mode",
|
|
122
|
+
"async_alma_retrieve_smart",
|
|
123
|
+
]
|
alma/mcp/__main__.py
CHANGED
|
@@ -1,156 +1,156 @@
|
|
|
1
|
-
"""
|
|
2
|
-
ALMA MCP Server CLI Entry Point.
|
|
3
|
-
|
|
4
|
-
Usage:
|
|
5
|
-
# stdio mode (for Claude Code)
|
|
6
|
-
python -m alma.mcp --config .alma/config.yaml
|
|
7
|
-
|
|
8
|
-
# HTTP mode (for remote access)
|
|
9
|
-
python -m alma.mcp --http --port 8765
|
|
10
|
-
|
|
11
|
-
# With verbose logging
|
|
12
|
-
python -m alma.mcp --config .alma/config.yaml --verbose
|
|
13
|
-
"""
|
|
14
|
-
|
|
15
|
-
import argparse
|
|
16
|
-
import asyncio
|
|
17
|
-
import logging
|
|
18
|
-
import sys
|
|
19
|
-
from pathlib import Path
|
|
20
|
-
|
|
21
|
-
from alma import ALMA
|
|
22
|
-
from alma.mcp.server import ALMAMCPServer
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
def setup_logging(verbose: bool = False):
|
|
26
|
-
"""Configure logging."""
|
|
27
|
-
level = logging.DEBUG if verbose else logging.INFO
|
|
28
|
-
logging.basicConfig(
|
|
29
|
-
level=level,
|
|
30
|
-
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
|
31
|
-
stream=sys.stderr, # Log to stderr to avoid interfering with stdio
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
def main():
|
|
36
|
-
"""Main entry point."""
|
|
37
|
-
parser = argparse.ArgumentParser(
|
|
38
|
-
description="ALMA MCP Server - Memory for AI Agents",
|
|
39
|
-
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
40
|
-
epilog="""
|
|
41
|
-
Examples:
|
|
42
|
-
# Start in stdio mode for Claude Code
|
|
43
|
-
python -m alma.mcp --config .alma/config.yaml
|
|
44
|
-
|
|
45
|
-
# Start in HTTP mode on port 8765
|
|
46
|
-
python -m alma.mcp --http --port 8765
|
|
47
|
-
|
|
48
|
-
# Use with verbose logging
|
|
49
|
-
python -m alma.mcp --config .alma/config.yaml --verbose
|
|
50
|
-
""",
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
parser.add_argument(
|
|
54
|
-
"--config",
|
|
55
|
-
type=str,
|
|
56
|
-
default=".alma/config.yaml",
|
|
57
|
-
help="Path to ALMA config file (default: .alma/config.yaml)",
|
|
58
|
-
)
|
|
59
|
-
|
|
60
|
-
parser.add_argument(
|
|
61
|
-
"--http",
|
|
62
|
-
action="store_true",
|
|
63
|
-
help="Run in HTTP mode instead of stdio",
|
|
64
|
-
)
|
|
65
|
-
|
|
66
|
-
parser.add_argument(
|
|
67
|
-
"--host",
|
|
68
|
-
type=str,
|
|
69
|
-
default="0.0.0.0",
|
|
70
|
-
help="HTTP server host (default: 0.0.0.0)",
|
|
71
|
-
)
|
|
72
|
-
|
|
73
|
-
parser.add_argument(
|
|
74
|
-
"--port",
|
|
75
|
-
type=int,
|
|
76
|
-
default=8765,
|
|
77
|
-
help="HTTP server port (default: 8765)",
|
|
78
|
-
)
|
|
79
|
-
|
|
80
|
-
parser.add_argument(
|
|
81
|
-
"--verbose",
|
|
82
|
-
"-v",
|
|
83
|
-
action="store_true",
|
|
84
|
-
help="Enable verbose logging",
|
|
85
|
-
)
|
|
86
|
-
|
|
87
|
-
args = parser.parse_args()
|
|
88
|
-
|
|
89
|
-
# Setup logging
|
|
90
|
-
setup_logging(args.verbose)
|
|
91
|
-
logger = logging.getLogger(__name__)
|
|
92
|
-
|
|
93
|
-
# Load ALMA from config
|
|
94
|
-
config_path = Path(args.config)
|
|
95
|
-
if not config_path.exists():
|
|
96
|
-
logger.error(f"Config file not found: {config_path}")
|
|
97
|
-
logger.info("Creating default config...")
|
|
98
|
-
|
|
99
|
-
# Create minimal default config
|
|
100
|
-
config_path.parent.mkdir(parents=True, exist_ok=True)
|
|
101
|
-
with open(config_path, "w") as f:
|
|
102
|
-
f.write("""# ALMA Configuration
|
|
103
|
-
alma:
|
|
104
|
-
project_id: "default"
|
|
105
|
-
storage: "file"
|
|
106
|
-
storage_dir: ".alma"
|
|
107
|
-
embedding_provider: "local"
|
|
108
|
-
|
|
109
|
-
agents:
|
|
110
|
-
helena:
|
|
111
|
-
can_learn:
|
|
112
|
-
- testing_strategies
|
|
113
|
-
- selector_patterns
|
|
114
|
-
- form_testing
|
|
115
|
-
- accessibility_testing
|
|
116
|
-
cannot_learn:
|
|
117
|
-
- backend_logic
|
|
118
|
-
- database_queries
|
|
119
|
-
min_occurrences_for_heuristic: 3
|
|
120
|
-
|
|
121
|
-
victor:
|
|
122
|
-
can_learn:
|
|
123
|
-
- api_design_patterns
|
|
124
|
-
- authentication_patterns
|
|
125
|
-
- error_handling
|
|
126
|
-
- database_query_patterns
|
|
127
|
-
cannot_learn:
|
|
128
|
-
- frontend_styling
|
|
129
|
-
- ui_testing
|
|
130
|
-
min_occurrences_for_heuristic: 3
|
|
131
|
-
""")
|
|
132
|
-
logger.info(f"Created default config at {config_path}")
|
|
133
|
-
|
|
134
|
-
try:
|
|
135
|
-
alma = ALMA.from_config(str(config_path))
|
|
136
|
-
logger.info(f"Loaded ALMA from {config_path}")
|
|
137
|
-
logger.info(f"Project: {alma.project_id}")
|
|
138
|
-
logger.info(f"Agents: {list(alma.scopes.keys())}")
|
|
139
|
-
|
|
140
|
-
except Exception as e:
|
|
141
|
-
logger.exception(f"Failed to load ALMA: {e}")
|
|
142
|
-
sys.exit(1)
|
|
143
|
-
|
|
144
|
-
# Create and run server
|
|
145
|
-
server = ALMAMCPServer(alma=alma)
|
|
146
|
-
|
|
147
|
-
if args.http:
|
|
148
|
-
logger.info(f"Starting HTTP server on {args.host}:{args.port}")
|
|
149
|
-
asyncio.run(server.run_http(host=args.host, port=args.port))
|
|
150
|
-
else:
|
|
151
|
-
logger.info("Starting stdio server for Claude Code integration")
|
|
152
|
-
asyncio.run(server.run_stdio())
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
if __name__ == "__main__":
|
|
156
|
-
main()
|
|
1
|
+
"""
|
|
2
|
+
ALMA MCP Server CLI Entry Point.
|
|
3
|
+
|
|
4
|
+
Usage:
|
|
5
|
+
# stdio mode (for Claude Code)
|
|
6
|
+
python -m alma.mcp --config .alma/config.yaml
|
|
7
|
+
|
|
8
|
+
# HTTP mode (for remote access)
|
|
9
|
+
python -m alma.mcp --http --port 8765
|
|
10
|
+
|
|
11
|
+
# With verbose logging
|
|
12
|
+
python -m alma.mcp --config .alma/config.yaml --verbose
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
import argparse
|
|
16
|
+
import asyncio
|
|
17
|
+
import logging
|
|
18
|
+
import sys
|
|
19
|
+
from pathlib import Path
|
|
20
|
+
|
|
21
|
+
from alma import ALMA
|
|
22
|
+
from alma.mcp.server import ALMAMCPServer
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def setup_logging(verbose: bool = False):
|
|
26
|
+
"""Configure logging."""
|
|
27
|
+
level = logging.DEBUG if verbose else logging.INFO
|
|
28
|
+
logging.basicConfig(
|
|
29
|
+
level=level,
|
|
30
|
+
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
|
31
|
+
stream=sys.stderr, # Log to stderr to avoid interfering with stdio
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def main():
|
|
36
|
+
"""Main entry point."""
|
|
37
|
+
parser = argparse.ArgumentParser(
|
|
38
|
+
description="ALMA MCP Server - Memory for AI Agents",
|
|
39
|
+
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
40
|
+
epilog="""
|
|
41
|
+
Examples:
|
|
42
|
+
# Start in stdio mode for Claude Code
|
|
43
|
+
python -m alma.mcp --config .alma/config.yaml
|
|
44
|
+
|
|
45
|
+
# Start in HTTP mode on port 8765
|
|
46
|
+
python -m alma.mcp --http --port 8765
|
|
47
|
+
|
|
48
|
+
# Use with verbose logging
|
|
49
|
+
python -m alma.mcp --config .alma/config.yaml --verbose
|
|
50
|
+
""",
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
parser.add_argument(
|
|
54
|
+
"--config",
|
|
55
|
+
type=str,
|
|
56
|
+
default=".alma/config.yaml",
|
|
57
|
+
help="Path to ALMA config file (default: .alma/config.yaml)",
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
parser.add_argument(
|
|
61
|
+
"--http",
|
|
62
|
+
action="store_true",
|
|
63
|
+
help="Run in HTTP mode instead of stdio",
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
parser.add_argument(
|
|
67
|
+
"--host",
|
|
68
|
+
type=str,
|
|
69
|
+
default="0.0.0.0",
|
|
70
|
+
help="HTTP server host (default: 0.0.0.0)",
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
parser.add_argument(
|
|
74
|
+
"--port",
|
|
75
|
+
type=int,
|
|
76
|
+
default=8765,
|
|
77
|
+
help="HTTP server port (default: 8765)",
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
parser.add_argument(
|
|
81
|
+
"--verbose",
|
|
82
|
+
"-v",
|
|
83
|
+
action="store_true",
|
|
84
|
+
help="Enable verbose logging",
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
args = parser.parse_args()
|
|
88
|
+
|
|
89
|
+
# Setup logging
|
|
90
|
+
setup_logging(args.verbose)
|
|
91
|
+
logger = logging.getLogger(__name__)
|
|
92
|
+
|
|
93
|
+
# Load ALMA from config
|
|
94
|
+
config_path = Path(args.config)
|
|
95
|
+
if not config_path.exists():
|
|
96
|
+
logger.error(f"Config file not found: {config_path}")
|
|
97
|
+
logger.info("Creating default config...")
|
|
98
|
+
|
|
99
|
+
# Create minimal default config
|
|
100
|
+
config_path.parent.mkdir(parents=True, exist_ok=True)
|
|
101
|
+
with open(config_path, "w") as f:
|
|
102
|
+
f.write("""# ALMA Configuration
|
|
103
|
+
alma:
|
|
104
|
+
project_id: "default"
|
|
105
|
+
storage: "file"
|
|
106
|
+
storage_dir: ".alma"
|
|
107
|
+
embedding_provider: "local"
|
|
108
|
+
|
|
109
|
+
agents:
|
|
110
|
+
helena:
|
|
111
|
+
can_learn:
|
|
112
|
+
- testing_strategies
|
|
113
|
+
- selector_patterns
|
|
114
|
+
- form_testing
|
|
115
|
+
- accessibility_testing
|
|
116
|
+
cannot_learn:
|
|
117
|
+
- backend_logic
|
|
118
|
+
- database_queries
|
|
119
|
+
min_occurrences_for_heuristic: 3
|
|
120
|
+
|
|
121
|
+
victor:
|
|
122
|
+
can_learn:
|
|
123
|
+
- api_design_patterns
|
|
124
|
+
- authentication_patterns
|
|
125
|
+
- error_handling
|
|
126
|
+
- database_query_patterns
|
|
127
|
+
cannot_learn:
|
|
128
|
+
- frontend_styling
|
|
129
|
+
- ui_testing
|
|
130
|
+
min_occurrences_for_heuristic: 3
|
|
131
|
+
""")
|
|
132
|
+
logger.info(f"Created default config at {config_path}")
|
|
133
|
+
|
|
134
|
+
try:
|
|
135
|
+
alma = ALMA.from_config(str(config_path))
|
|
136
|
+
logger.info(f"Loaded ALMA from {config_path}")
|
|
137
|
+
logger.info(f"Project: {alma.project_id}")
|
|
138
|
+
logger.info(f"Agents: {list(alma.scopes.keys())}")
|
|
139
|
+
|
|
140
|
+
except Exception as e:
|
|
141
|
+
logger.exception(f"Failed to load ALMA: {e}")
|
|
142
|
+
sys.exit(1)
|
|
143
|
+
|
|
144
|
+
# Create and run server
|
|
145
|
+
server = ALMAMCPServer(alma=alma)
|
|
146
|
+
|
|
147
|
+
if args.http:
|
|
148
|
+
logger.info(f"Starting HTTP server on {args.host}:{args.port}")
|
|
149
|
+
asyncio.run(server.run_http(host=args.host, port=args.port))
|
|
150
|
+
else:
|
|
151
|
+
logger.info("Starting stdio server for Claude Code integration")
|
|
152
|
+
asyncio.run(server.run_stdio())
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
if __name__ == "__main__":
|
|
156
|
+
main()
|