Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
2e9d0aa
feature: active memory actions
makeitdouble Jun 22, 2026
0e4cb26
feature: active memory actions
makeitdouble Jun 22, 2026
b26b09a
feature: active memory actions
makeitdouble Jun 22, 2026
d20a044
feature: active memory actions
makeitdouble Jun 22, 2026
932602a
feature: active memory actions
makeitdouble Jun 22, 2026
e9a252c
feature: active memory actions
makeitdouble Jun 23, 2026
8f38186
feature: active memory actions
makeitdouble Jun 23, 2026
0508cf9
feature: active memory actions
makeitdouble Jun 23, 2026
ebc7633
feature: active memory actions
makeitdouble Jun 23, 2026
b69065b
feature: active memory actions
makeitdouble Jun 23, 2026
05065e8
feature: active memory actions
makeitdouble Jun 23, 2026
f8f3aff
feature: active memory actions
makeitdouble Jun 23, 2026
a9c4c02
feature: active memory actions
makeitdouble Jun 23, 2026
42e7688
feature: active memory actions
makeitdouble Jun 23, 2026
68f5dd2
feature: active memory actions
makeitdouble Jun 23, 2026
c9c96ce
feature: active memory actions
makeitdouble Jun 24, 2026
452a216
feature: active memory actions
makeitdouble Jun 24, 2026
3c63dd1
feature: active memory actions
makeitdouble Jun 24, 2026
ddea773
feature: active memory actions
makeitdouble Jun 24, 2026
126840f
feature: active memory actions
makeitdouble Jun 25, 2026
8cb4ca6
feature: active memory actions
makeitdouble Jun 25, 2026
780a40b
feature: active memory actions
makeitdouble Jun 25, 2026
990e388
feature: active memory actions
makeitdouble Jun 25, 2026
6c54d11
feature: active memory actions
makeitdouble Jun 26, 2026
c50bd88
feature: active memory actions
makeitdouble Jun 26, 2026
584a8e7
feature: active memory actions
makeitdouble Jun 26, 2026
af3fa19
feature: active memory actions
makeitdouble Jun 26, 2026
e0ecf05
feature: active memory actions
makeitdouble Jun 26, 2026
b9c47ae
feature: active memory actions
makeitdouble Jun 26, 2026
6f7f199
feature: active memory actions
makeitdouble Jun 26, 2026
fce87de
feature: active memory actions
makeitdouble Jun 27, 2026
a2b9fd1
feature: active memory actions
makeitdouble Jun 27, 2026
947e21d
feature: active memory actions
makeitdouble Jun 27, 2026
3063d97
feature: active memory actions
makeitdouble Jun 27, 2026
c11f1d8
feature: active memory actions
makeitdouble Jun 27, 2026
2e71ea4
feature: active memory actions
makeitdouble Jun 27, 2026
1a38584
feature: active memory actions
makeitdouble Jun 27, 2026
c26504c
feature: active memory actions
makeitdouble Jun 27, 2026
65c0713
feature: active memory actions
makeitdouble Jun 27, 2026
a92dcab
feature: active memory actions
makeitdouble Jun 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Completed thinking blocks are also scanned for direct citations from trusted pro

If generation is aborted, the runtime captures the partial answer and schedules an interrupted memory update. The memory summarizer is instructed to mark the turn as incomplete and not treat it as resolved.

When the user signals the end of a session — explicitly or through natural closing phrases — the brain emits a `REMEMBER_SESSION` action. The runtime builds a compact L3 digest from the current snapshot history and sends it to the browser for local storage. On the next connection, the browser sends the digest back as part of the bootstrap payload and the runtime injects it as trusted session context before the first turn.
When the user signals the end of a session — explicitly or through natural closing phrases — the brain emits a `SAVE_SESSION` action. The runtime builds a compact L3 digest from the current snapshot history and sends it to the browser for local storage. On the next connection, the browser sends the digest back as part of the bootstrap payload and the runtime injects it as trusted session context before the first turn.

## Runtime Memory

