passepartout: v0.6.0 — Time Awareness

Level 2: symbolic-time-memory skill
- memory-objects-since(timestamp) — hash-table walk, objects with version >= timestamp
- memory-objects-in-range(since until) — version between two timestamps
- context-query-with-time — extended query with :since :until
- 6 tests, 100% pass

Level 3: sensor-time skill
- format-time-for-llm — TIME: section for system prompt (iso/natural format)
- session-duration — session start tracking
- sensor-time-tick — deadline scanning, cron-registered, 0 LLM tokens
- TIME_AWARENESS / TIME_FORMAT / DEADLINE_WARNING_MINUTES env vars
- 13 tests, 100% pass

Level 1: TIME injection in think() (core-reason)
- fboundp-guarded call to format-time-for-llm
- session duration included when sensor-time skill loaded
- Injected at top of system prompt in both token-economics and fallback paths

Full suite: 135/135 (100%)
This commit is contained in:
2026-05-08 09:42:22 -04:00
parent f6079246ee
commit 04c219468d
10 changed files with 701 additions and 30 deletions

View File

@@ -108,7 +108,7 @@ Uses cache when foveal, scope, and memory timestamp are unchanged."
cache-rendered
(> (length cache-rendered) 0))
cache-rendered
(let ((rendered (context-assemble-global-awareness)))
(let ((rendered (funcall (symbol-function 'context-assemble-global-awareness))))
(setf (getf *context-cache* :foveal-id) foveal-id
(getf *context-cache* :scope) scope
(getf *context-cache* :memory-timestamp) mem-ts
@@ -127,12 +127,13 @@ with trimmed sections."
(ignore-errors
(parse-integer (uiop:getenv "CONTEXT_MAX_TOKENS")))
16384)))
(flet ((total-tokens (p c l u m)
(+ (count-tokens p)
(if c (count-tokens c) 0)
(count-tokens l)
(count-tokens u)
(if m (count-tokens m) 0))))
(labels ((ct (s) (funcall (symbol-function 'count-tokens) s))
(total-tokens (p c l u m)
(+ (ct p)
(if c (ct c) 0)
(ct l)
(ct u)
(if m (ct m) 0))))
(let ((total (total-tokens prefix context-text logs-text user-prompt mandates-text)))
(when (> total max)
(log-message "TOKEN BUDGET: ~d tokens exceeds max ~d, trimming..."
@@ -243,7 +244,7 @@ with trimmed sections."
(let ((big-prefix (make-string 20000 :initial-element #\x)))
(multiple-value-bind (p c l u m)
(passepartout::enforce-token-budget big-prefix "ctxt" "logs\nlogs\nlogs\nlogs\nlogs\nlogs\nlogs" "user" nil 10)
(declare (ignore m))
(declare (ignore p l u m))
;; The prefix itself exceeds the tiny 10-token budget, so everything gets trimmed
(is (or (stringp c) (null c)))
(is (search "[Context trimmed" (or c ""))))))