Skip to content

Commit 9123371

Browse files
mios-devclaude
andcommitted
mios-map + tool-aware refine + OpenAI-standard simplification
Three stacked operator asks landed in one bundle: 1. "Open a map / directions to <PLACE>" path: * New mios-map shim. Bash, URL-encodes <PLACE>, builds the correct Google Maps URL (search or directions mode), opens via mios-open-url. Optional --directions [--from <origin>] for routed maps. Returns 0/1/64 with clear stderr. * Symlinked into /usr/local/{s,}bin via tmpfiles.d shim-links (also added mios-hermes-soul-sync that was missing -- shim count 37 -> 39). 2. "Prompt refining should be tool aware to be able to hint": * New /usr/share/mios/owui/tool-hints.yaml -- canonical-verb manifest with name + intent + example + tags for every mios-* shim (25 verbs) PLUS an intent_patterns block for composite asks ("near <PLACE>", "show me a picture of", "open a map / directions"). Operator-editable; adding a new shim is one YAML entry. * Pipe init now loads the YAML, renders a 3-column markdown table (Verb | Intent | Example), and substitutes into the {tool_table} placeholder in _REFINE_SYSTEM. Falls back to a noop string on YAML missing/parse error so refine never crashes from a manifest typo. 3. "Simplify to OpenAI API standards for Day-0 Agents understanding -- Do a pass on ALL system prompts" + "generisize this to be completely platform agnostic and plain generic english (or standard OpenAI patterns here)" + "ABSOLUTELY NO HARDCODED ENGLISH STANDARD Linux and Windows Terminologies" + "the prompt should use thinking to plan a course of action in the MiOS environments for it's refinements for global agents": * _REFINE_SYSTEM rewritten from ~200 hardcoded lines (intent table + 8 examples + MiOS-specific preamble) to ~95 lines of generic role + schema + rules + 4 high-signal examples. * Preamble is platform-agnostic: "You are a prompt refinement layer for a multi-agent system. Rewrite the user's raw request into a structured handoff the downstream orchestrator agent will execute." No "MiOS-Agent", no "Hermes", no "Operator: `mios`" -- the platform-specific verbs come from the injected {tool_table} alone. * New THINK FIRST section + THINKING line in the schema: model reasons step-by-step (intent restate -> verb scan -> step count -> delegate decision) before emitting the structured handoff. Capped at 80 tokens. Mirrors user language. * 200 lines of LEGACY_REFINE_DEAD_BODY pruned from the file entirely (was a leftover doc-anchor that wasn't loaded by anything). * Rendered prompt is now 8156 chars (down from ~22K). * Live verified: pipe init succeeds, render contains all 4 example patterns, all 25 canonical verbs, the THINK FIRST directive, the "near <PLACE>" intent rule. OWUI restart clean. Also: saved a project memory entry at ~/.claude/projects/C--/memory/project_mios.md so future Claude sessions don't re-derive MiOS context from CLAUDE.md every time (operator: "what is MiOS?! Remember!!"). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 4631a4f commit 9123371

4 files changed

Lines changed: 451 additions & 196 deletions

File tree

usr/lib/tmpfiles.d/mios-shim-links.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,7 @@ L+ /usr/local/bin/mios-lan-status - - - - /usr/libexec/mios/mios-lan-st
8585
L+ /usr/local/sbin/mios-lan-status - - - - /usr/libexec/mios/mios-lan-status
8686
L+ /usr/local/bin/mios-gui-launch - - - - /usr/libexec/mios/mios-gui-launch
8787
L+ /usr/local/sbin/mios-gui-launch - - - - /usr/libexec/mios/mios-gui-launch
88+
L+ /usr/local/bin/mios-map - - - - /usr/libexec/mios/mios-map
89+
L+ /usr/local/sbin/mios-map - - - - /usr/libexec/mios/mios-map
90+
L+ /usr/local/bin/mios-hermes-soul-sync - - - - /usr/libexec/mios/mios-hermes-soul-sync
91+
L+ /usr/local/sbin/mios-hermes-soul-sync - - - - /usr/libexec/mios/mios-hermes-soul-sync

usr/libexec/mios/mios-map

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
#!/bin/bash
2+
# /usr/libexec/mios/mios-map <query> [--directions [<from>]] [--browser <name>]
3+
#
4+
# Open Google Maps for a query / address / "directions to X" in the
5+
# operator's default browser. Operator-flagged 2026-05-17: agent
6+
# refused "Open a map with directions to Chotto Matte Toronto" with
7+
# "the browser can't launch in this environment" -- it had access to
8+
# mios-open-url all along. This shim collapses the whole flow to one
9+
# call so the agent stops reinventing the URL.
10+
#
11+
# Examples:
12+
# mios-map "Chotto Matte Toronto"
13+
# -> https://www.google.com/maps/search/Chotto+Matte+Toronto
14+
#
15+
# mios-map --directions "Toronto Congress Centre"
16+
# -> https://www.google.com/maps/dir/?api=1&destination=Toronto+Congress+Centre
17+
#
18+
# mios-map --directions "650 Dixon Road Toronto" --from "downtown Toronto"
19+
# -> https://www.google.com/maps/dir/?api=1&origin=downtown+Toronto&destination=650+Dixon+Road+Toronto
20+
#
21+
# Exit codes:
22+
# 0 = URL constructed + opened in browser
23+
# 1 = mios-open-url failed
24+
# 64 = bad usage
25+
26+
set -uo pipefail
27+
28+
usage() {
29+
cat <<'USAGE'
30+
usage: mios-map <query> [--directions [--from <origin>]] [--browser <name>]
31+
32+
<query> Place name, address, or business name. Quote
33+
multi-word.
34+
--directions Open in directions mode (default destination
35+
is <query>).
36+
--from <origin> Set the origin for --directions (otherwise
37+
Google picks "Your location").
38+
--browser <name> Override the default browser (passed to
39+
mios-open-url).
40+
41+
Returns 0 on dispatch. The browser opens to the constructed URL.
42+
USAGE
43+
}
44+
45+
if [ "$#" -lt 1 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
46+
usage
47+
[ "$#" -lt 1 ] && exit 64 || exit 0
48+
fi
49+
50+
QUERY="$1"
51+
shift
52+
DIRECTIONS=0
53+
FROM=""
54+
BROWSER=""
55+
56+
while [ "$#" -gt 0 ]; do
57+
case "$1" in
58+
--directions) DIRECTIONS=1; shift ;;
59+
--from) FROM="${2:-}"; shift 2 ;;
60+
--browser) BROWSER="${2:-}"; shift 2 ;;
61+
*) echo "mios-map: unknown arg: $1" >&2; exit 64 ;;
62+
esac
63+
done
64+
65+
# URL-encode helper: rfc 3986 percent-encode anything that's not
66+
# unreserved (A-Z a-z 0-9 - . _ ~). Single-pass; relies on `od` for
67+
# byte iteration so multi-byte UTF-8 is handled correctly.
68+
urlencode() {
69+
local s="$1" out=""
70+
local LANG=C LC_ALL=C
71+
local i ch
72+
for ((i = 0; i < ${#s}; i++)); do
73+
ch="${s:i:1}"
74+
case "$ch" in
75+
[A-Za-z0-9.~_-]) out+="$ch" ;;
76+
' ') out+="+" ;;
77+
*) printf -v out '%s%%%02X' "$out" "'$ch" ;;
78+
esac
79+
done
80+
printf '%s' "$out"
81+
}
82+
83+
Q_ENC=$(urlencode "$QUERY")
84+
if [ "$DIRECTIONS" = "1" ]; then
85+
URL="https://www.google.com/maps/dir/?api=1&destination=${Q_ENC}"
86+
if [ -n "$FROM" ]; then
87+
F_ENC=$(urlencode "$FROM")
88+
URL="https://www.google.com/maps/dir/?api=1&origin=${F_ENC}&destination=${Q_ENC}"
89+
fi
90+
else
91+
URL="https://www.google.com/maps/search/${Q_ENC}"
92+
fi
93+
94+
echo "[mios-map] query=$QUERY"
95+
echo "[mios-map] url=$URL"
96+
97+
OPEN_ARGS=("$URL")
98+
[ -n "$BROWSER" ] && OPEN_ARGS+=("$BROWSER")
99+
if ! mios-open-url "${OPEN_ARGS[@]}"; then
100+
echo "mios-map: mios-open-url failed for $URL" >&2
101+
exit 1
102+
fi
103+
exit 0

0 commit comments

Comments
 (0)