v0.7.2: context visibility (/context) — TDD
/context shows message count, focus, token estimate, and last 5 message summaries. Inline command, no daemon interaction needed. - channel-tui-main: /context handler, 1 test - Fixed /tags handler (removed dangling else clause) - TUI Main: 84/85 (1 pre-existing core flake)
This commit is contained in:
@@ -195,13 +195,31 @@ Event handlers + daemon I/O + main loop.
|
||||
(add-msg :system (format nil "Node ~a not found" node-id))))
|
||||
(add-msg :system "Memory audit not available")))
|
||||
;; /tags command — tag stack
|
||||
;; /tags command — tag stack
|
||||
((string-equal text "/tags")
|
||||
(let ((cats (or passepartout::*tag-categories* nil)))
|
||||
(if cats
|
||||
(dolist (entry cats)
|
||||
(add-msg :system (format nil "~a: ~a" (car entry) (cdr entry))))
|
||||
(add-msg :system "No tags configured. Set TAG_CATEGORIES env var.")))
|
||||
(add-msg :system "Tag categories not loaded")))
|
||||
(let ((cats passepartout::*tag-categories*))
|
||||
(if cats
|
||||
(dolist (entry cats)
|
||||
(add-msg :system (format nil "~a: ~a" (car entry) (cdr entry))))
|
||||
(add-msg :system "No tags configured. Set TAG_CATEGORIES env var."))))
|
||||
;; /context command — context visibility
|
||||
((string-equal text "/context")
|
||||
(let* ((msg-count (length (st :messages)))
|
||||
(focus (or (st :foveal-id) "none"))
|
||||
(est-tokens (min 8192 (* msg-count 50))))
|
||||
(add-msg :system (format nil "Context: ~d msgs, focus=~a, est ~d/8192 tokens"
|
||||
msg-count focus est-tokens))
|
||||
(let ((start (max 0 (- msg-count 5))))
|
||||
(loop for i from start below msg-count
|
||||
for m = (aref (st :messages) i)
|
||||
for content = (getf m :content)
|
||||
for preview = (if (> (length content) 50)
|
||||
(concatenate 'string (subseq content 0 47) "...")
|
||||
content)
|
||||
for role = (getf m :role)
|
||||
do (add-msg :system (format nil " ~a: ~a"
|
||||
(case role (:user "You") (:agent "Agent") (t "Sys"))
|
||||
preview))))))
|
||||
((string-equal text "/help")
|
||||
(add-msg :system
|
||||
"/focus <proj> Set project context")
|
||||
|
||||
Reference in New Issue
Block a user