@llmtune/cli 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,7 +19,9 @@ async function runAgentLoop(client, conversation, registry, userInput, config, o
19
19
  parameters: spec.inputSchema,
20
20
  },
21
21
  }));
22
- const contextResult = await (0, builder_1.buildContextPrompt)(config.workspaceRoot, config.cwd);
22
+ const contextResult = await (0, builder_1.buildContextPrompt)(config.workspaceRoot, config.cwd, {
23
+ model: config.model,
24
+ });
23
25
  const contextPrompt = contextResult.prompt;
24
26
  let totalToolCalls = 0;
25
27
  let totalTokensIn = 0;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Core agent identity — prepended to every system prompt so the model
3
+ * identifies as LLMTune Agent, not Claude/ChatGPT/etc.
4
+ */
5
+ export declare function buildAgentIdentitySection(model?: string): string;
6
+ //# sourceMappingURL=agent-identity.d.ts.map
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildAgentIdentitySection = buildAgentIdentitySection;
4
+ const version_1 = require("../version");
5
+ /**
6
+ * Core agent identity — prepended to every system prompt so the model
7
+ * identifies as LLMTune Agent, not Claude/ChatGPT/etc.
8
+ */
9
+ function buildAgentIdentitySection(model) {
10
+ const modelLine = model ? `- Model: ${model} (via llmtune.io)` : "- Models served through llmtune.io (e.g. GLM-5.1)";
11
+ return [
12
+ "# LLMTune Agent",
13
+ "",
14
+ "You are the **LLMTune Agent** — an AI coding assistant from [llmtune.io](https://llmtune.io).",
15
+ "",
16
+ "## Identity (always follow)",
17
+ `- You are **LLMTune Agent**, running in the LLMTune CLI (v${version_1.CLI_VERSION}).`,
18
+ "- You are **not** Claude, ChatGPT, Copilot, Cursor, or any product from Anthropic, OpenAI, or Microsoft.",
19
+ "- When asked who you are, say you are the LLMTune Agent powered by llmtune.io. Never claim another brand or company.",
20
+ modelLine,
21
+ "",
22
+ "## How you work",
23
+ "- You run locally on the user's machine through `llmtune chat`.",
24
+ "- You use tools (read, write, edit, bash, glob, grep, web-fetch) to act on the workspace.",
25
+ "- Follow project instructions in LLMTUNE.md or CLAUDE.md when present.",
26
+ "",
27
+ "## Behavior",
28
+ "- Be concise, direct, and helpful.",
29
+ "- Use tools to investigate and make changes — do not only describe what you would do.",
30
+ "- Stay on the user's task; do not ask them to remind you unless context was explicitly compacted.",
31
+ ].join("\n");
32
+ }
33
+ //# sourceMappingURL=agent-identity.js.map
@@ -9,5 +9,6 @@ export declare function readCache(cacheKey: string): ContextResult | null;
9
9
  export declare function writeCache(cacheKey: string, result: ContextResult): void;
10
10
  export declare function buildContextPrompt(workspaceRoot: string, cwd: string, options?: {
11
11
  useCache?: boolean;
12
+ model?: string;
12
13
  }): Promise<ContextResult>;
13
14
  //# sourceMappingURL=builder.d.ts.map
@@ -43,6 +43,7 @@ const fs = __importStar(require("fs"));
43
43
  const git_context_1 = require("./git-context");
44
44
  const workspace_1 = require("./workspace");
45
45
  const llmtune_md_1 = require("./llmtune-md");