Expand Down Expand Up @@ -151,7 +151,7 @@ A rendered runtime snapshot also carries metadata used by the right-side timelin
}
```

`active_memory` lifecycle suffixes are owned by runtime, not L1. L1 sees the contract value and `[ status: ... ]`; runtime reattaches `[ creation_time ]`, `[ created_jin_message_number ]`, `[ elapsed_time ]`, and `[ elapsed_jin_message_number ]` after each update. Memory lines may also have temporary trace strength such as `[ trace: 0.50 ]` or inject `user_idle: 9s` into the displayed context. Those are runtime metadata signals, not durable memory facts.
`active_memory` lifecycle suffixes are owned by runtime, not L1. L1 sees the contract value and `[ status: ... ]`; runtime reattaches `[ creation_time ]`, `[ created_jin_message_number ]`, `[ elapsed_time ]`, and `[ elapsed_jin_message_number ]` after each runtime refresh. Memory lines may also have temporary trace strength such as `[ trace: 0.50 ]` or inject `user_idle: 9s` into the displayed context. Those are runtime metadata signals, not durable memory facts.

### L2 memory snapshot (patterns)

Expand Down Expand Up @@ -410,15 +410,14 @@ TRANSLATION_MAX_TOKENS = 2048

L3 session memory lets context survive across browser sessions without a server-side database.

To save a session, say something that signals you are done: "save the session", "that's all for today", "wrap it up", "I'm going to sleep", or the Russian equivalents. The brain emits a `REMEMBER_SESSION` action and the runtime builds a compressed digest from the current snapshot history. The browser stores this digest in `localStorage` and also writes it back to `saved_runtime.txt` if that path is configured.
To save a session, say something that signals you are done: "save the session", "that's all for today", "wrap it up", "I'm going to sleep", or the Russian equivalents. The brain emits a `SAVE_SESSION` action and the runtime builds a compressed digest from the current snapshot history. The browser stores this digest in `localStorage` and also writes it back to `saved_runtime.txt` if that path is configured.

On the next page load or reconnect, the browser includes the saved digest in its bootstrap payload. The runtime receives it, validates it against any fresh L1 memory that may have accumulated, and injects the session context into the brain prompt before the first turn.

The sidebar shows a distinct indicator when a session was restored from a saved digest rather than built from live L1 memory.

`saved_runtime.example.txt` shows the expected format for a pre-populated session memory file. Copy it to `saved_runtime.txt` and edit the contents to seed JIN with static facts that should survive every session.

Important events — a major decision, a strong insight, a correction that changes how JIN understands the user — can also be saved mid-session with a `REMEMBER_EVENT` action. The brain emits this automatically when the conversation reaches a clear milestone.

## Tests

Expand Down Expand Up @@ -587,6 +586,5 @@ The following capabilities are planned but not yet implemented.

**Brain fallback on low repair score.** When a service-model code/diff attempt scores below a configurable threshold (default 50), the next repair attempt is routed to the brain model with a clean snapshot containing only the original task, the current file state, the failed patch, and the exact error. The brain model does not receive the previous model's reasoning chain.

**Memory event temperature.** Episodic key moments saved via `REMEMBER_EVENT` will carry emotional temperature (`positive`, `negative`, `mixed`), intensity, and initiator (`user_marked` or `jin_detected`). The service model infers these fields from natural language rather than requiring the user to fill a form. JIN may occasionally propose saving a moment it judges significant, but does so rarely.

**Safe memory key normalization.** All memory keys arriving from model output or runtime updates are normalized before storage: trimmed, capped at 120 characters, and stripped of characters outside `[a-zA-Z0-9_\-:.]`. When normalization changes a key, the original is preserved as `raw_label` metadata. Conflicts from key collisions after normalization get numeric suffixes. Keys and values are rendered as `textContent` in the UI, never as `innerHTML`.
24 changes: 12 additions & 12 deletions agent/nodes/brain.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
ask_brain_stream,
build_brain_payload,
build_brain_system_prompt,
record_deep_thought_calls,
emit_active_memory_records_update_if_dirty,
)

from clients.search_client import (
build_search_result_fallback_answer,
run_search_service,
)

from utils.brain import (
from clients.brain_client_utils import (
get_brain_runtime_config,
)

Expand Down Expand Up @@ -145,9 +145,14 @@ async def run(
build_brain_system_prompt(
context,
runtime_actions=runtime_actions,
commit_active_memory_refresh=True,
)
)

await emit_active_memory_records_update_if_dirty(
context
)

context.runtime_zero_diff_alert = None

brain_payload = (
Expand All @@ -170,11 +175,6 @@ async def run(
),
)

record_deep_thought_calls(
context,
reasoning,
)

if context.runtime_search_queries:

search_call = (
Expand Down Expand Up @@ -233,9 +233,14 @@ async def run(
build_brain_system_prompt(
context,
runtime_actions=followup_runtime_actions,
commit_active_memory_refresh=True,
)
)

await emit_active_memory_records_update_if_dirty(
context
)

followup_payload = (
"User request:\n"
f"{state.translated_input}\n\n"
Expand All @@ -258,11 +263,6 @@ async def run(
),
)

record_deep_thought_calls(
context,
reasoning,
)

if not text.strip():
text = build_search_result_fallback_answer(
search_result
Expand Down
239 changes: 0 additions & 239 deletions bootstrap/brain_bootstrap.py

This file was deleted.

Loading