-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlog_entry.py
More file actions
52 lines (43 loc) · 1.5 KB
/
log_entry.py
File metadata and controls
52 lines (43 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import json
import datetime
from utils import *
import time
def log_entry():
if verify("Are you sure you would like to create a new journal entry?"):
timestamp = get_timestamp()
entry_id = get_next_journal_id()
key = str(entry_id)
valid_tags = load_valid_tags()
print("\n-- Begin Journal Entry --")
title = prompt_optional_input("Title")
insight = prompt_optional_input("Insight")
reasoning = prompt_optional_input("Reasoning")
implementation = prompt_optional_input("Implementation")
followups = prompt_optional_input("Follow-ups/Questions")
tags = prompt_tags(valid_tags)
promote_to_core = input("Promote to core memory? (y/n): ").strip().lower() in [
"y",
"yes",
]
entry = {
"id": entry_id,
"timestamp": timestamp,
"title": title,
"insight": insight,
"reasoning": reasoning,
"implementation": implementation,
"followups": followups,
"tags": tags,
"promote_to_core": promote_to_core,
}
# Load existing entries
with open(journal_path, "r") as file:
entries = json.load(file)
# Append and save
entries[key] = entry
with open(journal_path, "w") as file:
json.dump(entries, file, indent=4)
print("✅ Entry logged successfully.\n")
time.sleep(1)
print_journal_entry(key)
return