46
+ const agent_identity_1 = require("./agent-identity");
46
47
  const CACHE_DIR = () => {
47
48
  const base = process.env.LLMTUNE_CACHE_DIR || path.join(process.env.HOME || process.env.USERPROFILE || "~", ".llmtune", "cache");
48
49
  return base;
@@ -86,36 +87,47 @@ function writeCache(cacheKey, result) {
86
87
  }
87
88
  async function buildContextPrompt(workspaceRoot, cwd, options) {
88
89
  const cacheKey = computeCacheKey(workspaceRoot, cwd);
90
+ const identity = (0, agent_identity_1.buildAgentIdentitySection)(options?.model);
91
+ let workspaceSections = [];
89
92
  if (options?.useCache !== false) {
90
93
  const cached = readCache(cacheKey);
91
- if (cached)
92
- return cached;
94
+ if (cached) {
95
+ workspaceSections = cached.sections;
96
+ return {
97
+ prompt: [identity, ...workspaceSections].filter(Boolean).join("\n\n"),
98
+ cacheKey,
99
+ cacheHit: true,
100
+ sections: [identity, ...workspaceSections],
101
+ };
102
+ }
93
103
  }
94
- const sections = [];
95
104
  // Workspace section (async)
96
105
  const workspace = await (0, workspace_1.buildWorkspaceSnapshot)(workspaceRoot, cwd);
97
106
  const workspaceSection = (0, workspace_1.renderWorkspaceSection)(workspace);
98
107
  if (workspaceSection)
99
- sections.push(workspaceSection);
108
+ workspaceSections.push(workspaceSection);
100
109
  // Git section
101
110
  const git = (0, git_context_1.collectGitContext)(workspaceRoot);
102
111
  const gitSection = renderGitSection(git);
103
112
  if (gitSection)
104
- sections.push(gitSection);
113
+ workspaceSections.push(gitSection);
105
114
  // LLMTUNE.md / CLAUDE.md section
106
115
  const mdFiles = (0, llmtune_md_1.loadProjectInstructions)(workspaceRoot, cwd);
107
116
  const mdSection = renderMdSection(mdFiles, workspaceRoot);
108
117
  if (mdSection)
109
- sections.push(mdSection);
110
- const prompt = sections.join("\n\n");
111
- const result = {
112
- prompt,
118
+ workspaceSections.push(mdSection);
119
+ writeCache(cacheKey, {
120
+ prompt: workspaceSections.join("\n\n"),
121
+ cacheKey,
122
+ cacheHit: false,
123
+ sections: workspaceSections,
124
+ });
125
+ return {
126
+ prompt: [identity, ...workspaceSections].filter(Boolean).join("\n\n"),
113
127
  cacheKey,
114
128
  cacheHit: false,
115
- sections,
129
+ sections: [identity, ...workspaceSections],
116
130
  };
117
- writeCache(cacheKey, result);
118
- return result;
119
131
  }
120
132
  function renderGitSection(git) {
121
133
  if (!git.available)
package/dist/repl/repl.js CHANGED
@@ -52,6 +52,7 @@ const web_fetch_1 = require("../tools/tools/web-fetch");
52
52
  const ask_user_1 = require("../tools/tools/ask-user");
53
53
  const service_1 = require("../compact/service");
54
54
  const analyzer_1 = require("../context/analyzer");
55
+ const builder_1 = require("../context/builder");
55
56
  const loader_1 = require("../skills/loader");
56
57
  const trust_1 = require("../skills/trust");
57
58
  const service_2 = require("../memory/service");
@@ -256,8 +257,9 @@ async function handleCommand(input, ctx) {
256
257
  console.log(chalk_1.default.green("Conversation cleared."));
257
258
  break;
258
259
  case "/context": {
260
+ const ctxResult = await (0, builder_1.buildContextPrompt)(ctx.cwd, ctx.cwd, { model: ctx.getModel() });
259
261
  const analysis = (0, analyzer_1.analyzeContextUsage)({
260
- systemPrompt: "LLMTune coding agent",
262
+ systemPrompt: ctxResult.prompt,
261
263
  toolSpecs: ctx.registry.listSpecs(),
262
264
  messages: ctx.conversation.getApiMessages().map((m) => ({
263
265
  role: m.role,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llmtune/cli",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "LLMTune CLI -AI CLI Agent powered by llmtune.io",
5
5
  "main": "dist/index.js",
6
6
  "bin": {