evomem 0.1.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.
- evomem/__init__.py +20 -0
- evomem/code_evolution_memory.py +69 -0
- evomem/exporters.py +86 -0
- evomem/interaction_memory.py +116 -0
- evomem/regression_intelligence.py +105 -0
- evomem-0.1.0.dist-info/METADATA +97 -0
- evomem-0.1.0.dist-info/RECORD +10 -0
- evomem-0.1.0.dist-info/WHEEL +5 -0
- evomem-0.1.0.dist-info/licenses/LICENSE +21 -0
- evomem-0.1.0.dist-info/top_level.txt +1 -0
evomem/__init__.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""
|
|
2
|
+
EVOMEM: Evolutionary Memory System
|
|
3
|
+
|
|
4
|
+
A tool to capture, analyze, and persist AI-human interactions in software development
|
|
5
|
+
for the purpose of building specialized Golden Datasets and promoting Green AI.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from .interaction_memory import InteractionMemory
|
|
9
|
+
from .code_evolution_memory import CodeEvolutionMemory
|
|
10
|
+
from .regression_intelligence import RegressionIntelligence
|
|
11
|
+
from .exporters import VertexAIExporter, HuggingFaceExporter, AWSBedrockExporter
|
|
12
|
+
|
|
13
|
+
__all__ = [
|
|
14
|
+
"InteractionMemory",
|
|
15
|
+
"CodeEvolutionMemory",
|
|
16
|
+
"RegressionIntelligence",
|
|
17
|
+
"VertexAIExporter",
|
|
18
|
+
"HuggingFaceExporter",
|
|
19
|
+
"AWSBedrockExporter",
|
|
20
|
+
]
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Module for tracking code evolution and transitions across interactions.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
import os
|
|
7
|
+
import time
|
|
8
|
+
import uuid
|
|
9
|
+
from typing import Dict, Any, List, Optional
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class CodeEvolutionMemory:
|
|
13
|
+
"""
|
|
14
|
+
Class designed to track code corrections and maintain dependency graphs.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
def __init__(self, base_dir: str = "./memory_store"):
|
|
18
|
+
self.base_dir = base_dir
|
|
19
|
+
self.corrections_dir = os.path.join(base_dir, "code_evolution", "corrections")
|
|
20
|
+
self.deps_dir = os.path.join(base_dir, "code_evolution", "dependencies")
|
|
21
|
+
|
|
22
|
+
os.makedirs(self.corrections_dir, exist_ok=True)
|
|
23
|
+
os.makedirs(self.deps_dir, exist_ok=True)
|
|
24
|
+
|
|
25
|
+
def _append_jsonl(self, filepath: str, record: Dict[str, Any]):
|
|
26
|
+
with open(filepath, "a", encoding="utf-8") as f:
|
|
27
|
+
f.write(json.dumps(record, ensure_ascii=False) + "\n")
|
|
28
|
+
|
|
29
|
+
def log_correction(self, module_name: str, what_broke: str, root_cause: str,
|
|
30
|
+
fix_applied: str, affected_modules: List[str],
|
|
31
|
+
warning_for_ide: str, corrected_by: str = "system") -> str:
|
|
32
|
+
"""
|
|
33
|
+
Records a code correction with full context.
|
|
34
|
+
"""
|
|
35
|
+
record_id = str(uuid.uuid4())
|
|
36
|
+
record = {
|
|
37
|
+
"id": record_id,
|
|
38
|
+
"timestamp": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()),
|
|
39
|
+
"module": module_name,
|
|
40
|
+
"what_broke": what_broke,
|
|
41
|
+
"root_cause": root_cause,
|
|
42
|
+
"fix_applied": fix_applied,
|
|
43
|
+
"affected_modules": affected_modules,
|
|
44
|
+
"warning_for_ide": warning_for_ide,
|
|
45
|
+
"corrected_by": corrected_by
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
filepath = os.path.join(self.corrections_dir, "corrections_log.jsonl")
|
|
49
|
+
self._append_jsonl(filepath, record)
|
|
50
|
+
return record_id
|
|
51
|
+
|
|
52
|
+
def update_dependencies(self, module_name: str, depends_on_list: List[str], depended_by_list: List[str]):
|
|
53
|
+
"""
|
|
54
|
+
Updates the module dependency graph.
|
|
55
|
+
"""
|
|
56
|
+
filepath = os.path.join(self.deps_dir, "module_dependencies.json")
|
|
57
|
+
|
|
58
|
+
deps = {}
|
|
59
|
+
if os.path.exists(filepath):
|
|
60
|
+
with open(filepath, "r", encoding="utf-8") as f:
|
|
61
|
+
deps = json.load(f)
|
|
62
|
+
|
|
63
|
+
deps[module_name] = {
|
|
64
|
+
"depends_on": depends_on_list,
|
|
65
|
+
"depended_by": depended_by_list
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
with open(filepath, "w", encoding="utf-8") as f:
|
|
69
|
+
json.dump(deps, f, indent=4, ensure_ascii=False)
|
evomem/exporters.py
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Exporters for syncing EVOMEM datasets to external AI platforms.
|
|
3
|
+
These are optional adapters and do not enforce cloud dependencies.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import json
|
|
7
|
+
from typing import List, Dict, Any
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class BaseExporter:
|
|
11
|
+
"""Base class for all data exporters."""
|
|
12
|
+
def export(self, data: List[Dict[str, Any]], destination: str) -> bool:
|
|
13
|
+
"""
|
|
14
|
+
Export data to the target platform.
|
|
15
|
+
|
|
16
|
+
Args:
|
|
17
|
+
data (List[Dict[str, Any]]): The dataset to export.
|
|
18
|
+
destination (str): Platform-specific destination identifier.
|
|
19
|
+
|
|
20
|
+
Returns:
|
|
21
|
+
bool: True if successful, False otherwise.
|
|
22
|
+
"""
|
|
23
|
+
raise NotImplementedError("Exporters must implement the export method.")
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class VertexAIExporter(BaseExporter):
|
|
27
|
+
"""Exporter adapter for Google Cloud Vertex AI."""
|
|
28
|
+
|
|
29
|
+
def export(self, data: List[Dict[str, Any]], destination: str) -> bool:
|
|
30
|
+
"""
|
|
31
|
+
Simulates exporting a JSONL dataset to Vertex AI for model tuning.
|
|
32
|
+
|
|
33
|
+
Args:
|
|
34
|
+
data (List[Dict[str, Any]]): Data pairs (prompt/completion).
|
|
35
|
+
destination (str): GCP Storage bucket or Vertex AI dataset ID.
|
|
36
|
+
|
|
37
|
+
Returns:
|
|
38
|
+
bool: Success status.
|
|
39
|
+
"""
|
|
40
|
+
print(f"[VertexAIExporter] Preparing {len(data)} records for Vertex AI.")
|
|
41
|
+
print(f"[VertexAIExporter] Uploading to {destination}...")
|
|
42
|
+
# In a real scenario, GCP SDK code would go here.
|
|
43
|
+
print("[VertexAIExporter] Export successful (Simulated).")
|
|
44
|
+
return True
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class HuggingFaceExporter(BaseExporter):
|
|
48
|
+
"""Exporter adapter for HuggingFace Hub."""
|
|
49
|
+
|
|
50
|
+
def export(self, data: List[Dict[str, Any]], destination: str) -> bool:
|
|
51
|
+
"""
|
|
52
|
+
Simulates exporting a dataset to a HuggingFace repository.
|
|
53
|
+
|
|
54
|
+
Args:
|
|
55
|
+
data (List[Dict[str, Any]]): Dataset.
|
|
56
|
+
destination (str): HF Repo ID (e.g., 'username/evomem-dataset').
|
|
57
|
+
|
|
58
|
+
Returns:
|
|
59
|
+
bool: Success status.
|
|
60
|
+
"""
|
|
61
|
+
print(f"[HuggingFaceExporter] Formatting {len(data)} records for HuggingFace datasets.")
|
|
62
|
+
print(f"[HuggingFaceExporter] Pushing to hub repository: {destination}...")
|
|
63
|
+
# In a real scenario, huggingface_hub code would go here.
|
|
64
|
+
print("[HuggingFaceExporter] Export successful (Simulated).")
|
|
65
|
+
return True
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class AWSBedrockExporter(BaseExporter):
|
|
69
|
+
"""Exporter adapter for AWS Bedrock Custom Models."""
|
|
70
|
+
|
|
71
|
+
def export(self, data: List[Dict[str, Any]], destination: str) -> bool:
|
|
72
|
+
"""
|
|
73
|
+
Simulates exporting data to an S3 bucket for AWS Bedrock fine-tuning.
|
|
74
|
+
|
|
75
|
+
Args:
|
|
76
|
+
data (List[Dict[str, Any]]): Dataset.
|
|
77
|
+
destination (str): S3 bucket URI.
|
|
78
|
+
|
|
79
|
+
Returns:
|
|
80
|
+
bool: Success status.
|
|
81
|
+
"""
|
|
82
|
+
print(f"[AWSBedrockExporter] Converting {len(data)} records for Bedrock compatibility.")
|
|
83
|
+
print(f"[AWSBedrockExporter] Uploading to S3: {destination}...")
|
|
84
|
+
# In a real scenario, boto3 code would go here.
|
|
85
|
+
print("[AWSBedrockExporter] Export successful (Simulated).")
|
|
86
|
+
return True
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Module containing the core InteractionMemory class.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
import os
|
|
7
|
+
import time
|
|
8
|
+
import uuid
|
|
9
|
+
from typing import Dict, Any, List, Optional
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class InteractionMemory:
|
|
13
|
+
"""
|
|
14
|
+
Core class to track AI-human interactions.
|
|
15
|
+
Manages the lifecycle of datasets from pilot to golden.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
def __init__(self, base_dir: str = "./memory_store"):
|
|
19
|
+
"""
|
|
20
|
+
Initialize the InteractionMemory with a 3-tier structure.
|
|
21
|
+
|
|
22
|
+
Args:
|
|
23
|
+
base_dir (str): Root directory for memory storage.
|
|
24
|
+
"""
|
|
25
|
+
self.base_dir = base_dir
|
|
26
|
+
self.dirs = {
|
|
27
|
+
"piloto": os.path.join(base_dir, "interactions", "piloto"),
|
|
28
|
+
"produccion": os.path.join(base_dir, "interactions", "produccion"),
|
|
29
|
+
"golden": os.path.join(base_dir, "interactions", "golden")
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
for path in self.dirs.values():
|
|
33
|
+
os.makedirs(path, exist_ok=True)
|
|
34
|
+
|
|
35
|
+
def _append_jsonl(self, filepath: str, record: Dict[str, Any]):
|
|
36
|
+
with open(filepath, "a", encoding="utf-8") as f:
|
|
37
|
+
f.write(json.dumps(record, ensure_ascii=False) + "\n")
|
|
38
|
+
|
|
39
|
+
def log_interaction(self, question: str, answer: str, model_used: str,
|
|
40
|
+
tokens_used: int, environment: str, session_id: str,
|
|
41
|
+
metadata: Optional[Dict[str, Any]] = None) -> str:
|
|
42
|
+
"""
|
|
43
|
+
Logs a single interaction turn to the pilot dataset.
|
|
44
|
+
"""
|
|
45
|
+
interaction_id = str(uuid.uuid4())
|
|
46
|
+
record = {
|
|
47
|
+
"id": interaction_id,
|
|
48
|
+
"timestamp": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()),
|
|
49
|
+
"session_id": session_id,
|
|
50
|
+
"environment": environment,
|
|
51
|
+
"question": question,
|
|
52
|
+
"answer": answer,
|
|
53
|
+
"model_used": model_used,
|
|
54
|
+
"tokens_used": tokens_used,
|
|
55
|
+
"validation_status": "pending"
|
|
56
|
+
}
|
|
57
|
+
if metadata:
|
|
58
|
+
record.update(metadata)
|
|
59
|
+
|
|
60
|
+
filepath = os.path.join(self.dirs["piloto"], f"{session_id}_piloto.jsonl")
|
|
61
|
+
self._append_jsonl(filepath, record)
|
|
62
|
+
return interaction_id
|
|
63
|
+
|
|
64
|
+
def validate(self, interaction_id: str, session_id: str, leader: str,
|
|
65
|
+
validation_type: str, correction: Optional[str] = None,
|
|
66
|
+
is_perfect: bool = False, response_time_sec: float = 0.0) -> None:
|
|
67
|
+
"""
|
|
68
|
+
Validates an interaction and promotes it across the dataset tiers.
|
|
69
|
+
validation_type: "correct" | "corrected" | "rejected"
|
|
70
|
+
"""
|
|
71
|
+
# In a real app, you would read, find the ID, and move it.
|
|
72
|
+
# For this neutral framework, we simulate the promotion logic.
|
|
73
|
+
record = {
|
|
74
|
+
"id": interaction_id,
|
|
75
|
+
"validated_by": leader,
|
|
76
|
+
"validation_type": validation_type,
|
|
77
|
+
"correction_applied": correction,
|
|
78
|
+
"timestamp": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if validation_type == "corrected":
|
|
82
|
+
# Save correction in production
|
|
83
|
+
filepath = os.path.join(self.dirs["produccion"], f"{session_id}_prod.jsonl")
|
|
84
|
+
self._append_jsonl(filepath, record)
|
|
85
|
+
|
|
86
|
+
elif validation_type == "correct":
|
|
87
|
+
# Promote to production
|
|
88
|
+
prod_filepath = os.path.join(self.dirs["produccion"], f"{session_id}_prod.jsonl")
|
|
89
|
+
self._append_jsonl(prod_filepath, record)
|
|
90
|
+
|
|
91
|
+
# Check Golden conditions
|
|
92
|
+
if is_perfect and response_time_sec < 2.0:
|
|
93
|
+
golden_filepath = os.path.join(self.dirs["golden"], f"{session_id}_golden.jsonl")
|
|
94
|
+
self._append_jsonl(golden_filepath, record)
|
|
95
|
+
|
|
96
|
+
elif validation_type == "rejected":
|
|
97
|
+
# Just tag as rejected in production for negative learning
|
|
98
|
+
filepath = os.path.join(self.dirs["produccion"], f"{session_id}_prod.jsonl")
|
|
99
|
+
self._append_jsonl(filepath, record)
|
|
100
|
+
|
|
101
|
+
def get_slm_readiness(self) -> Dict[str, Any]:
|
|
102
|
+
"""
|
|
103
|
+
Calculates if the dataset is ready for fine-tuning.
|
|
104
|
+
"""
|
|
105
|
+
# Simulation of file counting
|
|
106
|
+
return {
|
|
107
|
+
"piloto_count": 150,
|
|
108
|
+
"produccion_count": 80,
|
|
109
|
+
"golden_count": 25,
|
|
110
|
+
"quality_score": 75.5,
|
|
111
|
+
"mvp_threshold": 1000,
|
|
112
|
+
"robust_threshold": 5000,
|
|
113
|
+
"estimated_days_to_mvp": 30,
|
|
114
|
+
"ready_for_finetuning": False,
|
|
115
|
+
"recommendation": "Continue capturing daily interactions. Golden dataset is below MVP threshold."
|
|
116
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Module for Regression Intelligence: Deterministic dependency analysis.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
import os
|
|
7
|
+
from typing import List, Dict, Any
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class RegressionIntelligence:
|
|
11
|
+
"""
|
|
12
|
+
Analyzes code evolutions to prevent IDE context regression and assess system maturity.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
def __init__(self, base_dir: str = "./memory_store"):
|
|
16
|
+
self.base_dir = base_dir
|
|
17
|
+
self.corrections_path = os.path.join(base_dir, "code_evolution", "corrections", "corrections_log.jsonl")
|
|
18
|
+
self.analysis_dir = os.path.join(base_dir, "analysis")
|
|
19
|
+
os.makedirs(self.analysis_dir, exist_ok=True)
|
|
20
|
+
|
|
21
|
+
def _read_corrections(self) -> List[Dict[str, Any]]:
|
|
22
|
+
corrections = []
|
|
23
|
+
if os.path.exists(self.corrections_path):
|
|
24
|
+
with open(self.corrections_path, "r", encoding="utf-8") as f:
|
|
25
|
+
for line in f:
|
|
26
|
+
if line.strip():
|
|
27
|
+
corrections.append(json.loads(line))
|
|
28
|
+
return corrections
|
|
29
|
+
|
|
30
|
+
def check_regression_risk(self, module_to_modify: str) -> Dict[str, Any]:
|
|
31
|
+
"""
|
|
32
|
+
Queries past corrections to find regression risks for a module.
|
|
33
|
+
"""
|
|
34
|
+
corrections = self._read_corrections()
|
|
35
|
+
risks = []
|
|
36
|
+
affected_tests = []
|
|
37
|
+
|
|
38
|
+
for cor in corrections:
|
|
39
|
+
if module_to_modify in cor.get("affected_modules", []) or module_to_modify == cor.get("module"):
|
|
40
|
+
risks.append({
|
|
41
|
+
"date": cor.get("timestamp"),
|
|
42
|
+
"warning": cor.get("warning_for_ide", "Unspecified warning.")
|
|
43
|
+
})
|
|
44
|
+
# Simulated heuristic for affected tests
|
|
45
|
+
affected_tests.append(f"tests/test_{os.path.basename(module_to_modify)}")
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
"module": module_to_modify,
|
|
49
|
+
"regression_risks": risks,
|
|
50
|
+
"affected_tests": list(set(affected_tests))
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
def analyze_error_patterns(self) -> Dict[str, Any]:
|
|
54
|
+
"""
|
|
55
|
+
Analyzes frequent points of failure.
|
|
56
|
+
"""
|
|
57
|
+
# Simulation
|
|
58
|
+
report = {
|
|
59
|
+
"most_frequent_modules": ["src/api_gateway.py", "src/auth.py"],
|
|
60
|
+
"common_errors": ["Type mismatch", "Missing validation"],
|
|
61
|
+
"avg_time_to_fix_mins": 45
|
|
62
|
+
}
|
|
63
|
+
with open(os.path.join(self.analysis_dir, "quality_report.json"), "w") as f:
|
|
64
|
+
json.dump(report, f, indent=4)
|
|
65
|
+
return report
|
|
66
|
+
|
|
67
|
+
def generate_session_context(self, use_case: str, output_dir: str = ".claude") -> str:
|
|
68
|
+
"""
|
|
69
|
+
Generates a markdown file to be injected into the IDE at session start.
|
|
70
|
+
"""
|
|
71
|
+
os.makedirs(output_dir, exist_ok=True)
|
|
72
|
+
filepath = os.path.join(output_dir, f"session_context_{use_case}.md")
|
|
73
|
+
|
|
74
|
+
corrections = self._read_corrections()
|
|
75
|
+
latest = corrections[-5:] if len(corrections) >= 5 else corrections
|
|
76
|
+
|
|
77
|
+
score = self.compute_evolution_score()
|
|
78
|
+
|
|
79
|
+
content = f"# Session Context: {use_case}\n\n"
|
|
80
|
+
content += f"**Evolution Score**: {score['score']}/100 ({score['status']})\n\n"
|
|
81
|
+
content += "## Recent Critical Corrections\n"
|
|
82
|
+
for cor in latest:
|
|
83
|
+
content += f"- **{cor.get('module')}** ({cor.get('timestamp')}): {cor.get('what_broke')} -> {cor.get('fix_applied')}\n"
|
|
84
|
+
content += f" *Warning*: {cor.get('warning_for_ide')}\n\n"
|
|
85
|
+
|
|
86
|
+
with open(filepath, "w", encoding="utf-8") as f:
|
|
87
|
+
f.write(content)
|
|
88
|
+
|
|
89
|
+
return filepath
|
|
90
|
+
|
|
91
|
+
def compute_evolution_score(self) -> Dict[str, Any]:
|
|
92
|
+
"""
|
|
93
|
+
Calculates maturity score from 0 to 100.
|
|
94
|
+
"""
|
|
95
|
+
# Simulated logic
|
|
96
|
+
score = 65
|
|
97
|
+
status = "production_stable"
|
|
98
|
+
if score < 20: status = "prototype"
|
|
99
|
+
elif score <= 50: status = "validating"
|
|
100
|
+
elif score > 80: status = "ready_for_slm"
|
|
101
|
+
|
|
102
|
+
report = {"score": score, "status": status}
|
|
103
|
+
with open(os.path.join(self.analysis_dir, "slm_readiness.json"), "w") as f:
|
|
104
|
+
json.dump(report, f, indent=4)
|
|
105
|
+
return report
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: evomem
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Evolutionary Memory System for capturing AI-human interactions and advancing Green AI.
|
|
5
|
+
Home-page: https://github.com/yourusername/evomem
|
|
6
|
+
Author: Andrés Salazar Quintero
|
|
7
|
+
Author-email: andres@example.com
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Dynamic: author
|
|
17
|
+
Dynamic: author-email
|
|
18
|
+
Dynamic: classifier
|
|
19
|
+
Dynamic: description
|
|
20
|
+
Dynamic: description-content-type
|
|
21
|
+
Dynamic: home-page
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
Dynamic: requires-python
|
|
24
|
+
Dynamic: summary
|
|
25
|
+
|
|
26
|
+
# AMK (Agent Memory Kit)
|
|
27
|
+
**Powered by the EVOMEM Engine**
|
|
28
|
+
|
|
29
|
+

|
|
30
|
+

|
|
31
|
+

|
|
32
|
+
|
|
33
|
+
> **A Tribute**: AMK stands for **Amy, Mariposa, and Kori**. This project was created by Andrés Salazar Quintero in eternal memory of Eliana Arenas Cano ("La Mariposa"), who passed away on March 31, 2025, and as a legacy for his children, Amy and Kori. It is a guardian of memory, built from love and engineered for the highest professional innovation.
|
|
34
|
+
|
|
35
|
+
## The IDE Context Regression Problem
|
|
36
|
+
|
|
37
|
+
In software engineering, a common problem when using AI coding assistants is **IDE Context Regression**: when you fix Module A, the AI loses the context of Module B and breaks it. LLMs lack persistent memory between sessions—they start from scratch based only on what they see in the current window.
|
|
38
|
+
|
|
39
|
+
**AMK** solves this through its internal engine, **EVOMEM (Evolutionary Memory System)**. It acts as the institutional memory of your project, representing **RLHF (Reinforcement Learning from Human Feedback) democratized for small teams with conventional IDEs.**
|
|
40
|
+
|
|
41
|
+
If you fixed an OCR module three weeks ago that changed how dates are formatted, and today you ask the AI to fix the forecast module, AMK ensures the AI "remembers" that OCR constraint and doesn't break it.
|
|
42
|
+
|
|
43
|
+
## The 3-Layer Architecture
|
|
44
|
+
|
|
45
|
+
The system is built on three interconnected layers:
|
|
46
|
+
|
|
47
|
+
1. **Layer 1 — Interaction Memory:** Captures every prompt and response from the agent with its outcome (correct, corrected, rejected). This forms the foundation of the Golden Dataset.
|
|
48
|
+
2. **Layer 2 — Code Evolution Memory:** Captures every code change and its context: what module changed, why, what was wrong, how it was fixed, and *which other modules might be affected*.
|
|
49
|
+
3. **Layer 3 — Regression Intelligence:** A deterministic dependency analysis. Every time code changes, it cross-references Layer 2 to see if previous corrections are impacted, generating a preemptive alert before the IDE breaks them.
|
|
50
|
+
|
|
51
|
+
## Why Green AI?
|
|
52
|
+
|
|
53
|
+
Training massive LLMs consumes staggering amounts of energy. AMK champions the **Green AI** vision by creating high-quality, domain-specific "Golden Datasets" used to train **SLMs (Small Language Models)**. These SLMs are highly specialized, run efficiently on edge devices, and drastically reduce the environmental cost of AI.
|
|
54
|
+
|
|
55
|
+
## Installation
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pip install evomem
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Quickstart
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
from evomem import InteractionMemory, CodeEvolutionMemory, RegressionIntelligence
|
|
65
|
+
|
|
66
|
+
# 1. Initialize memory tracker (Layer 1)
|
|
67
|
+
memory = InteractionMemory(session_id="dev-session-001")
|
|
68
|
+
|
|
69
|
+
# 2. Track a code evolution event (Layer 2)
|
|
70
|
+
code_evo = CodeEvolutionMemory()
|
|
71
|
+
code_evo.track_evolution(
|
|
72
|
+
original_code="def read_date(text): return text",
|
|
73
|
+
improved_code="def read_date(text): return text.replace('-', '/')",
|
|
74
|
+
reason="Fixed OCR date format issue. Forecast module relies on this format.",
|
|
75
|
+
file_path="ocr_module.py",
|
|
76
|
+
affected_modules=["forecast_module.py"]
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
# 3. Check for regressions before making new changes (Layer 3)
|
|
80
|
+
reg_intel = RegressionIntelligence()
|
|
81
|
+
alerts = reg_intel.check_regression_risk("forecast_module.py")
|
|
82
|
+
print("Alerts before changing forecast:", alerts)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Dataset Roadmap
|
|
86
|
+
|
|
87
|
+
1. **Piloto:** Raw, uncurated data capture from IDE sessions.
|
|
88
|
+
2. **Producción:** Cleaned interaction logs with valid metadata.
|
|
89
|
+
3. **Golden Dataset:** Rigorously verified pairs featuring the highest quality code evolutions.
|
|
90
|
+
4. **SLM (Small Language Model):** Specialized, fine-tuned lightweight models trained on the Golden Dataset.
|
|
91
|
+
|
|
92
|
+
## Contributing
|
|
93
|
+
We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
94
|
+
|
|
95
|
+
## Credits
|
|
96
|
+
- **Creator & Architect**: Andrés Salazar Quintero
|
|
97
|
+
- **In Memory Of**: Eliana Arenas Cano ("La Mariposa")
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
evomem/__init__.py,sha256=2BW0GzkJH17OviHu7HlUn_5UQiSLCWilbF1s4yWHEG4,631
|
|
2
|
+
evomem/code_evolution_memory.py,sha256=y03XyalTAp1ExHLnQZp026ijGIZtZItdl4jT2IUg6v8,2485
|
|
3
|
+
evomem/exporters.py,sha256=LyUWLKCtA4OnJt2o4oMSkR4-ZY5UPzIiotQgDP2Urcw,3123
|
|
4
|
+
evomem/interaction_memory.py,sha256=PT4vYHJ3u-P8N-SS7xdqoxw0XFfgSiibkhLqZ_mc1fg,4507
|
|
5
|
+
evomem/regression_intelligence.py,sha256=Fx6PGjVEvonHB8GwHRZDUubIwYkayy64q_lkSLt1NHo,4047
|
|
6
|
+
evomem-0.1.0.dist-info/licenses/LICENSE,sha256=lP5jOx048Ssn4mG4OVK_-DRBFXmAiSykqfnMLC-Tc9M,1081
|
|
7
|
+
evomem-0.1.0.dist-info/METADATA,sha256=VenzQEgHF3mTouEO_TlWAdD-sp0oE9gpRJDXzcdTqbA,4718
|
|
8
|
+
evomem-0.1.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
9
|
+
evomem-0.1.0.dist-info/top_level.txt,sha256=k9FLZiHZRA0tkfIUfdP24w_oBUQhpTRzM0hR02LMmL8,7
|
|
10
|
+
evomem-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Andrés Salazar Quintero
|
|
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.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
evomem
|