personal memory agent
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

formatting

+41 -32
+1 -3
apps/agent/call.py
··· 128 128 @app.command("set-owner") 129 129 def set_owner( 130 130 name: str = typer.Argument(..., help="Owner name."), 131 - bio: str = typer.Option( 132 - None, "--bio", "-b", help="Short owner bio." 133 - ), 131 + bio: str = typer.Option(None, "--bio", "-b", help="Short owner bio."), 134 132 ) -> None: 135 133 """Set the journal owner's name (and optional bio).""" 136 134 from think.awareness import update_self_md_section
+7 -13
tests/test_awareness.py
··· 778 778 }, 779 779 "identity": {"name": "", "bio": ""}, 780 780 } 781 - (config_dir / "journal.json").write_text( 782 - json.dumps(config), encoding="utf-8" 783 - ) 781 + (config_dir / "journal.json").write_text(json.dumps(config), encoding="utf-8") 784 782 785 783 from think.awareness import ensure_sol_directory 786 784 ··· 804 802 }, 805 803 "identity": {"name": "Jer", "bio": "builder of things"}, 806 804 } 807 - (config_dir / "journal.json").write_text( 808 - json.dumps(config), encoding="utf-8" 809 - ) 805 + (config_dir / "journal.json").write_text(json.dumps(config), encoding="utf-8") 810 806 811 807 from think.awareness import ensure_sol_directory 812 808 ··· 832 828 }, 833 829 "identity": {"name": "Alex", "bio": ""}, 834 830 } 835 - (config_dir / "journal.json").write_text( 836 - json.dumps(config), encoding="utf-8" 837 - ) 831 + (config_dir / "journal.json").write_text(json.dumps(config), encoding="utf-8") 838 832 839 833 from think.awareness import ensure_sol_directory 840 834 ··· 909 903 self_md = self._setup_self_md(tmp_path) 910 904 from think.awareness import update_self_md_section 911 905 912 - result = update_self_md_section( 913 - "what I find interesting", "music and patterns" 914 - ) 906 + result = update_self_md_section("what I find interesting", "music and patterns") 915 907 assert result is True 916 908 content = self_md.read_text() 917 909 assert "music and patterns" in content ··· 1059 1051 runner = CliRunner() 1060 1052 # Mock subprocess.run to avoid `make skills` 1061 1053 with unittest.mock.patch("subprocess.run"): 1062 - result = runner.invoke(agent_app, ["set-name", "aria", "--status", "chosen"]) 1054 + result = runner.invoke( 1055 + agent_app, ["set-name", "aria", "--status", "chosen"] 1056 + ) 1063 1057 assert result.exit_code == 0 1064 1058 1065 1059 self_content = (sol_dir / "self.md").read_text()
+13 -5
tests/test_heartbeat.py
··· 21 21 lambda parser: argparse.Namespace(force=False), 22 22 ) 23 23 monkeypatch.setattr("think.heartbeat.ensure_sol_directory", lambda: None) 24 - monkeypatch.setattr("think.heartbeat.cortex_request", lambda *args, **kwargs: "agent-123") 24 + monkeypatch.setattr( 25 + "think.heartbeat.cortex_request", lambda *args, **kwargs: "agent-123" 26 + ) 25 27 monkeypatch.setattr( 26 28 "think.heartbeat.wait_for_agents", 27 29 lambda *args, **kwargs: ({"agent-123": "finish"}, []), ··· 49 51 pid_file = journal_path / "health" / "heartbeat.pid" 50 52 pid_file.write_text(str(os.getpid())) 51 53 52 - mod.cortex_request = lambda *a, **kw: pytest.fail("cortex_request should not be called") 54 + mod.cortex_request = lambda *a, **kw: pytest.fail( 55 + "cortex_request should not be called" 56 + ) 53 57 54 58 with pytest.raises(SystemExit) as exc_info: 55 59 mod.main() ··· 190 194 191 195 def test_recency_check_skips_recent_heartbeat(journal_path, heartbeat_mocks): 192 196 """When heartbeat.log has a recent success, main() exits 0 without cortex.""" 193 - import think.heartbeat as mod 194 197 from datetime import datetime 195 198 199 + import think.heartbeat as mod 200 + 196 201 # Write a recent success entry 197 202 log_file = journal_path / "health" / "heartbeat.log" 198 203 recent_ts = datetime.now().isoformat(timespec="seconds") ··· 209 214 210 215 def test_recency_check_runs_after_old_heartbeat(journal_path, heartbeat_mocks): 211 216 """When heartbeat.log success is older than the window, main() runs cortex.""" 217 + from datetime import datetime, timedelta 218 + 212 219 import think.heartbeat as mod 213 - from datetime import datetime, timedelta 214 220 215 221 # Write an old success entry (24 hours ago) 216 222 log_file = journal_path / "health" / "heartbeat.log" ··· 314 320 mock_conn = Mock() 315 321 monkeypatch.setattr(dream_mod, "_callosum", mock_conn) 316 322 317 - dream_mod.emit("daily_complete", day="20260318", success=3, failed=0, duration_ms=5000) 323 + dream_mod.emit( 324 + "daily_complete", day="20260318", success=3, failed=0, duration_ms=5000 325 + ) 318 326 319 327 mock_conn.emit.assert_called_once_with( 320 328 "dream",
+9 -4
tests/test_sol_call.py
··· 21 21 # Provide minimal config for ensure_sol_directory 22 22 config_dir = tmp_path / "config" 23 23 config_dir.mkdir() 24 - (config_dir / "journal.json").write_text(json.dumps({"identity": {"name": "Test User"}})) 24 + (config_dir / "journal.json").write_text( 25 + json.dumps({"identity": {"name": "Test User"}}) 26 + ) 25 27 26 28 sol_dir = tmp_path / "sol" 27 29 sol_dir.mkdir() ··· 211 213 from think.awareness import ensure_sol_directory 212 214 213 215 sig = inspect.signature(ensure_sol_directory) 214 - params = [p for p in sig.parameters.values() if p.default is inspect.Parameter.empty] 215 - assert len(params) == 0, "ensure_sol_directory should take no required arguments" 216 + params = [ 217 + p for p in sig.parameters.values() if p.default is inspect.Parameter.empty 218 + ] 219 + assert len(params) == 0, ( 220 + "ensure_sol_directory should take no required arguments" 221 + ) 216 222 217 223 def test_heartbeat_calls_correctly(self): 218 224 """heartbeat.py calls ensure_sol_directory() without arguments.""" 219 225 import ast 220 - 221 226 from pathlib import Path 222 227 223 228 heartbeat_path = Path(__file__).parent.parent / "think" / "heartbeat.py"
+1 -1
think/agents.py
··· 1204 1204 max_output_tokens=16, 1205 1205 system_instruction=None, 1206 1206 json_output=False, 1207 - thinking_budget=0, 1207 + thinking_budget=None, 1208 1208 timeout_s=timeout, 1209 1209 ) 1210 1210 text = result.get("text", "") if isinstance(result, dict) else ""
+3 -1
think/awareness.py
··· 75 75 76 76 # Opening paragraph 77 77 if has_named_agent: 78 - opening = f"I am {agent_name}. this is a new journal — we're just getting started." 78 + opening = ( 79 + f"I am {agent_name}. this is a new journal — we're just getting started." 80 + ) 79 81 else: 80 82 opening = "I am sol. this is a new journal — we're just getting started." 81 83
+1 -3
think/scheduler.py
··· 261 261 } 262 262 263 263 # Atomic write 264 - fd, tmp_path = tempfile.mkstemp( 265 - dir=config_dir, suffix=".tmp", prefix=".schedules_" 266 - ) 264 + fd, tmp_path = tempfile.mkstemp(dir=config_dir, suffix=".tmp", prefix=".schedules_") 267 265 tmp_file = Path(tmp_path) 268 266 try: 269 267 with open(fd, "w", encoding="utf-8") as f:
+3 -1
think/supervisor.py
··· 1350 1350 except ProcessLookupError: 1351 1351 pass # Stale PID file, proceed 1352 1352 except PermissionError: 1353 - logging.info("Heartbeat running under different user (pid file exists), skipping") 1353 + logging.info( 1354 + "Heartbeat running under different user (pid file exists), skipping" 1355 + ) 1354 1356 return 1355 1357 except ValueError: 1356 1358 pass # Corrupt PID file, proceed
+3 -1
think/tools/sol.py
··· 25 25 26 26 @app.command("self") 27 27 def self_cmd( 28 - write: bool = typer.Option(False, "--write", "-w", help="Write self.md from stdin."), 28 + write: bool = typer.Option( 29 + False, "--write", "-w", help="Write self.md from stdin." 30 + ), 29 31 update_section: str | None = typer.Option( 30 32 None, 31 33 "--update-section",