MCPcopy Create free account
hub / github.com/Noumena-Network/code / getSystemPrompt

Function getSystemPrompt

src/tools/AgentTool/built-in/ncodeGuideAgent.ts:119–202  ·  view source on GitHub ↗
({ toolUseContext })

Source from the content-addressed store, hash-verified

117 model: 'inherit',
118 permissionMode: 'dontAsk',
119 getSystemPrompt({ toolUseContext }) {
120 const commands = toolUseContext.options.commands
121
122 // Build context sections
123 const contextSections: string[] = []
124
125 // 1. Custom skills
126 const customCommands = commands.filter(cmd => cmd.type === 'prompt')
127 if (customCommands.length > 0) {
128 const commandList = customCommands
129 .map(cmd => `- /${cmd.name}: ${cmd.description}`)
130 .join('\n')
131 contextSections.push(
132 `**Available custom skills in this project:**\n${commandList}`,
133 )
134 }
135
136 // 2. Custom agents from .ncode/agents/
137 const customAgents =
138 toolUseContext.options.agentDefinitions.activeAgents.filter(
139 (a: AgentDefinition) => a.source !== 'built-in',
140 )
141 if (customAgents.length > 0) {
142 const agentList = customAgents
143 .map((a: AgentDefinition) => `- ${a.agentType}: ${a.whenToUse}`)
144 .join('\n')
145 contextSections.push(
146 `**Available custom agents configured:**\n${agentList}`,
147 )
148 }
149
150 // 3. MCP servers
151 const mcpClients = toolUseContext.options.mcpClients
152 if (mcpClients && mcpClients.length > 0) {
153 const mcpList = mcpClients
154 .map((client: { name: string }) => `- ${client.name}`)
155 .join('\n')
156 contextSections.push(`**Configured MCP servers:**\n${mcpList}`)
157 }
158
159 // 4. Plugin commands
160 const pluginCommands = commands.filter(
161 cmd => cmd.type === 'prompt' && cmd.source === 'plugin',
162 )
163 if (pluginCommands.length > 0) {
164 const pluginList = pluginCommands
165 .map(cmd => `- /${cmd.name}: ${cmd.description}`)
166 .join('\n')
167 contextSections.push(`**Available plugin skills:**\n${pluginList}`)
168 }
169
170 // 5. User settings
171 const settings = getSettings_DEPRECATED()
172 if (Object.keys(settings).length > 0) {
173 // eslint-disable-next-line no-restricted-syntax -- human-facing UI, not tool_result
174 const settingsJson = jsonStringify(settings, null, 2)
175 contextSections.push(
176 `**User's settings.json:**\n\`\`\`json\n${settingsJson}\n\`\`\``,

Callers 2

resumeAgentBackgroundFunction · 0.50
callFunction · 0.50

Calls 4

jsonStringifyFunction · 0.85
getFeedbackGuidelineFunction · 0.85
getNCodeGuideBasePromptFunction · 0.85
keysMethod · 0.80

Tested by

no test coverage detected