rea-analysis-optimization

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

REA analysis optimization

REA 分析优化

Find a concrete source of unnecessary work, change it at its owner, and verify equivalent completed investigations. A useful outcome can also be a measured decision to leave an implementation alone.
Follow the checkout's performance priorities, tool design, and testing guide. This skill supplies an optimization workflow, not additional permission to execute targets, publish, or merge. Use the current contracts, provider prerequisites, and user authorization.
Read the Kuna case study when selecting a reuse strategy or interpreting a benchmark. Its pinned observations illustrate tradeoffs; they are not current-provider guarantees or universal speedups.
找出一个不必要工作的具体来源,在其 owner 处进行修改,并验证已完成调查的等价性。一个有用结果也可以是基于测量结果,决定不修改某项实现。
遵循当前 checkout 的性能优先级、工具设计和测试指南。此 skill 提供的是优化工作流,而不是执行 target、发布或合并的额外权限。使用当前的 contract、provider 前置条件和用户授权。
在选择复用策略或解读 benchmark 时,阅读 Kuna 案例研究。其中固定版本的观测结果用于说明 trade-off;它们并非当前 provider 的保证,也不是通用提速效果。

Pin the question and the correctness oracle

明确问题与正确性 oracle

Describe the analyst's completed task, including the facts and relationships needed to answer it, requested detail, source access, and meaningful unknowns. Choose a representative real artifact and a small or empty case. Record the baseline revision, target digest, engine identity, options, host, and entrypoint. Use a separate checkout for changes without disturbing other work.
Establish an oracle independent of the changed implementation: source-built fixture expectations, independently mapped file bytes, or a native producer paired with checks of its interpretation. Comparing two wrappers around the same faulty decoder does not establish correctness. Preserve address widths, same-address alternatives, unresolved endpoints, coverage, and source linkage. An empty result proves absence only within the actually examined scope.
描述 analyst 已完成的任务,包括回答任务所需的事实和关系、请求的 detail 层级、source 访问权限以及有意义的不确定项。 选择一个有代表性的真实 artifact,以及一个小型或空 case。记录 baseline revision、target digest、engine identity、options、host 和 entrypoint。 在独立 checkout 中进行改动,以免干扰其他工作。
建立一个独立于被修改实现的 oracle:基于 source 构建的 fixture 预期值、独立映射的文件字节,或配有解释检查的原生 producer。比较围绕同一个故障 decoder 的两个 wrapper,无法确立正确性。保留地址宽度、同一地址的备选结果、未解析端点、coverage 和 source 关联。空结果只能证明实际检查范围内不存在相应对象。

Locate the earliest unnecessary work

定位最早的不必要工作

Trace one public CLI or MCP task through shared application code to its producer. Measure relevant phases: admission and identity checks, native analysis, decoding, lookup, projection, serialization, Evidence retention, and cleanup. Include catalog discovery and extra calls when they affect the completed task.
Use the evidence to choose the smallest structural correction:
Observed costCandidate correctionCondition to establish
Repeated scans of validated factsReuse existing order or lookup structureThe owner establishes ordering and identity; every matching alternative survives
Repeated equivalent engine workShare a validated result or in-flight producerInputs, freshness, lifetime, and per-caller outcomes remain explicit
Full reports for selected factsPush selection or projection to the earliest capable ownerRequired facts and evidence remain reachable; examined coverage is reported
Large temporary transport buffersDecode incrementally or use bounded source readsValidate the whole admitted document; retained facts and copies still consume memory
Many repeated homogeneous readsShare admission, decoding, or batch workPreserve item identity, order where required, and individual failures
Do not introduce an index, generic cache, batch endpoint, or orchestration layer without identifying the work it removes and its maintenance/resource cost. Projection after materializing a full report may reduce output while leaving analysis time and peak memory unchanged. Fix missing or incorrect facts before benchmarking an alternative composition against a better-covered workflow.
将一个公开 CLI 或 MCP task 沿共享应用代码追踪到其 producer。 测量相关阶段:admission 与 identity 检查、原生分析、decoding、lookup、projection、serialization、Evidence 保留和 cleanup。 当 catalog 发现和额外调用会影响已完成任务时,也应将其纳入。
使用 evidence 选择最小的结构性修正:
观察到的成本候选修正需要确立的条件
重复扫描已验证的事实复用现有顺序或 lookup 结构owner 确立顺序和 identity;所有匹配的备选项均被保留
重复执行等价的 engine 工作共享已验证结果或进行中的 producer输入、新鲜度、生命周期和每个 caller 的结果保持明确
为选定事实生成完整报告将选择或 projection 下推到最早具备能力的 owner所需事实和 evidence 仍可访问;报告已检查的 coverage
大型临时传输缓冲区增量 decoding 或使用有界 source 读取验证整个已准入文档;保留的事实和副本仍会消耗内存
大量重复的同质读取共享 admission、decoding 或批处理工作保留条目 identity、在需要时保留顺序,以及各项失败结果
在明确 index、通用 cache、batch endpoint 或 orchestration layer 所消除的工作及其维护和资源成本之前,不要引入这些机制。 在物化完整报告之后再做 projection,可能减少输出,却不会改变分析时间和峰值内存。在将另一种组合方式与 coverage 更好的 workflow 进行 benchmark 之前,先修复缺失或错误的事实。

Keep one interpretation and a defined reuse lifetime

保持单一解释并定义明确的复用生命周期

