71 lines
2.2 KiB
Python
71 lines
2.2 KiB
Python
#!/usr/bin/env python3
|
|
"""Generate Hermes agent profile configuration templates."""
|
|
|
|
import json
|
|
from pathlib import Path
|
|
from datetime import datetime, timezone
|
|
|
|
def build_profile(name: str, description: str, lane: str = None) -> dict:
|
|
"""Build a profile configuration dictionary."""
|
|
profile = {
|
|
"id": name.lower().replace(" ", "-"),
|
|
"name": name,
|
|
"description": description,
|
|
"created": datetime.now(timezone.utc).isoformat(),
|
|
"model": {
|
|
"provider": "nous",
|
|
"name": "poolside/laguna-xs-2.1:free"
|
|
},
|
|
"preferences": {
|
|
"response_style": "concise",
|
|
"evidence_required": True,
|
|
"stub_penalty": True
|
|
}
|
|
}
|
|
if lane:
|
|
profile["lane"] = lane
|
|
return profile
|
|
|
|
def save_profile(profile: dict, output_dir: str = "/root/.hermes/profiles") -> Path:
|
|
"""Save profile to the standard Hermes profile directory."""
|
|
profile_path = Path(output_dir) / profile["id"]
|
|
profile_path.mkdir(parents=True, exist_ok=True)
|
|
|
|
# Write the main profile file
|
|
profile_file = profile_path / "profile.yaml"
|
|
yaml_content = f"""# {profile['name']} Profile
|
|
# {profile['description']}
|
|
|
|
id: {profile['id']}
|
|
name: {profile['name']}
|
|
description: {profile['description']}
|
|
created: {profile['created']}
|
|
model:
|
|
provider: {profile['model']['provider']}
|
|
name: {profile['model']['name']}
|
|
preferences:
|
|
response_style: {profile['preferences']['response_style']}
|
|
evidence_required: {profile['preferences']['evidence_required']}
|
|
stub_penalty: {profile['preferences']['stub_penalty']}
|
|
"""
|
|
profile_file.write_text(yaml_content)
|
|
|
|
# Create directory.json
|
|
dir_json = profile_path / "directory.json"
|
|
dir_json.write_text(json.dumps({"type": "profile", "path": str(profile_path)}, indent=2))
|
|
|
|
return profile_path
|
|
|
|
if __name__ == "__main__":
|
|
import sys
|
|
if len(sys.argv) < 3:
|
|
print("Usage: hermes_profile_builder.py <name> <description> [lane]")
|
|
sys.exit(1)
|
|
|
|
name = sys.argv[1]
|
|
desc = sys.argv[2]
|
|
lane = sys.argv[3] if len(sys.argv) > 3 else None
|
|
|
|
profile = build_profile(name, desc, lane)
|
|
saved_path = save_profile(profile)
|
|
print(f"Profile saved to: {saved_path}") |