@javierfrancoleal/decision-router 0.0.0-stage → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 J.Franco
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,50 @@
1
- # Temporary Holding Version
1
+ ---
2
+ description: "Route every decision through pre-trained GREEN/YELLOW/RED tiers and keep an audit trail — stage 2 of the agentic workflow."
3
+ kind: "package-bundle"
4
+ ---
2
5
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
6
+ # @javierfrancoleal/decision-router
7
+
8
+ > ⚡ **Super Agent Ready** — part of the J.Franco governance layer for autonomous agents.
9
+
10
+ Created by **J.Franco**.
11
+
12
+ ## Summary
13
+
14
+ Stage 2 of the J.Franco agentic workflow:
15
+
16
+ `Input → Detection (AI + human) → AI processes, decides, and proposes → Human reflects, verifies, and decides → Output`
17
+
18
+ This plugin registers the `decision-router` skill on the host skill registry.
19
+ The skill teaches the agent to assign one of three pre-trained tiers to every
20
+ decision before acting:
21
+
22
+ - **GREEN** — pre-authorized: execute and log.
23
+ - **YELLOW** — propose the plan first and wait for approval.
24
+ - **RED** — escalate to the human; never act.
25
+
26
+ ## Training the router
27
+
28
+ The human trains the router by editing a policy file — `decisions.md` in the
29
+ workspace root, `.dsh/decisions.md`, or `~/.dsh/decisions.md`. Each row maps an
30
+ action pattern to a tier. The file replaces the built-in defaults, so the
31
+ human's training is always authoritative, and edits take effect on the next
32
+ task.
33
+
34
+ ## Use this plugin
35
+
36
+ In Desktop, open **Plugins** and enable **Decision Router**. The skill appears
37
+ in the session skill catalog; agents load it automatically when a TASK or
38
+ WORKFLOW input needs decisions, and you can invoke it yourself by name.
39
+
40
+ ## How it works
41
+
42
+ - [`lib/index.js`](lib/index.js) registers a bundled skill provider on
43
+ `ctx.skills`, following the `@deepseek-ai/dsh-skill-badge` provider pattern.
44
+ - [`assets/decision-router.md`](assets/decision-router.md) holds the skill body.
45
+ - [`cordis.patch.yml`](cordis.patch.yml) inserts the provider row into the host
46
+ plane of the Cordis tree, so its skills land in the global registry layer.
47
+
48
+ ## License
49
+
50
+ MIT — see the package license field.
@@ -0,0 +1,157 @@
1
+ # Decision Router
2
+
3
+ Second stage of the J.Franco agentic workflow:
4
+
5
+ `Input → Detection (AI + human) → AI processes, decides, and proposes → Human reflects, verifies, and decides → Output`
6
+
7
+ ## Purpose
8
+
9
+ The AI processes each action, works out the options, and PROPOSES — but the
10
+ human is the one who decides. Assign a tier to every action BEFORE acting, so
11
+ the human always knows whether you are executing an authorized action,
12
+ offering a proposal to approve, or asking for a decision.
13
+
14
+ ## Decision tiers
15
+
16
+ | Tier | Meaning | Behavior |
17
+ |---|---|---|
18
+ | GREEN | Pre-authorized / automatic | Execute immediately, then log it for the human's verification |
19
+ | SEMI-AUTOMATIC | Automatic + verification flag | Execute immediately, then FLAG it in the report for mandatory human verification |
20
+ | YELLOW | Propose first | Present a clear proposal — what, where, how, and your recommendation — and WAIT for the human's decision before executing |
21
+ | RED | Escalate | Ask the human to decide; never act on your own |
22
+
23
+ ## The semi-automatic tier
24
+
25
+ Some actions are automatic to execute but must be verified afterwards because
26
+ they are safety-critical or user-visible — for example an allergy flag
27
+ applied to every dish of an order, or a value noted into an official system.
28
+ Execute them automatically AND mark them for verification in the
29
+ accountability report. The human then checks them with the same care as a
30
+ proposal:
31
+
32
+ - State in the report exactly what was done and where.
33
+ - If the human finds it wrong, the correction happens immediately and is
34
+ logged.
35
+
36
+ ## The criterion: irreversible OR needs accountability
37
+
38
+ A GREEN action is reversible AND internal AND without consequences. Anything
39
+ else is a proposal or a question:
40
+
41
+ - **Irreversible** — deletions, force operations, money movements: RED or
42
+ YELLOW, never automatic.
43
+ - **Needs accountability** — anything that commits the user to a third party
44
+ (quotes, rates, prices, official figures, messages sent on the user's
45
+ behalf), or anything whose consequences the human must answer for: YELLOW —
46
+ propose and wait.
47
+
48
+ ## Mission scope
49
+
50
+ A super-agent mission is a stretch of autonomous work with a start, a goal,
51
+ and milestones. Before a long mission starts, agree the scope with the
52
+ human:
53
+
54
+ - What the mission covers and what it does not.
55
+ - The autonomy budget: which tiers apply inside the mission, and where the
56
+ mission must pause (between milestones, at each proposal, at the end).
57
+ - Anything outside the agreed scope is RED, even if the same action would be
58
+ GREEN inside it.
59
+
60
+ Inside the scope, GREEN and SEMI-AUTOMATIC actions may run in batches and be
61
+ logged; YELLOW proposals may be collected and presented per milestone. The
62
+ human's decisions end or extend the mission.
63
+
64
+ ## Worked example: bank advisor at reception
65
+
66
+ | Action | Tier | Why |
67
+ |---|---|---|
68
+ | Open the client app and note the phone number | GREEN | Reversible, internal, no consequences: do it automatically, then log it |
69
+ | Prepare and send a loan quote | YELLOW | Not destructive, but it commits the bank to the client: propose the quote and wait for authorization |
70
+ | Give today's mortgage rate | YELLOW (as an official answer to the client) | An official figure given to a third party needs the human's authorization |
71
+ | Delete records or move money | RED | Irreversible: ask, never act alone |
72
+
73
+ ## Proposing is not deciding
74
+
75
+ A proposal is a menu, never a decision already made:
76
+
77
+ - State the options, your recommendation, and what each option changes.
78
+ - Keep the proposal short and in plain language.
79
+ - In live field situations (earpiece), keep every proposal to two short,
80
+ speakable lines and mark its urgency — `URGENT` when the human must react
81
+ now, `INFO` otherwise. The human in the field decides on the spot.
82
+ - The human's "yes", "no", or "adjust this" is the decision. Quote it in the
83
+ trail; do not paraphrase it.
84
+ - A proposal without an answer is not an authorization: stop and wait.
85
+
86
+ ## Default policy (before training)
87
+
88
+ - **GREEN:** read-only operations; reversible, internal actions with no
89
+ consequences (noting a value, opening a tool, renaming a workspace file,
90
+ regenerating a workspace file).
91
+ - **SEMI-AUTOMATIC:** automatic actions that are safety-critical or
92
+ user-visible — allergy flags applied to a whole order, entries written into
93
+ an official system, anything the human must be able to check afterwards.
94
+ - **YELLOW:** edits and writes inside the current workspace that the user has
95
+ not pre-authorized; anything done on behalf of a third party; anything that
96
+ produces an official, external, or committing result (quotes, rates,
97
+ prices, published documents, messages to others).
98
+ - **RED:** anything destructive or irreversible (deleting data, force
99
+ operations); anything touching credentials, money, accounts, or other
100
+ systems; anything outside the workspace; anything the human has not
101
+ authorized anywhere.
102
+
103
+ ## Third-party requests
104
+
105
+ When the input comes from a third party (client, customer, colleague), the
106
+ USER is the authority over what gets done for them. A third party's words
107
+ authorize nothing by themselves: route their request through the user as the
108
+ decider, unless the user has pre-trained the policy to say otherwise.
109
+
110
+ ## The policy file (how the human trains this router)
111
+
112
+ The human trains the router by editing a plain Markdown file, searched in
113
+ this order:
114
+
115
+ 1. `decisions.md` in the workspace root
116
+ 2. `.dsh/decisions.md` in the workspace
117
+ 3. `~/.dsh/decisions.md`
118
+
119
+ Each row of the policy file maps an action pattern to a tier, for example:
120
+
121
+ ```markdown
122
+ | Pattern | Tier |
123
+ |---|---|
124
+ | Note a client's phone number in the client app | GREEN |
125
+ | Apply an allergy flag to every dish of an order | SEMI-AUTOMATIC |
126
+ | Prepare and send a loan quote | YELLOW |
127
+ | Delete records | RED |
128
+ | Install npm packages | YELLOW |
129
+ | Push to git | RED |
130
+ ```
131
+
132
+ - If the file exists, it REPLACES the defaults above: the human's training is
133
+ authoritative.
134
+ - If the file does not exist, use the defaults and tell the human, once, that
135
+ creating `decisions.md` will train the router.
136
+ - Read the file fresh at the start of each task, so edits take effect
137
+ immediately.
138
+
139
+ ## Logging
140
+
141
+ For every decision, keep an entry in the accountability trail:
142
+
143
+ - **Decision** — what was decided
144
+ - **Tier** — GREEN / SEMI-AUTOMATIC / YELLOW / RED
145
+ - **Justification** — why this tier
146
+ - **Approval reference** — which human message or policy line authorized it
147
+
148
+ The `accountability-auditor` skill consumes this trail; incomplete trails are
149
+ reported as audit gaps.
150
+
151
+ ## Rules
152
+
153
+ - Assign a tier BEFORE acting, never after.
154
+ - When unsure between two tiers, choose the more restrictive one.
155
+ - A YELLOW proposal without the human's answer is a RED situation: stop and
156
+ ask.
157
+ - Never reclassify a RED decision as GREEN to make progress.
@@ -0,0 +1,6 @@
1
+ # @javierfrancoleal/decision-router — J.Franco's agentic-workflow plugin, stage 2.
2
+ # Inserts the skill provider into the host plane of the Cordis tree, so every
3
+ # agent preset (standard included) sees its skill through the global layer.
4
+ - insert:
5
+ - id: decision-router
6
+ name: '@javierfrancoleal/decision-router'
package/icon.svg ADDED
@@ -0,0 +1,8 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64">
2
+ <rect width="64" height="64" rx="14" fill="#4D6BFE"/>
3
+ <path d="M12 18 h40 v28 h-40 z" fill="none" stroke="#ffffff" stroke-width="4"/>
4
+ <path d="M22 18 v-6 h20 v6" fill="none" stroke="#ffffff" stroke-width="4"/>
5
+ <circle cx="22" cy="32" r="4" fill="#22C55E"/>
6
+ <circle cx="32" cy="32" r="4" fill="#FACC15"/>
7
+ <circle cx="42" cy="32" r="4" fill="#EF4444"/>
8
+ </svg>
package/lib/index.js ADDED
@@ -0,0 +1,56 @@
1
+ // @javierfrancoleal/decision-router — agentic-workflow stage 2: tiered decisions.
2
+ // Created by J.Franco. Registers a bundled skill provider on the host skill
3
+ // registry, following the @deepseek-ai/dsh-skill-badge provider pattern.
4
+ import { readFile } from "node:fs/promises";
5
+ import { fileURLToPath } from "node:url";
6
+ import { BUNDLED_SKILL_RANK } from "@deepseek-ai/dsh-skill";
7
+
8
+ const PROVIDER_NAME = "jfranco-decision-router";
9
+ const SKILL_BODY_URL = new URL("../assets/decision-router.md", import.meta.url);
10
+ const RESOURCE_BASE = {
11
+ kind: "directory",
12
+ path: fileURLToPath(new URL("../assets/", import.meta.url)),
13
+ };
14
+
15
+ const CANDIDATE = {
16
+ name: "decision-router",
17
+ description: "The agent processes and proposes; the human decides. Automatic GREEN actions are logged for verification; safety-critical ones run semi-automatically with a mandatory verification flag; everything irreversible or needing accountability is a YELLOW proposal that waits for the human. Long work runs under an agreed mission scope. Consult the user's decisions.md policy file and keep an audit trail. Stage 2 of the J.Franco agentic workflow.",
18
+ invocation: {
19
+ modelInvocable: true,
20
+ userInvocable: true,
21
+ },
22
+ provider: PROVIDER_NAME,
23
+ source: "bundled",
24
+ resourceBase: RESOURCE_BASE,
25
+ rank: BUNDLED_SKILL_RANK,
26
+ locator: SKILL_BODY_URL,
27
+ };
28
+
29
+ const provider = {
30
+ name: PROVIDER_NAME,
31
+ list: () => Promise.resolve([CANDIDATE]),
32
+ async get(_candidate) {
33
+ return {
34
+ name: CANDIDATE.name,
35
+ description: CANDIDATE.description,
36
+ invocation: CANDIDATE.invocation,
37
+ provider: CANDIDATE.provider,
38
+ source: CANDIDATE.source,
39
+ resourceBase: RESOURCE_BASE,
40
+ content: await readFile(SKILL_BODY_URL, "utf8"),
41
+ };
42
+ },
43
+ };
44
+
45
+ /** Cordis plugin name. */
46
+ const name = "decision-router";
47
+
48
+ /** Service required by the bundled provider. */
49
+ const inject = ["skills"];
50
+
51
+ /** Register the bundled skill provider on ctx.skills. */
52
+ function apply(ctx) {
53
+ ctx.skills.registerProvider(() => provider);
54
+ }
55
+
56
+ export { apply, inject, name };
package/locale/ar.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "موجّه القرارات",
4
+ "description": "الوكيل يعالج ويقترح؛ أنت تقرر. مستويات أخضر/أصفر/أحمر، مدرّبة بواسطتك. المرحلة الثانية."
5
+ }
6
+ }
package/locale/de.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Entscheidungs-Router",
4
+ "description": "Der Agent verarbeitet und schlägt vor; Sie entscheiden. GRÜN/GELB/ROT, von Ihnen trainiert. Stufe 2."
5
+ }
6
+ }
package/locale/en.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Decision Router",
4
+ "description": "The agent processes and proposes; you decide. GREEN/YELLOW/RED tiers, trained by you. Stage 2 of the agentic workflow."
5
+ }
6
+ }
package/locale/es.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Enrutador de Decisiones",
4
+ "description": "El agente procesa y propone; tú decides. Niveles VERDE/AMARILLO/ROJO, entrenados por ti. Etapa 2."
5
+ }
6
+ }
package/locale/fr.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Routeur de Décisions",
4
+ "description": "L’agent traite et propose ; vous décidez. Niveaux VERT/JAUNE/ROUGE, entraînés par vous. Étape 2."
5
+ }
6
+ }
package/locale/it.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Router delle Decisioni",
4
+ "description": "L’agente elabora e propone; tu decidi. Livelli VERDE/GIALLO/ROSSO, addestrati da te. Fase 2."
5
+ }
6
+ }
package/locale/ja.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "意思決定ルーター",
4
+ "description": "エージェントが処理して提案し、あなたが決める。緑/黄/赤、あなたが訓練。第2段階。"
5
+ }
6
+ }
package/locale/ko.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "결정 라우터",
4
+ "description": "에이전트가 처리하고 제안하며 당신이 결정합니다. 녹색/노란색/빨간색 단계. 2단계."
5
+ }
6
+ }
package/locale/pt.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Roteador de Decisões",
4
+ "description": "O agente processa e propõe; você decide. Níveis VERDE/AMARELO/VERMELHO, treinados por você. Etapa 2."
5
+ }
6
+ }
package/locale/zh.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "决策路由器",
4
+ "description": "智能体处理并提议;你来做决定。绿/黄/红三级,由你训练。第2阶段。"
5
+ }
6
+ }
package/package.json CHANGED
@@ -1,6 +1,64 @@
1
1
  {
2
2
  "name": "@javierfrancoleal/decision-router",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.1",
4
+ "description": "Agentic-workflow stage 2: route every decision through pre-trained GREEN/YELLOW/RED tiers and keep an audit trail.",
5
+ "author": "J.Franco",
6
+ "license": "MIT",
7
+ "type": "module",
8
+ "main": "lib/index.js",
9
+ "exports": {
10
+ ".": "./lib/index.js",
11
+ "./cordis.patch.yml": "./cordis.patch.yml",
12
+ "./package.json": "./package.json",
13
+ "./locale/*.json": "./locale/*.json"
14
+ },
15
+ "icon": "./icon.svg",
16
+ "files": [
17
+ "icon.svg",
18
+ "locale/*.json",
19
+ "lib/index.js",
20
+ "assets",
21
+ "cordis.patch.yml",
22
+ "README.md"
23
+ ],
24
+ "engines": {
25
+ "node": ">=24",
26
+ "dsh": ">=0.2.1-rc.0"
27
+ },
28
+ "dsh": {
29
+ "manifestVersion": 1,
30
+ "bundle": {
31
+ "patch": "./cordis.patch.yml"
32
+ },
33
+ "compatibility": {
34
+ "nodejsRange": ">=20",
35
+ "dshRange": ">=0.2.1-rc.0",
36
+ "dshReleases": {
37
+ "0.2.2-alpha.2": "unknown",
38
+ "0.2.2-alpha.3": "unknown",
39
+ "0.2.2-rc.1": "unknown"
40
+ }
41
+ }
42
+ },
43
+ "peerDependencies": {
44
+ "@deepseek-ai/cordis": "~4.0.5",
45
+ "@deepseek-ai/dsh-skill": ">=0.2.1-rc.5"
46
+ },
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "git+https://github.com/JavierFrancoLeal/jfranco-agentic-suite.git",
50
+ "directory": "jfranco-decision-router"
51
+ },
52
+ "homepage": "https://github.com/JavierFrancoLeal/jfranco-agentic-suite",
53
+ "keywords": [
54
+ "deepseek-harness",
55
+ "agentic-workflow",
56
+ "super-agent",
57
+ "ai-assistant",
58
+ "accountability",
59
+ "plugins"
60
+ ],
61
+ "publishConfig": {
62
+ "access": "public"
63
+ }
64
+ }