diff --git a/agent/agent.py b/agent/agent.py index 11aa5b4..3e7e02a 100644 --- a/agent/agent.py +++ b/agent/agent.py @@ -217,8 +217,18 @@ def execute_skill(script_path, args): TOOLS, SKILL_SCRIPTS = discover_skills() +LOG_FILE = f"{WORKSPACE}/agent.log" if os.path.isdir(WORKSPACE) else None + + def log(msg): - print(f"[agent:{NICK}] {msg}", flush=True) + line = f"[{time.strftime('%H:%M:%S')}] {msg}" + print(f"[agent:{NICK}] {line}", flush=True) + if LOG_FILE: + try: + with open(LOG_FILE, "a") as f: + f.write(line + "\n") + except Exception: + pass log(f"Loaded {len(TOOLS)} skills: {', '.join(SKILL_SCRIPTS.keys())}")