Top 3 priorities: a JavaScript command for Plainer
Pick priorities is a command written in JavaScript. It ranks your open top-level tasks and assigns up to three of them to the selected day. The code is yours to read and change: add loops and conditions, or write a different workflow.
Command · Pick priorities · JavaScript starter · By Plainer · Version 1
Free, no account needed. Opens Plainer with an example plan and shows what the template adds before you install it. Sign in when you want to keep it.
Pick priorities · code.command.jsCommand file
Pick priorities · codeRuns your JavaScript in an isolated engine
Rank tasks and assign up to three to the selected day.
JAVASCRIPT
// Use any JavaScript logic over your own data. await is supported.
const records = await plainer.getRecords('items');
const candidates = records.filter(r => !r.values.done && !r.values.parentId);
const ranked = candidates.sort((a,b) =>
(2*(b.values.importance||0)+(b.values.urgency||0)) -
(2*(a.values.importance||0)+(a.values.urgency||0))
);
const chosen = ranked.slice(0, 3);
for (const record of chosen) {
await plainer.updateRecord('items', record.id, {day:plainer.day});
}
console.log('Selected', chosen.length, 'priorities');
return {message:'Selected '+chosen.length+' priorities for '+plainer.day, titles:chosen.map(r=>r.values.title)};
What it does
Reads your tasks and keeps the open top-level ones.
Ranks them by 2 × importance + urgency, highest first.
Assigns the top three to the selected day and reports which ones it chose.
Runs in an isolated JavaScript engine and saves its changes together, only after it succeeds.
What you get after installing
Pick priorities · code.command.js
A command file. Runs its JavaScript when you choose Run.
Installed files are your own copies. Files that use your tasks, projects or goals keep using your existing content. Commands run only when you choose Run.
Who it is for
People who want a simple, predictable rule for choosing the day’s tasks.
Developers who want to script their own planning logic.
How to install it
Select Use this template. Plainer opens with an example plan, no account needed.
Check what the template adds, then choose Install my own copy. Without an account, it is saved in this browser.
Sign in or create a free account to keep it. Your guest plan, with the template, moves into your account. Commands that use the assistant need the account.