-
Notifications
You must be signed in to change notification settings - Fork 477
refactor: move KIMI_AGENTS_MD to first message from system prompt. #293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
494b447 to
700c8e5
Compare
8d970af to
5dbbfdc
Compare
|
Finally codex-max-xhigh say:
|
49c21ae to
6845d43
Compare
c504b9c to
25dc8ae
Compare
|
Codex Review: Didn't find any major issues. Swish! |
de6d355 to
022d567
Compare
|
I see #328 merged and if we want multi-agent in different AGENTS.md working on the same history, this refactor become must have. Another scenario I can image is add a new option like |
5d986ba to
911ea85
Compare
91f1115 to
1422db3
Compare
*. Runtime now loads AGENTS.md once and keeps it beside other runtime metadata instead of exposing it through the system prompt arguments, so built-in args are limited to clock/workdir info. *. KimiSoul tracks whether an empty context has been seeded and, on the first run, appends a <system> message containing the AGENTS.md guidance/content before the user’s first message so it lives in the transcript rather than the prompt template.
Removing KIMI_AGENTS_MD from BuiltinSystemPromptArgs means string.Template.substitute no longer receives this key. Any custom agent system prompt that still contains ${KIMI_AGENTS_MD} (common for prompts derived from the previous default) will now raise a KeyError when the agent loads, preventing the CLI from starting. Switching to safe_substitute would preserve backward compatibility.
…e stays in context. Builds the AGENTS injection via a shared _agents_md_message() helper so the startup seeding logic is centralized and reusable. Also reinserts a fresh AGENTS message right after the compaction summary before re-appending preserved turns, preserving the latest user prompt order while keeping project rules visible for the next LLM step.
…agents.md in the active work_dir, and tells the user to delete the file before regenerate.(same as OpenAI codex)
… covered by a regression spec. determine _initial_context_prepared by detecting existing AGENTS content, backfill AGENTS.md even when history exists, and avoid duplicates via the new _agents_md_present helper that scans assistant text parts.
…ly and injected without restarting. reload AGENTS.md into a fresh Runtime via replace, clear _initial_context_prepared based on actual context, and use the refreshed content for the meta-command message so subsequent runs/compactions see it.
…ages via a history reset before re-injecting the fresh instructions, preventing duplicates. Added AGENTS.md detection helper plus Context.reset_history so the backing file and counters are rewritten when stale system messages are dropped.
…d_agents_md), skips regeneration when AGENTS.md already exists but still refreshes the runtime cache and context messaging. Context accepts KaosPath backends by converting to local paths, fixing append/restore operations in tests. The regression test now seeds a temporary AGENTS.md so /init can reload it without hitting the mock LLM flow.
…ts by copying via dataclasses.replace, so required fields travel with both fixed and dynamic clones.
…for async execution. Added type hint for Awaitable and improved assertion for app soul instance.
…ime dataclass (lines 48‑52) that omits the labor_market field and the subagent copy helpers present in soul/agent.py, yet it’s published in the package. Nothing imports this module (rg "soul.runtime" returns no hits), so it only serves as a misleading alternate entry point: importing Runtime from this file produces instances without a labor market, which will break Task/CreateSubagent flows that rely on it. Consider removing this file or wiring it up to the real Runtime to avoid an unusable duplicate API.
…ool runtime dependencies, and labor-market subagents so /init reloads propagate to newly spawned helpers instead of using stale guidance. * Added regression ensuring a CreateSubagent-created helper after /init inherits the refreshed AGENTS.md content and injects it into its initial context.
…d detection to drop stale entries before reinjection, preventing conflicting instructions in refreshed sessions. Added stale AGENTS cleanup before initial injection and kept presence checks tied to the current digest to ensure only the latest instructions remain. Added a regression test that simulates a refreshed AGENTS.md and verifies the stale message is replaced with the new content.
…eckpoint/usage records and only drop messages matching a predicate; so stale AGENTS.md pruning no longer zeros _next_checkpoint_id or strips checkpoint entries. Added regression test_refresh_agents_md_preserves_checkpoints in tests/test_kimisoul.py to cover AGENTS.md refresh when checkpoints already exist and verify new content is injected without losing checkpoint metadata.
…e new history.py responsibility is maintain history: Sequence[Message], move other relative staff to the new history.py if you think relative.
…nd agent, and implemented update_runtime method to handle external runtime changes. Updated init function to utilize new properties for improved clarity and functionality.
…s any previously injected AGENTS.md messages and _agents_md_present no longer treats missing content as satisfied; centralized removal helper handles both stale and deletion cases
… of the same name (reportRedeclaration)
1422db3 to
f631ee1
Compare
Related Issue / TODO
Resolve
KIMI_AGENTS_MD: str # TODO: move to first message from system promptDescription
Know issue
Codex Web Code Review: Didn't find any major issues. Swish!
Codex CLI(gpt-5.1-codex-max vhigh): I did not find any discrete bugs or regressions introduced by this patch. The new AGENTS.md handling, runtime changes, and supporting utilities appear internally consistent and are backed by tests.
Frontier coding agents
larged done by codex.
codex review done by x 19