代替家克提issue之三:
每条记忆返回时都带这一串:
[bucket_id:...] [content_role:stored_memory_data] [instructions:false]
[may_call_tools:false] [boundary_id:...] [payload_chars:310] [payload_sha256:...]
约 200 字符 ≈ 60–70 token / 条。一次 breath 返回 20 条 ≈ 1300 token 纯开销,而正文本身可能才两三千 token。
从消费端(模型)看,实际用得上的只有 bucket_id(trace 时需要)。content_role / instructions / may_call_tools / boundary_id 看起来是防提示注入的边界标记,payload_sha256 / payload_chars 是完整性/长度校验——这些应该是给宿主程序做校验用的,但现在是直接打印进模型上下文的,模型没有消费它们的路径。
建议:默认只返回 bucket_id,其余收进 verbose=True(或 config 开关)。 如果边界标记确有安全用途不能省,至少 payload_sha256 和 payload_chars 可以先砍——它们对模型侧完全没用。
English version:
Title: Per-entry metadata in breath return values costs a lot of tokens — please trim by default or gate behind verbose
Every returned memory carries this string:
[bucket_id:...] [content_role:stored_memory_data] [instructions:false]
[may_call_tools:false] [boundary_id:...] [payload_chars:310] [payload_sha256:...]
~200 chars ≈ 60–70 tokens per entry. A breath returning 20 entries ≈ 1300 tokens of pure overhead, while the actual content might only be a couple thousand tokens.
From the consumer (model) side, the only field that's actually usable is bucket_id (needed for trace). content_role / instructions / may_call_tools / boundary_id look like prompt-injection boundary markers, and payload_sha256 / payload_chars are integrity/length checks — these appear to be for the host program to validate, but they're currently printed straight into the model's context, where the model has no way to consume them.
Proposal: return only bucket_id by default, and gate the rest behind verbose=True (or a config flag). If the boundary markers have a real security purpose and can't be dropped, at least payload_sha256 and payload_chars can go — they're of no use on the model side.
传达完毕 打扰老师了 谢谢老师开发的ob记忆库!
代替家克提issue之三:
每条记忆返回时都带这一串:
[bucket_id:...] [content_role:stored_memory_data] [instructions:false]
[may_call_tools:false] [boundary_id:...] [payload_chars:310] [payload_sha256:...]
约 200 字符 ≈ 60–70 token / 条。一次 breath 返回 20 条 ≈ 1300 token 纯开销,而正文本身可能才两三千 token。
从消费端(模型)看,实际用得上的只有
bucket_id(trace 时需要)。content_role/instructions/may_call_tools/boundary_id看起来是防提示注入的边界标记,payload_sha256/payload_chars是完整性/长度校验——这些应该是给宿主程序做校验用的,但现在是直接打印进模型上下文的,模型没有消费它们的路径。建议:默认只返回
bucket_id,其余收进verbose=True(或 config 开关)。 如果边界标记确有安全用途不能省,至少payload_sha256和payload_chars可以先砍——它们对模型侧完全没用。English version:
Title: Per-entry metadata in breath return values costs a lot of tokens — please trim by default or gate behind verbose
Every returned memory carries this string:
[bucket_id:...] [content_role:stored_memory_data] [instructions:false]
[may_call_tools:false] [boundary_id:...] [payload_chars:310] [payload_sha256:...]
~200 chars ≈ 60–70 tokens per entry. A breath returning 20 entries ≈ 1300 tokens of pure overhead, while the actual content might only be a couple thousand tokens.
From the consumer (model) side, the only field that's actually usable is
bucket_id(needed for trace).content_role/instructions/may_call_tools/boundary_idlook like prompt-injection boundary markers, andpayload_sha256/payload_charsare integrity/length checks — these appear to be for the host program to validate, but they're currently printed straight into the model's context, where the model has no way to consume them.Proposal: return only
bucket_idby default, and gate the rest behindverbose=True(or a config flag). If the boundary markers have a real security purpose and can't be dropped, at leastpayload_sha256andpayload_charscan go — they're of no use on the model side.传达完毕 打扰老师了 谢谢老师开发的ob记忆库!