Self-hosted, sharable kanban for humans and agents. One 4.7 MB binary, 5 MB of RAM, 10 to 60 tokens per agent reply, starts in 3 ms, zero setup.
Rust ai-agentsclaude-codeclicodexcoding-agentskanbanlocal-firstmcpmcp-servermodel-context-protocolproductivityproject-managementraspberry-pirustself-hostedsqlitetask-manager
Mark tasks for a person, which agents skip
emanuele-em89479109b91b
diff --git a/src/app.js b/src/app.jsindex 407a3b0..32ea89c 100644--- a/src/app.js+++ b/src/app.js@@ -66,6 +66,7 @@ const ICONS = {plus: '<path d="M5 12h14M12 5v14"/>',trash: '<path d="M3 6h18M8 6V4h8v2M19 6l-1 14H6L5 6M10 11v6M14 11v6"/>',check: '<path d="M20 6 9 17l-5-5"/>',+ human: '<circle cx="12" cy="8" r="4"/><path d="M5 21v-1a6 6 0 0 1 6-6h2a6 6 0 0 1 6 6v1"/>',github: '<path d="M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.1-1.3-.3-2.5-1-3.5.3-1.2.3-2.4 0-3.5 0 0-1 0-3 1.5a12 12 0 0 0-8 0C6 2 5 2 5 2c-.3 1.2-.3 2.4 0 3.5A5.4 5.4 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.4.5-.7 1-.8 1.7-.2.6-.3 1.2-.2 1.8v4"/><path d="M9 18c-4.5 2-5-2-7-2"/>',sync: '<path d="M12 13v8"/><path d="M4 14.9A7 7 0 1 1 15.7 8h1.8a4.5 4.5 0 0 1 2.5 8.2"/><path d="m8 17 4-4 4 4"/>',collapse: '<path d="m13 17 5-5-5-5M6 17l5-5-5-5"/>',@@ -583,6 +584,7 @@ function card(t, showProject) {el("div", { class: "head" },el("div", { class: "title" }, t.title),// On "All projects" a dot in the project's colour tells the projects apart.+ t.human ? el("span", { class: "human-mark", title: "Human task: agents skip it" }, icon("human")) : null,el("span", { class: "num", title: `Copy ${key(t)}`, onclick: (e) => { e.stopPropagation(); copyKey(key(t)); } },showProject ? el("span", { class: "dot", style: `background:${projectColor(t.project)}` }) : null, `#${t.id}`)),t.description ? el("div", { class: "desc" }, plainText(t.description)) : null,@@ -770,6 +772,7 @@ async function refreshTask() {status.replaceChildren(...statuses.map((s) => el("option", { value: s }, s)));if (!statuses.includes(task.status)) status.append(el("option", { value: task.status }, task.status));status.value = task.status;+ $("#p-human").checked = task.human;$("#p-created").replaceChildren(timeEl(task.created_at));$("#p-updated").replaceChildren(timeEl(task.updated_at));$("#p-comment-count").textContent = comments.length ? String(comments.length) : "";@@ -867,6 +870,7 @@ $("#p-desc").addEventListener("blur", (e) => {});$("#p-status").addEventListener("change", (e) => patchTask({ status: e.target.value }));+$("#p-human").addEventListener("change", (e) => patchTask({ human: e.target.checked }));// ---------- images ----------diff --git a/src/export.rs b/src/export.rsindex 57d3052..7295a4f 100644--- a/src/export.rs+++ b/src/export.rs@@ -37,6 +37,8 @@ struct TaskOut {title: String,description: String,tags: Vec<String>,+ /// Work for a person, which agents leave alone.+ human: bool,/// Paths of the images attached to the task and its comments.images: Vec<String>,status: String,@@ -53,6 +55,7 @@ impl TaskOut {title: task.title,description: task.description,tags: task.tags,+ human: task.human,images,status: task.status,created_at: task.created_at,@@ -134,6 +137,9 @@ fn markdown(board: &Board) -> String {short_time(&t.created_at),short_time(&t.updated_at));+ if t.human {+ md.push_str("Human task.\n");+ }if !t.tags.is_empty() {let _ = writeln!(md, "Tags: {}.", t.tags.join(", "));}diff --git a/src/index.html b/src/index.htmlindex 51cc87b..c19ddd7 100644--- a/src/index.html+++ b/src/index.html@@ -191,6 +191,21 @@ header .repo-link .icon svg { width: 14px; height: 14px; }#p-key { cursor: copy; }.card .num .dot { width: 6px; height: 6px; }.card .tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }+.card .human-mark { flex: none; margin-top: 1px; color: var(--muted); display: inline-flex; }+.card .human-mark .icon svg { width: 15px; height: 15px; }+/* An on/off switch, for the Human field. */+.human-field { display: flex; align-items: center; gap: 10px; }+.props .human-field .hint { color: var(--faint); font-size: 12px; }+.switch { position: relative; display: inline-flex; width: 34px; height: 20px; flex: none; }+.switch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }+.switch span { flex: 1; border-radius: 99px; background: var(--active); transition: background .15s; }+.switch span::after {+ content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%;+ background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s;+}+.switch input:checked + span { background: #3b82f6; }+.switch input:checked + span::after { transform: translateX(14px); }+.switch input:focus-visible + span { box-shadow: 0 0 0 2px var(--hover); }.card .desc {margin-top: 2px; color: var(--muted); font-size: 13px;white-space: nowrap; overflow: hidden; text-overflow: ellipsis;@@ -410,6 +425,7 @@ header .repo-link .icon svg { width: 14px; height: 14px; }<div class="props">Status <span><select class="field" id="p-status"></select></span>Tags <span><input class="inline" id="p-tags" placeholder="Add tags, like bug, ui" autocomplete="off" spellcheck="false"></span>+ Human <span class="human-field"><label class="switch"><input type="checkbox" id="p-human" aria-label="Human task"><span></span></label><span class="hint">Agents skip it</span></span>Created <span id="p-created"></span>Updated <span id="p-updated"></span></div>diff --git a/src/mcp.rs b/src/mcp.rsindex d8c8317..a415f53 100644--- a/src/mcp.rs+++ b/src/mcp.rs@@ -26,13 +26,13 @@ const INSTRUCTIONS: &str = "Kanzo is the user's kanban board, shared by all theiTasks are written project#id, like api#12. When you leave out `project`, Kanzo uses the project \linked to the GitHub repo of the folder you are working in. A good loop: next_task to pick up work, \add_comment to report what you did, then update_task to move it to review. Tag tasks when it helps, like \-bug or ui: create_task and update_task take `tags`.";+bug or ui: create_task and update_task take `tags`. Leave tasks marked human alone: they're for the user.";const HTTP_INSTRUCTIONS: &str = "Kanzo is the user's kanban board, shared by all their projects. \Tasks are written project#id, like api#12. Over HTTP Kanzo cannot see which folder you work in, so \pass `project` (see list_projects). A good loop: next_task to pick up work, add_comment to report \what you did, then update_task to move it to review. Tag tasks when it helps, like \-bug or ui: create_task and update_task take `tags`.";+bug or ui: create_task and update_task take `tags`. Leave tasks marked human alone: they're for the user.";/// `kanzo mcp`: one agent on stdin and stdout, in the folder it started us in.pub async fn serve(home: Home) -> Result<()> {@@ -335,11 +335,20 @@ impl Kanzo {!old});let hidden = total_hidden;+ // Tasks for a person are left out: agents leave them alone.+ let people = tasks.iter().filter(|t| t.human).count();+ tasks.retain(|t| !t.human);let scope = project.as_ref().map_or("any project".to_string(), |p| p.slug.clone());let mut out: Vec<String> = tasks.iter().map(task_line).collect();if out.is_empty() {out.push(format!("No tasks in {scope}."));}+ if people > 0 {+ out.push(format!(+ "({people} human {} not shown: for the user, not for agents)",+ plural(people, "task")+ ));+ }if hidden > 0 && status.is_none() {out.push(format!("({hidden} {done} not shown; pass status \"{done}\" or \"all\")"));} else if hidden > 0 {@@ -388,6 +397,7 @@ impl Kanzo {status,tags: args.tags,project_id: None,+ human: None,},)?;let moved = if before.status != after.status {@@ -481,6 +491,10 @@ fn task_line(t: &Task) -> String {format!("{} [{}] {}{}{comments}", t.key(), t.status, t.title, tag_list(t))}+fn plural(n: usize, word: &str) -> String {+ if n == 1 { word.to_string() } else { format!("{word}s") }+}+/// ` {bug, ui}`, or nothing without tags.fn tag_list(t: &Task) -> String {if t.tags.is_empty() { String::new() } else { format!(" {{{}}}", t.tags.join(", ")) }@@ -497,7 +511,9 @@ fn task_detail(ctx: &Ctx, store: &Store, t: &Task) -> store::Result<String> {let (created, updated) = (short_time(&t.created_at), short_time(&t.updated_at));// The update time only when it says something the creation time does not.let updated = if updated == created { String::new() } else { format!(", updated {updated}") };- let mut out = format!("{} {}{}\nstatus: {}, created {created}{updated}\n", t.key(), t.title, tag_list(t), t.status);+ let human = if t.human { ", human: for the user, not for agents" } else { "" };+ let mut out =+ format!("{} {}{}\nstatus: {}{human}, created {created}{updated}\n", t.key(), t.title, tag_list(t), t.status);if !t.description.is_empty() {out.push('\n');out.push_str(&t.description);diff --git a/src/store.rs b/src/store.rsindex 2e0ce46..18e5f51 100644--- a/src/store.rs+++ b/src/store.rs@@ -41,6 +41,8 @@ const MIGRATIONS: &[&str] = &[CREATE INDEX images_by_task ON images(task_id);CREATE TRIGGER images_insert AFTER INSERT ON images BEGIN UPDATE meta SET value = value + 1 WHERE key = 'changes'; END;CREATE TRIGGER images_delete AFTER DELETE ON images BEGIN UPDATE meta SET value = value + 1 WHERE key = 'changes'; END;",+ // 6: tasks for a person, which agents leave alone.+ "ALTER TABLE tasks ADD COLUMN human INTEGER NOT NULL DEFAULT 0;",];/// The colours a project can be given; the board maps each name to a shade.@@ -106,6 +108,8 @@ pub struct Task {pub description: String,/// Lowercase, without duplicates, in the order they were given.pub tags: Vec<String>,+ /// Work for a person: agents leave it alone, and `next_task` never picks it.+ pub human: bool,pub status: String,pub position: f64,pub created_at: String,@@ -149,6 +153,7 @@ pub struct TaskPatch {pub project_id: Option<i64>,/// Comma-separated; replaces all the tags, and an empty string clears them.pub tags: Option<String>,+ pub human: Option<bool>,}pub struct Store {@@ -430,7 +435,7 @@ impl Store {// Tasksconst TASK_SELECT: &str = "SELECT t.id, p.slug, t.title, t.description, t.status, t.position,- t.created_at, t.updated_at, (SELECT count(*) FROM comments c WHERE c.task_id = t.id), t.tags+ t.created_at, t.updated_at, (SELECT count(*) FROM comments c WHERE c.task_id = t.id), t.tags, t.humanFROM tasks t JOIN projects p ON p.id = t.project_id";fn task_row(r: &Row) -> rusqlite::Result<Task> {@@ -440,6 +445,7 @@ impl Store {title: r.get(2)?,description: r.get(3)?,tags: r.get::<_, String>(9)?.split(',').filter(|t| !t.is_empty()).map(String::from).collect(),+ human: r.get(10)?,status: r.get(4)?,position: r.get(5)?,created_at: r.get(6)?,@@ -558,6 +564,12 @@ impl Store {params![p, id],)?;}+ if let Some(human) = patch.human {+ c.execute(+ &format!("UPDATE tasks SET human = ?1, updated_at = {NOW} WHERE id = ?2 AND human <> ?1"),+ params![human, id],+ )?;+ }if let Some(t) = &patch.tags {c.execute(&format!("UPDATE tasks SET tags = ?1, updated_at = {NOW} WHERE id = ?2"),@@ -643,14 +655,16 @@ impl Store {Ok(())}- /// Takes the top task of the first column and moves it to the bottom of the second.+ /// Takes the top task of the first column that isn't for a person, and moves it to+ /// the bottom of the second.pub fn next_task(&self, project_id: Option<i64>) -> Result<Option<Task>> {let from = self.first_status();let to = &self.statuses[1];let id = self.write(|c| {let id: Option<i64> = c.query_row(- "SELECT id FROM tasks WHERE status = ?1 AND (?2 IS NULL OR project_id = ?2) ORDER BY position LIMIT 1",+ "SELECT id FROM tasks WHERE status = ?1 AND human = 0 AND (?2 IS NULL OR project_id = ?2) \+ ORDER BY position LIMIT 1",params![from, project_id],|r| r.get(0),)@@ -1138,6 +1152,9 @@ mod tests {let api = s.create_project("api", "", None).unwrap();let web = s.create_project("web", "", None).unwrap();s.create_task(web.id, "web first", "").unwrap();+ // At the top of api's todo, but for a person: agents never get it.+ let human = s.create_task(api.id, "Call the bank", "").unwrap();+ assert!(s.update_task(human.id, TaskPatch { human: Some(true), ..Default::default() }).unwrap().human);s.create_task(api.id, "api first", "").unwrap();s.create_task(api.id, "api second", "").unwrap();@@ -1146,6 +1163,7 @@ mod tests {assert_eq!(s.next_task(None).unwrap().unwrap().title, "web first");assert_eq!(s.next_task(Some(api.id)).unwrap().unwrap().title, "api second");assert!(s.next_task(Some(api.id)).unwrap().is_none());+ assert_eq!(s.get_task(human.id).unwrap().status, "todo");}#[test]diff --git a/src/web.rs b/src/web.rsindex 9d53f82..1853b33 100644--- a/src/web.rs+++ b/src/web.rs@@ -396,6 +396,7 @@ struct Patch {status: Option<String>,project: Option<String>,tags: Option<String>,+ human: Option<bool>,}async fn update_task(State(home): Shared, Path(id): Path<i64>, Json(p): Json<Patch>) -> Response {@@ -403,7 +404,14 @@ async fn update_task(State(home): Shared, Path(id): Path<i64>, Json(p): Json<Patlet project_id = p.project.map(|slug| s.find_project(&slug)).transpose()?.map(|p| p.id);s.update_task(id,- TaskPatch { title: p.title, description: p.description, status: p.status, project_id, tags: p.tags },+ TaskPatch {+ title: p.title,+ description: p.description,+ status: p.status,+ project_id,+ tags: p.tags,+ human: p.human,+ },)}).await