MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / generateAgentsMd

Method generateAgentsMd

packages/agent-core/src/session/index.ts:598–626  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

596 }
597
598 async generateAgentsMd(): Promise<void> {
599 await this.skillsReady;
600 const mainAgent = this.requireMainAgent();
601
602 try {
603 const handle = await mainAgent.subagentHost!.spawn({
604 profileName: 'coder',
605 parentToolCallId: 'generate-agents-md',
606 prompt: DEFAULT_INIT_PROMPT,
607 description: 'Initialize AGENTS.md',
608 runInBackground: false,
609 signal: new AbortController().signal,
610 });
611 await handle.completion;
612
613 const agentsMd = await loadAgentsMd(mainAgent.kaos, this.options.kimiHomeDir);
614 mainAgent.context.appendSystemReminder(initCompletionReminder(agentsMd), {
615 kind: 'injection',
616 variant: 'init',
617 });
618 await mainAgent.records.flush();
619 } catch (error) {
620 throw new KimiError(
621 ErrorCodes.SESSION_INIT_FAILED,
622 error instanceof Error ? error.message : 'Init failed',
623 { cause: error },
624 );
625 }
626 }
627
628 /**
629 * Appends a fresh `<plugin_session_start>` system reminder to the main agent

Callers 3

initMethod · 0.45
generateAgentsMdFunction · 0.45
init.test.tsFile · 0.45

Calls 6

requireMainAgentMethod · 0.95
loadAgentsMdFunction · 0.90
initCompletionReminderFunction · 0.85
appendSystemReminderMethod · 0.80
spawnMethod · 0.65
flushMethod · 0.65

Tested by

no test coverage detected