Let the producer boundary validate and normalize facts once. Consumers query that representation through the shared CLI/MCP implementation; adapters should not rebuild relationships or independently reinterpret raw reports. Keep lookup identity separate from display formatting. Reuse contracts when their intent matches, honoring requested detail and complete Evidence access.
For every cache or shared producer, state its key, owner, invalidation, retained size, and lifetime. Account for result-affecting target bytes, engine contents, analysis options, architecture/load mapping, and parser/schema versions where they affect reuse. Validate live state before calling a cached observation current. Cache a refusal only when it is deterministic for that validated key; malformed, partial, transient, or cancelled attempts need explicit retry policy.
One cancelled waiter must not invalidate a successful peer. Preserve producer failure context and each caller's cancellation reason. Retain ownership and capacity charges until shared work and cleanup settle; preserve completed observations when cleanup fails. Exercise invalidation, concurrent consumers, last-waiter cancellation, close, and cleanup retry when those paths change.
Bound the process family and retained state, not just a parent heap or worker count. Account for decoding and serialization expansion before allocation. Choose CPU, memory, concurrency, and disk limits from the host and workload; stop before OOM and verify owned cleanup. A guard-stopped task is incomplete. Do not replace a transport buffer cap with an unbounded retained inventory or hide partial results behind a success status.
让 producer 边界只验证并规范化事实一次。 让 consumers 通过共享 CLI/MCP implementation 查询该表示;adapters 不应重建关系或独立重新解释原始报告。将 lookup identity 与显示格式分离。 在 intent 匹配时复用 contract,同时满足请求的 detail 层级和完整 Evidence 访问需求。
对于每个 cache 或共享 producer,明确其 key、owner、invalidation、保留大小和生命周期。将影响结果的 target bytes、engine 内容、analysis options、architecture/load mapping,以及会影响复用的 parser/schema 版本纳入考量。在将缓存观测称为当前结果之前,验证 live state。仅当 refusal 对该已验证 key 是确定性的时,才缓存 refusal;格式错误、部分完成、瞬时或已取消的尝试需要明确的 retry policy。
一个取消的 waiter 不得使成功的 peer 失效。保留 producer 的失败 context 和每个 caller 的取消原因。在共享工作和 cleanup 完成结算前,保留 ownership 和 capacity 计费;cleanup 失败时保留已完成的观测。当这些路径发生变化时,测试 invalidation、并发 consumers、最后一个 waiter 取消、close 和 cleanup retry。
应限制进程族和保留状态,而不只是父进程 heap 或 worker 数量。在分配前计入 decoding 和 serialization 的扩容量。根据 host 和 workload 选择 CPU、内存、并发和磁盘限制;在 OOM 前停止,并验证负责的 cleanup。被 guard 停止的任务视为未完成。不要以无界的 retained inventory 取代 transport buffer 上限,也不要用成功状态掩盖部分结果。

Compare completed tasks and limit the claim

比较已完成的任务并限定结论

Run the affected real public workflow before and after with equivalent inputs, results, coverage, and Evidence semantics. Include small inputs so setup costs and regressions are visible. Distinguish fresh sessions, warm runtime caches, and OS file caches. Alternate or repeat runs when variance affects the decision. Choose meaningful boundary regressions for cases the actual engine cannot reliably reproduce; a fake engine does not qualify a real provider.
Report task outcome, relevant phase timings, total elapsed and CPU time, peak process-family memory and its accounting method, resource stops, and cleanup. Check the payload exit status as well as the profiler's. Keep failed attempts and identify unmeasured costs; a passing retry does not explain a failure.
For token claims, count schemas/discovery, arguments, replies, retries, and continuations needed to finish the task. Label tokenizer estimates separately from actual model usage and record the client/catalog behavior. Smaller JSON alone establishes neither fewer model tokens nor better investigation quality. Do not claim a complex-software advantage without completed representative investigations and comparable correctness/coverage.
Finish with the bottleneck, owning change, preserved semantics, executed checks, before/after measurements, and remaining limits. Keep any integration record current with its tested revision and distinguish merged production work from experiment-only code. Stop when the demonstrated bottleneck is resolved or further benefit remains speculative.
对受影响的真实公开 workflow 使用等价的输入、结果、coverage 和 Evidence 语义运行前后对比。包含小型输入,以便显示 setup 成本和回归问题。区分全新 session、预热的 runtime cache 与 OS file cache。当方差影响决策时,交替或重复运行。 对于实际 engine 无法可靠复现的 case,选择有意义的边界回归测试;fake engine 不能算作 real provider。
报告任务结果、相关阶段耗时、总 elapsed 与 CPU time、进程族峰值内存及其核算方法、资源限制停止情况和 cleanup。 同时检查 payload 和 profiler 的 exit status。保留失败的尝试并标明未测量的成本;一次成功重试不能解释失败。
对于 token 相关结论,统计完成 task 所需的 schemas/discovery、arguments、replies、retries 和 continuations。单独标明 tokenizer 估算值与实际 model usage,并记录 client/catalog 行为。仅凭更小的 JSON,既不能证明 model token 更少,也不能证明调查质量更高。在缺少已完成且有代表性的 investigations 以及可比的 correctness/coverage 时,不要声称复杂软件具有优势。
最终说明瓶颈、对应 owner 的改动、保留的语义、执行过的检查、修改前后的测量结果和剩余限制。确保任何 integration record 与其受测 revision 保持同步,并区分已合并的 production 工作与仅用于实验的代码。当已证明的瓶颈得到解决,或进一步收益仍属推测时,停止。