forked from Rockachopa/Timmy-time-dashboard
refactor: extract _create_default template to module constant (#649)
Co-authored-by: Kimi Agent <kimi@timmy.local> Co-committed-by: Kimi Agent <kimi@timmy.local>
This commit is contained in:
@@ -46,6 +46,64 @@ DB_PATH = PROJECT_ROOT / "data" / "memory.db"
|
|||||||
# ───────────────────────────────────────────────────────────────────────────────
|
# ───────────────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
|
||||||
|
_DEFAULT_HOT_MEMORY_TEMPLATE = """\
|
||||||
|
# Timmy Hot Memory
|
||||||
|
|
||||||
|
> Working RAM — always loaded, ~300 lines max, pruned monthly
|
||||||
|
> Last updated: {date}
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Current Status
|
||||||
|
|
||||||
|
**Agent State:** Operational
|
||||||
|
**Mode:** Development
|
||||||
|
**Active Tasks:** 0
|
||||||
|
**Pending Decisions:** None
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Standing Rules
|
||||||
|
|
||||||
|
1. **Sovereignty First** — No cloud dependencies
|
||||||
|
2. **Local-Only Inference** — Ollama on localhost
|
||||||
|
3. **Privacy by Design** — Telemetry disabled
|
||||||
|
4. **Tool Minimalism** — Use tools only when necessary
|
||||||
|
5. **Memory Discipline** — Write handoffs at session end
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Agent Roster
|
||||||
|
|
||||||
|
| Agent | Role | Status |
|
||||||
|
|-------|------|--------|
|
||||||
|
| Timmy | Core | Active |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## User Profile
|
||||||
|
|
||||||
|
**Name:** (not set)
|
||||||
|
**Interests:** (to be learned)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Key Decisions
|
||||||
|
|
||||||
|
(none yet)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Pending Actions
|
||||||
|
|
||||||
|
- [ ] Learn user's name
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
*Prune date: {prune_date}*
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def get_connection() -> Generator[sqlite3.Connection, None, None]:
|
def get_connection() -> Generator[sqlite3.Connection, None, None]:
|
||||||
"""Get database connection to unified memory database."""
|
"""Get database connection to unified memory database."""
|
||||||
@@ -732,66 +790,12 @@ class HotMemory:
|
|||||||
logger.debug(
|
logger.debug(
|
||||||
"HotMemory._create_default() - creating default MEMORY.md for backward compatibility"
|
"HotMemory._create_default() - creating default MEMORY.md for backward compatibility"
|
||||||
)
|
)
|
||||||
default_content = """# Timmy Hot Memory
|
now = datetime.now(UTC)
|
||||||
|
content = _DEFAULT_HOT_MEMORY_TEMPLATE.format(
|
||||||
> Working RAM — always loaded, ~300 lines max, pruned monthly
|
date=now.strftime("%Y-%m-%d"),
|
||||||
> Last updated: {date}
|
prune_date=now.replace(day=25).strftime("%Y-%m-%d"),
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Current Status
|
|
||||||
|
|
||||||
**Agent State:** Operational
|
|
||||||
**Mode:** Development
|
|
||||||
**Active Tasks:** 0
|
|
||||||
**Pending Decisions:** None
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Standing Rules
|
|
||||||
|
|
||||||
1. **Sovereignty First** — No cloud dependencies
|
|
||||||
2. **Local-Only Inference** — Ollama on localhost
|
|
||||||
3. **Privacy by Design** — Telemetry disabled
|
|
||||||
4. **Tool Minimalism** — Use tools only when necessary
|
|
||||||
5. **Memory Discipline** — Write handoffs at session end
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Agent Roster
|
|
||||||
|
|
||||||
| Agent | Role | Status |
|
|
||||||
|-------|------|--------|
|
|
||||||
| Timmy | Core | Active |
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## User Profile
|
|
||||||
|
|
||||||
**Name:** (not set)
|
|
||||||
**Interests:** (to be learned)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Key Decisions
|
|
||||||
|
|
||||||
(none yet)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Pending Actions
|
|
||||||
|
|
||||||
- [ ] Learn user's name
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
*Prune date: {prune_date}*
|
|
||||||
""".format(
|
|
||||||
date=datetime.now(UTC).strftime("%Y-%m-%d"),
|
|
||||||
prune_date=(datetime.now(UTC).replace(day=25)).strftime("%Y-%m-%d"),
|
|
||||||
)
|
)
|
||||||
|
self.path.write_text(content)
|
||||||
self.path.write_text(default_content)
|
|
||||||
logger.info("HotMemory: Created default MEMORY.md")
|
logger.info("HotMemory: Created default MEMORY.md")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user