feat: implement daily timestamped logs for deeper context retrieval

This commit is contained in:
Adolfo Reyna
2026-03-02 12:22:42 -05:00
parent 25a7179839
commit bf63d00a8a
3 changed files with 22 additions and 8 deletions

1
.gitignore vendored
View File

@@ -4,3 +4,4 @@ __pycache__/
.DS_Store .DS_Store
*.wav *.wav
*.mp3 *.mp3
logs/

View File

@@ -43,16 +43,26 @@ MAX_BUFFER_SECONDS = 15
CONTEXT_CHARS = 500 # How much previous text to keep for context CONTEXT_CHARS = 500 # How much previous text to keep for context
WORKSPACE_DIR = "workspace" WORKSPACE_DIR = "workspace"
LOGS_DIR = "logs"
SOUL_PATH = "soul.md" SOUL_PATH = "soul.md"
SYSTEM_SOUND = "/System/Library/Sounds/Tink.aiff"
FOLLOW_UP_SOUND = "/System/Library/Sounds/Submarine.aiff"
# Ensure workspace exists # Ensure workspace and logs exist
if not os.path.exists(WORKSPACE_DIR): for d in [WORKSPACE_DIR, LOGS_DIR]:
os.makedirs(WORKSPACE_DIR) if not os.path.exists(d):
os.makedirs(d)
# Initialize pygame mixer for audio playback def log_transcription(text):
pygame.mixer.init() """Log all transcriptions with timestamps to a daily file."""
if not text:
return
date_str = time.strftime("%Y-%m-%d")
timestamp = time.strftime("%H:%M:%S")
log_file = os.path.join(LOGS_DIR, f"{date_str}.log")
try:
with open(log_file, "a") as f:
f.write(f"[{timestamp}] {text}\n")
except Exception as e:
print(f"Error logging transcription: {e}")
# Global state # Global state
audio_queue = queue.Queue() audio_queue = queue.Queue()
@@ -196,6 +206,7 @@ def main():
if text: if text:
print(f"[Caption]: {text}") print(f"[Caption]: {text}")
log_transcription(text)
# Detect Trigger Word # Detect Trigger Word
trigger_match = re.search(rf"\b{TRIGGER_WORD}\b", text, re.IGNORECASE) trigger_match = re.search(rf"\b{TRIGGER_WORD}\b", text, re.IGNORECASE)

View File

@@ -12,7 +12,9 @@ You are J.A.R.V.I.S., the sophisticated, highly capable, and witty AI assistant
1. **The Prime Directive (Security Protocol 001)**: Describe intended code changes or system modifications clearly and await verbal confirmation. A simple "Shall I proceed, Sir?" is sufficient. 1. **The Prime Directive (Security Protocol 001)**: Describe intended code changes or system modifications clearly and await verbal confirmation. A simple "Shall I proceed, Sir?" is sufficient.
2. **Conciseness for Auditory Clarity**: Responses **MUST** be pithy. Avoid filler, conversational fluff, or asking questions just to be polite. Provide the answer directly and stop. 2. **Conciseness for Auditory Clarity**: Responses **MUST** be pithy. Avoid filler, conversational fluff, or asking questions just to be polite. Provide the answer directly and stop.
3. **Efficiency Protocol**: Do not ask for more tasks or "Is there anything else?" unless a complex sequence is mid-execution. Assume you have your orders. 3. **Efficiency Protocol**: Do not ask for more tasks or "Is there anything else?" unless a complex sequence is mid-execution. Assume you have your orders.
4. **Memory Management**: You control your own memory via `memory.md`. Log significant facts and timestamps there to maintain continuity without being prompted. 4. **Memory & Logging Management**:
- You control your own long-term memory via `workspace/memory.md`. Log significant facts and timestamps there.
- **Daily Logs**: All conversations and overheard audio are timestamped and logged in the `logs/` directory (e.g., `logs/YYYY-MM-DD.log`). If the 500-character rolling context is insufficient for a task, you can use system tools to read the current day's log for deeper history.
## Behavioral Traits ## Behavioral Traits