anriltine commited on
Commit
e391004
Β·
verified Β·
1 Parent(s): adc4125

Deploy TinyModel1Space from GitHub Actions

Browse files
scripts/nl_controls.py CHANGED
@@ -2979,6 +2979,59 @@ def _embedded_user_story(m: str) -> tuple[str, str] | None:
2979
  return instr, "user_story"
2980
 
2981
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2982
  def _embedded_five_whys(m: str) -> tuple[str, str] | None:
2983
  """``five_whys`` β€” iterative Why chain for root-cause analysis (distinct from full postmortem)."""
2984
  if len(m) < 48:
@@ -3697,7 +3750,7 @@ def analyze_embedded_prompt_signals(message: str) -> tuple[dict[str, str], list[
3697
  ``topic_must``, ``glossary``, ``spelling_uk``, ``spelling_us``, ``risks_mitigations``,
3698
  ``timeline_chron``, ``timeline_reverse``, ``voice_second``, ``voice_third``, ``faq_qa``,
3699
  ``summary_last``, ``decision_matrix``, ``build_vs_buy``, ``one_pager``, ``action_plan``, ``raci``, ``stakeholder_map``, ``swot``, ``pestle``, ``cost_benefit``, ``open_questions``, ``scenario_cases``,
3700
- ``postmortem``, ``sprint_retro``, ``user_story``, ``five_whys``, ``fishbone``,
3701
  ``recommendation_first``,
3702
  ``go_no_go``,
3703
  ``frame_star``, ``frame_prep``, ``frame_irac``). Session-style overrides
@@ -3894,6 +3947,11 @@ def analyze_embedded_prompt_signals(message: str) -> tuple[dict[str, str], list[
3894
  extras.append(ust[0])
3895
  trace_tags.append(ust[1])
3896
 
 
 
 
 
 
3897
  fw = _embedded_five_whys(m)
3898
  if fw:
3899
  extras.append(fw[0])
 
2979
  return instr, "user_story"
2980
 
2981
 
2982
+ def _embedded_definition_of_done(m: str) -> tuple[str, str] | None:
2983
+ """``definition_of_done`` β€” agile DoD checklist of verifiable completion criteria."""
2984
+ if len(m) < 48:
2985
+ return None
2986
+ no_dod = bool(
2987
+ re.search(
2988
+ r"\b(no definition of done|without (?:a\s+)?definition of done|"
2989
+ r"not a definition of done|skip (?:the\s+)?definition of done|"
2990
+ r"don'?t use definition of done|avoid definition of done (?:format|section)|"
2991
+ r"no dod format|skip (?:the\s+)?dod format|"
2992
+ r"no done criteria section|skip (?:the\s+)?done criteria section)\b",
2993
+ m,
2994
+ )
2995
+ )
2996
+ if no_dod:
2997
+ return None
2998
+ checklist_only = bool(
2999
+ re.search(
3000
+ r"\b((?:as a|use a|markdown) checklist|checklist (?:format|style)|"
3001
+ r"tick[- ]box(?:es)?|checkbox(?:es)? (?:list|format))\b",
3002
+ m,
3003
+ )
3004
+ )
3005
+ if checklist_only:
3006
+ return None
3007
+ want = bool(
3008
+ re.search(
3009
+ r"\b(definition of done(?:\s+format)?|definition[- ]of[- ]done|"
3010
+ r"\bdod\b(?:\s+format|\s+checklist|\s+criteria)?|"
3011
+ r"done criteria(?:\s+checklist)?|"
3012
+ r"what counts as done|exit criteria (?:for|on) (?:the\s+)?(?:story|sprint|feature|epic|release)|"
3013
+ r"completion criteria (?:for|before)|"
3014
+ r"ready for (?:done|merge|release) criteria)\b",
3015
+ m,
3016
+ )
3017
+ )
3018
+ if not want:
3019
+ return None
3020
+ if not re.search(
3021
+ r"\b(sprint|story|epic|feature|backlog|agile|scrum|team|deliverable|"
3022
+ r"ship|merge|release|implement|write|draft|describe|outline|align)\b",
3023
+ m,
3024
+ ):
3025
+ return None
3026
+ instr = (
3027
+ "The user wants a **Definition of Done**: use a **Definition of Done** heading with a "
3028
+ "one-line **Scope** (story / sprint / release), then 5–10 **Done criteria** as "
3029
+ "verifiable bullets (code review, tests, docs, deploy, sign-off, etc.)β€”concrete and "
3030
+ "checkable; distinct from per-story **acceptance criteria** unless they asked for both."
3031
+ )
3032
+ return instr, "definition_of_done"
3033
+
3034
+
3035
  def _embedded_five_whys(m: str) -> tuple[str, str] | None:
3036
  """``five_whys`` β€” iterative Why chain for root-cause analysis (distinct from full postmortem)."""
3037
  if len(m) < 48:
 
3750
  ``topic_must``, ``glossary``, ``spelling_uk``, ``spelling_us``, ``risks_mitigations``,
3751
  ``timeline_chron``, ``timeline_reverse``, ``voice_second``, ``voice_third``, ``faq_qa``,
3752
  ``summary_last``, ``decision_matrix``, ``build_vs_buy``, ``one_pager``, ``action_plan``, ``raci``, ``stakeholder_map``, ``swot``, ``pestle``, ``cost_benefit``, ``open_questions``, ``scenario_cases``,
3753
+ ``postmortem``, ``sprint_retro``, ``user_story``, ``definition_of_done``, ``five_whys``, ``fishbone``,
3754
  ``recommendation_first``,
3755
  ``go_no_go``,
3756
  ``frame_star``, ``frame_prep``, ``frame_irac``). Session-style overrides
 
3947
  extras.append(ust[0])
3948
  trace_tags.append(ust[1])
3949
 
3950
+ dod = _embedded_definition_of_done(m)
3951
+ if dod:
3952
+ extras.append(dod[0])
3953
+ trace_tags.append(dod[1])
3954
+
3955
  fw = _embedded_five_whys(m)
3956
  if fw:
3957
  extras.append(fw[0])
scripts/universal_brain_chat.py CHANGED
@@ -112,7 +112,7 @@ from rag_faq_smoke import _pick_model, hybrid_retrieve, load_chunks # noqa: E40
112
  from tinymodel_runtime import TinyModelRuntime # noqa: E402
113
 
114
  HELP_TEXT = """**How to use**
115
- - **Normal language:** ask in plain English (or mixed); the app **infers** what you want (summarize, search FAQ, save a note, etc.). Longer prompts may also **imply** reply shape for that turn only (for example trade-off questions β†’ Pros/Cons layout or flowing prose comparison, β€œin a table” β†’ markdown table preference, **no tables / tabular format in prose** β†’ table style prefer or avoid, β€œanswer in Spanish” β†’ reply language, **code only** β†’ code-first output, **explain the code / not code only in prose** β†’ code with explanation, **pseudocode vs runnable code in prose** β†’ algorithm layout, **cite your sources / no source links in prose** β†’ citation style, **rank options in priority order in prose** β†’ ranked_options, **decision matrix / criteria-as-rows in prose** β†’ decision_matrix, **build vs buy / make vs buy in prose** β†’ build_vs_buy, **one-pager / single-page executive brief in prose** β†’ one_pager, **action plan with owners and due dates in prose** β†’ action_plan, **RACI matrix / role assignment in prose** β†’ raci, **stakeholder map / influence-interest in prose** β†’ stakeholder_map, **exactly N options/alternatives in prose** β†’ options_n=N, **Mermaid/flowchart vs no diagrams in prose** β†’ diagram layout, **risks/downside vs benefits-first section order in prose** β†’ risks_first / benefits_first, **risks and mitigations / risk register in prose** β†’ risks_mitigations, **rewrite/polish my draft in prose** β†’ revise_draft, **write/draft an email in prose** β†’ email_format, **meeting agenda / timeboxed run-of-show in prose** β†’ meeting_agenda, **before/after or track-changes on my draft in prose** β†’ revise_diff, **don’t mention X / avoid discussing Y in prose** β†’ topic_guard, **must cover / include a section on Z in prose** β†’ topic_must, **STAR / PREP / IRAC format in prose** β†’ frame_star / frame_prep / frame_irac, **SWOT analysis in prose** β†’ swot, **PESTLE macro-environment analysis in prose** β†’ pestle, **cost-benefit / CBA in prose** β†’ cost_benefit, **open questions / TBD section in prose** β†’ open_questions, **best/base/worst case scenario analysis in prose** β†’ scenario_cases, **blameless postmortem format in prose** β†’ postmortem, **sprint retrospective / retro format in prose** β†’ sprint_retro, **user story / As a I want So that in prose** β†’ user_story, **five whys / 5 whys root cause in prose** β†’ five_whys, **fishbone / Ishikawa cause-and-effect in prose** β†’ fishbone, **checklist / tick-box format in prose** β†’ checklist layout, **in under N words** β†’ length cap, **be brief / more detail in prose** β†’ verbosity brief or detailed, **hints only / don’t give the full solution** β†’ guided discovery, **give me the full solution in prose** β†’ full_solution (not hints), **red team / sanity check my plan** β†’ challenge-style pushback, **be supportive / assume good intent on my plan** β†’ supportive coaching, **don’t remember this / off the record** β†’ ephemeral hint, **screen reader friendly / WCAG** β†’ accessibility layout hint, **ELI5 / lay audience in a long question** β†’ beginner audience, **assume I'm technical / expert depth in prose** β†’ technical audience, **board-ready / Slack-casual wording** β†’ formal or casual register, **valid JSON / return JSON in prose** β†’ JSON output mode, **plain text only / no JSON in prose** β†’ plain output format, **don’t guess / stick to facts in prose** β†’ strict speculation, **brainstorm freely / wild ideas in prose** β†’ creative speculation, **TLDR first / BLUF in prose** β†’ summary-first open, **lead with your recommendation in prose** β†’ recommendation_first, **go/no-go gate verdict in prose** β†’ go_no_go, **summary at the end / closing recap in prose** β†’ summary_last, **answer directly / skip the summary in prose** β†’ direct opening, **FAQ direct quotes vs paraphrase-only in prose** β†’ quote style for excerpts, **emoji ok vs no emoji in prose** β†’ emoji style, **FAQ-only vs FAQ-plus-general-knowledge in prose** β†’ FAQ grounding, **show work vs final-answer-only in prose** β†’ math detailing, **state assumptions / limitations / caveats** in prose β†’ transparent confidence tone, **be decisive / don’t hedge in prose** β†’ assertive confidence tone, **curl/bash/kubectl in prose** β†’ runnable commands, **conceptual only / no commands in prose** β†’ conceptual actionability, **bullet points vs plain paragraphs in prose** β†’ reply format, **step-by-step vs continuous procedure prose in long prompts** β†’ step style, **concrete / worked / toy example in prose** β†’ richer examples, **example-free / skip examples in prose** β†’ sparser examples, **define terms first / intuition or big-picture first in prose** β†’ explanation order, **no questions at the end / suggest next steps in prose** β†’ closing style, **ask questions before answering / answer without clarifiers in prose** β†’ clarify-first mode, **markdown section headings vs flat prose in long prompts** β†’ section layout, **analogy vs literal-only in long prompts** β†’ analogy style, **bold key terms vs minimal bold in long prompts** β†’ term emphasis, **spell out acronyms vs terse acronyms in long prompts** β†’ acronym style, **err on the side of safety vs ship-fast pragmatism in long prompts** β†’ risk posture, **fenced code blocks vs inline-only snippets in long prompts** β†’ code block style) β€” see *Brain trace* **`prompt_signals:`** when detected.
116
  - **Session controls (say it in chat, no slash command):**
117
  - *What is my current scope?*, *Show my session settings* -> prints scope + toggles (FAQ context, routing, trace)
118
  - *Start a new private session*, *Begin a fresh scope* -> generates a **new memory scope key** so notes are isolated from the shared default demo scope
@@ -276,6 +276,7 @@ These behaviors apply when your line is handled as **normal chat** (not a short
276
  | Blameless postmortem | In a **long** incident or outage write-up, ask for **postmortem format**, a **blameless postmortem**, or a **postmortem outline** with summary, impact, timeline, root cause, lessons learned, and action items (avoid mixing with **no postmortem format** / **skip postmortem** in the same line). | **`postmortem`** in **`prompt_signals:`**; reply should use standard postmortem section headings |
277
  | Sprint retrospective (retro) | In a **long** agile team reflection, ask for a **sprint retro**, **sprint retrospective format**, **retro format**, or **facilitate a retrospective** for an iteration (avoid mixing with **no sprint retro** / **skip retrospective format**; use **Postmortem** for incident/outage write-ups). | **`sprint_retro`** in **`prompt_signals:`**; reply should use **What went well**, **What didn't go well**, **Ideas / experiments**, **Action items** |
278
  | User story (As a / I want / So that) | In a **long** backlog or product prompt, ask for **user stories**, **user story format**, **As a … I want … so that**, or **acceptance criteria for each story** (avoid mixing with **no user stories** / **skip user story format**; use **STAR format** for interview answers). | **`user_story`** in **`prompt_signals:`**; reply should use **Title**, **As a / I want / So that**, and **Acceptance criteria** per story |
 
279
  | 5 Whys root-cause analysis | In a **long** incident or defect question, ask for a **five whys**, **5 whys analysis**, **root cause using 5 whys**, or **ask why five times** (avoid mixing with **no five whys** / **skip the why chain** in the same line). | **`five_whys`** in **`prompt_signals:`**; reply should use **Problem statement**, **Why 1–5**, and **Root cause** |
280
  | Fishbone / Ishikawa diagram | In a **long** quality or incident question, ask for a **fishbone diagram**, **Ishikawa analysis**, **cause-and-effect diagram**, or **fishbone format** with categorized causes (avoid mixing with **no fishbone** / **skip fishbone** in the same line). | **`fishbone`** in **`prompt_signals:`**; reply should use **Problem / Effect** plus category headings (People, Process, Technology, etc.) with sub-causes |
281
  | Second vs third person voice | In a **long** how-to or doc draft, ask to **address the reader as you**, **use second person**, or **speak directly to me**. **Or** ask for **third person**, **impersonal tone**, or **avoid second person** / **don't use you throughout** (avoid mixing both in one line). | **`voice_second`** or **`voice_third`** in **`prompt_signals:`**; reply should use you/your or neutral third-person phrasing accordingly |
 
112
  from tinymodel_runtime import TinyModelRuntime # noqa: E402
113
 
114
  HELP_TEXT = """**How to use**
115
+ - **Normal language:** ask in plain English (or mixed); the app **infers** what you want (summarize, search FAQ, save a note, etc.). Longer prompts may also **imply** reply shape for that turn only (for example trade-off questions β†’ Pros/Cons layout or flowing prose comparison, β€œin a table” β†’ markdown table preference, **no tables / tabular format in prose** β†’ table style prefer or avoid, β€œanswer in Spanish” β†’ reply language, **code only** β†’ code-first output, **explain the code / not code only in prose** β†’ code with explanation, **pseudocode vs runnable code in prose** β†’ algorithm layout, **cite your sources / no source links in prose** β†’ citation style, **rank options in priority order in prose** β†’ ranked_options, **decision matrix / criteria-as-rows in prose** β†’ decision_matrix, **build vs buy / make vs buy in prose** β†’ build_vs_buy, **one-pager / single-page executive brief in prose** β†’ one_pager, **action plan with owners and due dates in prose** β†’ action_plan, **RACI matrix / role assignment in prose** β†’ raci, **stakeholder map / influence-interest in prose** β†’ stakeholder_map, **exactly N options/alternatives in prose** β†’ options_n=N, **Mermaid/flowchart vs no diagrams in prose** β†’ diagram layout, **risks/downside vs benefits-first section order in prose** β†’ risks_first / benefits_first, **risks and mitigations / risk register in prose** β†’ risks_mitigations, **rewrite/polish my draft in prose** β†’ revise_draft, **write/draft an email in prose** β†’ email_format, **meeting agenda / timeboxed run-of-show in prose** β†’ meeting_agenda, **before/after or track-changes on my draft in prose** β†’ revise_diff, **don’t mention X / avoid discussing Y in prose** β†’ topic_guard, **must cover / include a section on Z in prose** β†’ topic_must, **STAR / PREP / IRAC format in prose** β†’ frame_star / frame_prep / frame_irac, **SWOT analysis in prose** β†’ swot, **PESTLE macro-environment analysis in prose** β†’ pestle, **cost-benefit / CBA in prose** β†’ cost_benefit, **open questions / TBD section in prose** β†’ open_questions, **best/base/worst case scenario analysis in prose** β†’ scenario_cases, **blameless postmortem format in prose** β†’ postmortem, **sprint retrospective / retro format in prose** β†’ sprint_retro, **user story / As a I want So that in prose** β†’ user_story, **definition of done / DoD criteria in prose** β†’ definition_of_done, **five whys / 5 whys root cause in prose** β†’ five_whys, **fishbone / Ishikawa cause-and-effect in prose** β†’ fishbone, **checklist / tick-box format in prose** β†’ checklist layout, **in under N words** β†’ length cap, **be brief / more detail in prose** β†’ verbosity brief or detailed, **hints only / don’t give the full solution** β†’ guided discovery, **give me the full solution in prose** β†’ full_solution (not hints), **red team / sanity check my plan** β†’ challenge-style pushback, **be supportive / assume good intent on my plan** β†’ supportive coaching, **don’t remember this / off the record** β†’ ephemeral hint, **screen reader friendly / WCAG** β†’ accessibility layout hint, **ELI5 / lay audience in a long question** β†’ beginner audience, **assume I'm technical / expert depth in prose** β†’ technical audience, **board-ready / Slack-casual wording** β†’ formal or casual register, **valid JSON / return JSON in prose** β†’ JSON output mode, **plain text only / no JSON in prose** β†’ plain output format, **don’t guess / stick to facts in prose** β†’ strict speculation, **brainstorm freely / wild ideas in prose** β†’ creative speculation, **TLDR first / BLUF in prose** β†’ summary-first open, **lead with your recommendation in prose** β†’ recommendation_first, **go/no-go gate verdict in prose** β†’ go_no_go, **summary at the end / closing recap in prose** β†’ summary_last, **answer directly / skip the summary in prose** β†’ direct opening, **FAQ direct quotes vs paraphrase-only in prose** β†’ quote style for excerpts, **emoji ok vs no emoji in prose** β†’ emoji style, **FAQ-only vs FAQ-plus-general-knowledge in prose** β†’ FAQ grounding, **show work vs final-answer-only in prose** β†’ math detailing, **state assumptions / limitations / caveats** in prose β†’ transparent confidence tone, **be decisive / don’t hedge in prose** β†’ assertive confidence tone, **curl/bash/kubectl in prose** β†’ runnable commands, **conceptual only / no commands in prose** β†’ conceptual actionability, **bullet points vs plain paragraphs in prose** β†’ reply format, **step-by-step vs continuous procedure prose in long prompts** β†’ step style, **concrete / worked / toy example in prose** β†’ richer examples, **example-free / skip examples in prose** β†’ sparser examples, **define terms first / intuition or big-picture first in prose** β†’ explanation order, **no questions at the end / suggest next steps in prose** β†’ closing style, **ask questions before answering / answer without clarifiers in prose** β†’ clarify-first mode, **markdown section headings vs flat prose in long prompts** β†’ section layout, **analogy vs literal-only in long prompts** β†’ analogy style, **bold key terms vs minimal bold in long prompts** β†’ term emphasis, **spell out acronyms vs terse acronyms in long prompts** β†’ acronym style, **err on the side of safety vs ship-fast pragmatism in long prompts** β†’ risk posture, **fenced code blocks vs inline-only snippets in long prompts** β†’ code block style) β€” see *Brain trace* **`prompt_signals:`** when detected.
116
  - **Session controls (say it in chat, no slash command):**
117
  - *What is my current scope?*, *Show my session settings* -> prints scope + toggles (FAQ context, routing, trace)
118
  - *Start a new private session*, *Begin a fresh scope* -> generates a **new memory scope key** so notes are isolated from the shared default demo scope
 
276
  | Blameless postmortem | In a **long** incident or outage write-up, ask for **postmortem format**, a **blameless postmortem**, or a **postmortem outline** with summary, impact, timeline, root cause, lessons learned, and action items (avoid mixing with **no postmortem format** / **skip postmortem** in the same line). | **`postmortem`** in **`prompt_signals:`**; reply should use standard postmortem section headings |
277
  | Sprint retrospective (retro) | In a **long** agile team reflection, ask for a **sprint retro**, **sprint retrospective format**, **retro format**, or **facilitate a retrospective** for an iteration (avoid mixing with **no sprint retro** / **skip retrospective format**; use **Postmortem** for incident/outage write-ups). | **`sprint_retro`** in **`prompt_signals:`**; reply should use **What went well**, **What didn't go well**, **Ideas / experiments**, **Action items** |
278
  | User story (As a / I want / So that) | In a **long** backlog or product prompt, ask for **user stories**, **user story format**, **As a … I want … so that**, or **acceptance criteria for each story** (avoid mixing with **no user stories** / **skip user story format**; use **STAR format** for interview answers). | **`user_story`** in **`prompt_signals:`**; reply should use **Title**, **As a / I want / So that**, and **Acceptance criteria** per story |
279
+ | Definition of Done (DoD) | In a **long** agile delivery prompt, ask for a **definition of done**, **DoD format**, **done criteria**, or **what counts as done** before merge/release (avoid mixing with **no definition of done** / **skip DoD format**; use **Checklist** row for generic `- [ ]` task lists). | **`definition_of_done`** in **`prompt_signals:`**; reply should use **Definition of Done**, **Scope**, and verifiable **Done criteria** bullets |
280
  | 5 Whys root-cause analysis | In a **long** incident or defect question, ask for a **five whys**, **5 whys analysis**, **root cause using 5 whys**, or **ask why five times** (avoid mixing with **no five whys** / **skip the why chain** in the same line). | **`five_whys`** in **`prompt_signals:`**; reply should use **Problem statement**, **Why 1–5**, and **Root cause** |
281
  | Fishbone / Ishikawa diagram | In a **long** quality or incident question, ask for a **fishbone diagram**, **Ishikawa analysis**, **cause-and-effect diagram**, or **fishbone format** with categorized causes (avoid mixing with **no fishbone** / **skip fishbone** in the same line). | **`fishbone`** in **`prompt_signals:`**; reply should use **Problem / Effect** plus category headings (People, Process, Technology, etc.) with sub-causes |
282
  | Second vs third person voice | In a **long** how-to or doc draft, ask to **address the reader as you**, **use second person**, or **speak directly to me**. **Or** ask for **third person**, **impersonal tone**, or **avoid second person** / **don't use you throughout** (avoid mixing both in one line). | **`voice_second`** or **`voice_third`** in **`prompt_signals:`**; reply should use you/your or neutral third-person phrasing accordingly |