Skip to content

Soul-driven AI agent with permission-hardened tools, token budgets, and multi-channel access. Runs 24/7 from CLI, Telegram or More.

v0.3.1 — fix GITHUB_TOKEN loading from ~/.mercury/.env + add GitHub prompt to system context

Salman Qureshie6d592c1af04
diff --git a/package.json b/package.json
index 12c0aa90..1a8aa914 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@cosmicstack/mercury-agent",
- "version": "0.3.0",
+ "version": "0.3.1",
"description": "Soul-driven AI agent with permission-hardened tools, token budgets, and multi-channel access. Runs 24/7 from CLI or Telegram.",
"type": "module",
"main": "dist/index.js",
diff --git a/src/core/agent.ts b/src/core/agent.ts
index fda03944..5dd12e36 100644
--- a/src/core/agent.ts
+++ b/src/core/agent.ts
@@ -385,6 +385,12 @@ export class Agent {
if (this.tokenBudget.getUsagePercentage() > 70) {
prompt += '\nBe concise to conserve tokens.';
}
+ const toolNames = this.capabilities.getToolNames();
+ const githubTools = ['create_pr', 'review_pr', 'list_issues', 'create_issue', 'github_api'];
+ const hasGitHub = githubTools.some(t => toolNames.includes(t));
+ if (hasGitHub) {
+ prompt += '\n\nGitHub companion is active. You can create pull requests, review PRs, manage issues, and use the GitHub API. When the user asks to create a PR, use create_pr. When they ask about issues, use list_issues or create_issue. When they ask to review a PR, use review_pr.';
+ }
return prompt;
}
diff --git a/src/utils/config.ts b/src/utils/config.ts
index 4df422b3..6c029bc9 100644
--- a/src/utils/config.ts
+++ b/src/utils/config.ts
@@ -1,13 +1,17 @@
import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'node:fs';
-import { join } from 'node:path';
+import { join, resolve } from 'node:path';
import { homedir } from 'node:os';
import { parse as parseYaml, stringify as stringifyYaml } from 'yaml';
import { config as loadDotenv } from 'dotenv';
-loadDotenv();
-
const MERCURY_HOME = join(homedir(), '.mercury');
+loadDotenv();
+const mercuryEnvPath = join(MERCURY_HOME, '.env');
+if (existsSync(mercuryEnvPath)) {
+ loadDotenv({ path: mercuryEnvPath });
+}
+
export function getMercuryHome(): string {
return process.env.MERCURY_HOME || MERCURY_HOME;
}