feat: demote context startup priority

- cap contexts to 10 per account
- align MCP and onboarding context guidance
- keep contexts optional unless obviously relevant
This commit is contained in:
“BeeRad”
2026-04-13 12:18:47 +10:00
parent 96c72fc908
commit 5dcb2b7df6
15 changed files with 150 additions and 41 deletions
@@ -1,6 +1,7 @@
'use strict';
const { getDb } = require('./sqlite-client');
const MAX_CONTEXTS_PER_ACCOUNT = 10;
function mapContext(row) {
if (!row) return null;
@@ -57,6 +58,10 @@ function createContext({ name, description = null, icon = null }) {
if (!trimmedName) {
throw new Error('Context name is required.');
}
const existingCount = Number(db.prepare('SELECT COUNT(*) AS count FROM contexts').get()?.count ?? 0);
if (existingCount >= MAX_CONTEXTS_PER_ACCOUNT) {
throw new Error(`Context limit reached. Maximum ${MAX_CONTEXTS_PER_ACCOUNT} contexts are allowed per account.`);
}
const now = new Date().toISOString();
const info = db.prepare(`
@@ -126,6 +131,7 @@ function resolveContextId(input = {}) {
}
module.exports = {
MAX_CONTEXTS_PER_ACCOUNT,
listContexts,
getContextById,
getContextByName,