task_scopes: an optional scope, and say which scope a project question wants
The store has many projects; makronix has far more open tasks than mikronix. A
model working in ~/src/mikronix called task_scopes {} and then presented the
makronix counts as the mikronix answer. task_scopes now accepts scope=<project>
with the same prefix match as task_list (scope "mikronix" includes
"mikronix/build"), and its description says to pass the working directory's
project and never present another project's scopes as the answer. task_list
says the same for a scope-less list, and the task_create example no longer
names makronix (a busy real scope seeded the bias).
A 4B and a 35B now call task_scopes {"scope":"mikronix"} and
task_list {"scope":"mikronix","state":"pending"} where the same prompt
previously produced an unscoped call.
tests/run.py: 30 PASS, 0 FAILURES.
This commit is contained in:
1 parent
92c0d4f63c
commit
e557edd3ae
1 file changed
+17
-8
@@ -739,12 +739,12 @@ static void t_list(mcp_conn *c, const mcp_json *args, void *user)
|
||||
|
||||
static void t_scopes(mcp_conn *c, const mcp_json *args, void *user)
|
||||
{
|
||||
const char *scope = mcp_arg_string(args, "scope");
|
||||
char **ids = NULL;
|
||||
size_t n, i, s, nscopes = 0;
|
||||
char **scopes = NULL;
|
||||
mcp_buf b;
|
||||
|
||||
(void)args;
|
||||
(void)user;
|
||||
n = scan_tasks(&ids);
|
||||
for (i = 0; i < n; i++) {
|
||||
@@ -754,6 +754,10 @@ static void t_scopes(mcp_conn *c, const mcp_json *args, void *user)
|
||||
|
||||
if (task_load(ids[i], &t) != 0)
|
||||
continue;
|
||||
if (!scope_matches(t.scope, scope)) {
|
||||
free_task(&t);
|
||||
continue;
|
||||
}
|
||||
for (k = 0; k < nscopes; k++)
|
||||
if (strcmp(scopes[k], t.scope) == 0)
|
||||
found = 1;
|
||||
@@ -887,13 +891,13 @@ static const mcp_tool TOOLS[] = {
|
||||
"Add a task to the central store. Every task needs three things: a title, a "
|
||||
"GOAL (why it exists, one sentence, written for the agent who picks it up "
|
||||
"later) and a SCOPE - a free string you choose that groups this work, e.g. "
|
||||
"\"makronix\", \"fleet/console\", \"studio/mastering\". Reuse an existing "
|
||||
"\"project\", \"fleet/console\", \"studio/mastering\". Reuse an existing "
|
||||
"scope when the work belongs to it; invent a new one only for a new area. "
|
||||
"Higher priority is claimed first.",
|
||||
"{\"type\":\"object\",\"properties\":{"
|
||||
"\"title\":{\"type\":\"string\",\"description\":\"what to do, one line\"},"
|
||||
"\"goal\":{\"type\":\"string\",\"description\":\"why it exists - required\"},"
|
||||
"\"scope\":{\"type\":\"string\",\"description\":\"category string, e.g. makronix or fleet/console\"},"
|
||||
"\"scope\":{\"type\":\"string\",\"description\":\"category string, e.g. project or fleet/console\"},"
|
||||
"\"priority\":{\"type\":\"integer\",\"description\":\"higher runs first, default 0\"},"
|
||||
"\"tags\":{\"type\":\"string\",\"description\":\"extra keywords, comma separated\"}},"
|
||||
"\"required\":[\"title\",\"goal\",\"scope\"]}",
|
||||
@@ -922,14 +926,19 @@ static const mcp_tool TOOLS[] = {
|
||||
"\"scope\":{\"type\":\"string\",\"description\":\"empty or omitted matches every scope\"}}}",
|
||||
t_next },
|
||||
{ "task_scopes",
|
||||
"Overview of every scope that has tasks, with counts of pending, running, "
|
||||
"paused, done and dropped. Read this when you join work you have not done "
|
||||
"before: it shows where things are waiting for an agent.",
|
||||
"{\"type\":\"object\",\"properties\":{}}",
|
||||
"Overview of the scopes that have tasks, with counts of pending, running, "
|
||||
"paused, done and dropped. Pass scope=<project> to see only that project and "
|
||||
"its children. When the working directory is a project, use its name as the "
|
||||
"scope; never present another project's scopes as the answer to a question "
|
||||
"about this one.",
|
||||
"{\"type\":\"object\",\"properties\":{"
|
||||
"\"scope\":{\"type\":\"string\",\"description\":\"only this project/prefix, e.g. mikronix\"}}}",
|
||||
t_scopes },
|
||||
{ "task_list",
|
||||
"List tasks filtered by scope and, optionally, by state. Use it to see the "
|
||||
"whole picture of one area, or to review what is paused.",
|
||||
"whole picture of one area, or to review what is paused. When the user names "
|
||||
"a project or the working directory is a project, pass its scope; without one "
|
||||
"the list is global and may be dominated by unrelated work.",
|
||||
"{\"type\":\"object\",\"properties\":{"
|
||||
"\"scope\":{\"type\":\"string\"},"
|
||||
"\"state\":{\"type\":\"string\",\"description\":\"pending|running|paused|done|dropped\"},"
|
||||
|
||||
Reference in new issue
Block a user