Stash Override Rules
Goal
Produce the smallest Stash artifact that solves the user's networking goal:
- A minimal
.stoverride patch for declarative config changes.
- A Stash-installable script package for runtime logic, following the Script Hub pattern from
http://script.hub / https://script.hub: raw .js hosted remotely plus a wrapper .stoverride that wires the script through script-providers.
Workflow
- Identify the exact intent and success signal.
- Infer the expected behavior from context when clear.
- Ask a clarifying question only when success criteria are ambiguous.
- Define an observable check such as DNS resolution,
curl, Stash import success, or app behavior.
- Choose artifact mode before writing anything.
- Use
.stoverride only for declarative changes such as dns, fake-IP filters, rules, rule-providers, hosts, routing, or other config patch keys.
- Use a script package when the user asks for a script, automation, request/response rewriting logic, scheduled execution, a panel/tile-style script integration, or anything "installable by Stash".
- If the request mentions Script Hub or asks for an installable Stash script, default to
.js plus wrapper .stoverride, not bare JS.
- Build only the required keys and code.
- Keep override patches short and explicit.
- Avoid copying a whole base profile into override content.
- For script mode, keep the JavaScript self-contained and compatible with Stash runtime globals.
- Stash does not require
#!name= style headers inside the .js file. Metadata lives in the wrapper override.
- Package scripts the way Stash actually installs them.
- Do not present bare
.js as the final install artifact.
- Return a hostable raw
.js URL and a companion .stoverride wrapper.
- Use
script-providers for remote JS distribution.
- Use
payload or path only for local/debug flows when remote hosting is unavailable.
- Bind the provider under the correct Stash section such as
http.script, cron.script, or another documented script consumer.
- Follow the Script Hub module shape: top-level metadata, only the required Stash section, then
script-providers.
- When uncertain, mirror the layout used by Script Hub's own Stash module at
https://raw.githubusercontent.com/Script-Hub-Org/Script-Hub/main/modules/script-hub.stash.stoverride.
- Ensure override metadata and install path are present.
- Always include
name and desc in generated override YAML.
- Use a descriptive, task-specific name.
- For shared or published installable wrappers, add
author, icon, and category when those values are known and useful.
- When the artifact is meant for one-click install, return one of these forms:
stash://install-override?url=<url-encoded-wrapper-url>
https://link.stash.ws/install-override/<domain>/<path-to-override>
- Verify the runtime effect.
- Confirm the raw
.js URL returns JavaScript.
- Confirm the wrapper URL returns valid YAML.
- Validate the install link format when one is included.
- Run probes that match the user's request, not generic checks.
Cross-Agent Compatibility
Use this contract so the skill works across different coding agents and toolchains:
- Use agent-neutral artifacts.
- Emit YAML, JavaScript, install URLs, and shell commands only.
- Avoid agent-specific APIs, memory features, or proprietary tool calls.
- Support both execution modes.
- If terminal execution is available, run probes and report observed output.
- If execution is unavailable, provide exact commands and expected results for manual run.
- Return a consistent output package.
- For override-only requests: return a complete
.stoverride YAML block with name and desc.
- For script-package requests: return the
.js source, the wrapper .stoverride, the expected hosting paths or raw URLs, and an install link when relevant.
- Always include verification commands and pass/fail interpretation.
Templates
Base override skeleton
name: |-
<Override Name>
desc: |-
<What this override changes>
Installable HTTP script wrapper
name: |-
<Override Name>
desc: |-
Install <Script Name> into Stash via script-providers
author: <Optional Author>
icon: <Optional Icon URL>
category: <Optional Category>
http:
# Add force-http-engine or mitm when the target flow requires interception.
script:
- match: <url-regex>
name: <Script Name>
type: request # or response
require-body: false
timeout: 20
script-providers:
<Script Name>:
url: https://example.com/<script-name>.js
interval: 86400
Installable cron script wrapper
name: |-
<Override Name>
desc: |-
Install <Script Name> as a Stash cron script
author: <Optional Author>
icon: <Optional Icon URL>
category: <Optional Category>
cron:
script:
- name: <Script Name>
cron: "0 * * * *"
timeout: 20
script-providers:
<Script Name>:
url: https://example.com/<script-name>.js
interval: 86400
Minimal Stash script skeleton
const url = typeof $request !== "undefined" ? $request.url : "";
// Add only the logic needed for the user's rule or rewrite.
$done({});
Docker fake-IP bypass override
name: |-
Docker FakeIP Bypass
desc: |-
Bypass fake-ip for Docker registry domains
dns:
fake-ip-filter:
- +.docker.io
- registry-1.docker.io
- auth.docker.io
- index.docker.io
- production.cloudflare.docker.com
Validation Commands
Use these for installable script packages:
curl -L <raw-js-url> | sed -n '1,80p'
curl -L <wrapper-override-url> | sed -n '1,120p'
Use these after enabling an override that touches Docker access:
dig +short registry-1.docker.io
dig +short auth.docker.io
docker pull --quiet hello-world
Expected:
- DNS does not return fake-IP addresses in
198.18.0.0/15.
- Raw script response is JavaScript, not HTML.
- Wrapper response includes the expected
name, desc, and script-providers wiring.
- Docker pull succeeds when the request is Docker-related.
Troubleshooting
Script imports but does not run:
- Confirm the wrapper binds the script under the correct Stash section.
- Confirm the match pattern or cron expression actually triggers.
- Confirm the script ends with
$done(...).
Bare .js was shared as the install artifact:
- Wrap it in a
.stoverride using script-providers.
- Stash installs the override, then fetches the remote JS from the provider URL.
Override appears installed but has no effect:
- Confirm Overrides toggle is ON globally.
- Confirm the specific override toggle is ON.
- Confirm a base config is selected in Configs.
- Reload or restart Stash core and retest.
HTTP script does not trigger:
- Confirm
http.force-http-engine or http.mitm are present when the flow requires them.
- Confirm the request actually matches the configured regex.
Remote update does not appear in Stash:
- Treat it as a script-provider cache issue first.
- Check the provider
interval.
- If needed for debugging, seed with
payload and keep the final artifact remote.
User selected .stoverride as the active config:
- Switch the active config back to the base profile.
- Keep
.stoverride only in Overrides.
1---2name: stash-override-rules3description: Create, adjust, and validate Stash VPN overrides (`.stoverride`) and installable script packages (`.js` + wrapper override) for DNS, fake-IP filtering, rules, routing behavior, HTTP rewrite scripts, cron scripts, and one-click import links. Use when asked to build or troubleshoot Stash overrides, package a script so Stash can install it, use Script Hub patterns, install by URL, merge override patches into an active profile, or verify that override changes are taking effect at runtime.4---56# Stash Override Rules78## Goal910Produce the smallest Stash artifact that solves the user's networking goal:1112- A minimal `.stoverride` patch for declarative config changes.13- A Stash-installable script package for runtime logic, following the Script Hub pattern from `http://script.hub` / `https://script.hub`: raw `.js` hosted remotely plus a wrapper `.stoverride` that wires the script through `script-providers`.1415## Workflow16171. Identify the exact intent and success signal.18- Infer the expected behavior from context when clear.19- Ask a clarifying question only when success criteria are ambiguous.20- Define an observable check such as DNS resolution, `curl`, Stash import success, or app behavior.21222. Choose artifact mode before writing anything.23- Use `.stoverride` only for declarative changes such as `dns`, fake-IP filters, `rules`, `rule-providers`, `hosts`, routing, or other config patch keys.24- Use a script package when the user asks for a script, automation, request/response rewriting logic, scheduled execution, a panel/tile-style script integration, or anything "installable by Stash".25- If the request mentions Script Hub or asks for an installable Stash script, default to `.js` plus wrapper `.stoverride`, not bare JS.26273. Build only the required keys and code.28- Keep override patches short and explicit.29- Avoid copying a whole base profile into override content.30- For script mode, keep the JavaScript self-contained and compatible with Stash runtime globals.31- Stash does not require `#!name=` style headers inside the `.js` file. Metadata lives in the wrapper override.32334. Package scripts the way Stash actually installs them.34- Do not present bare `.js` as the final install artifact.35- Return a hostable raw `.js` URL and a companion `.stoverride` wrapper.36- Use `script-providers` for remote JS distribution.37- Use `payload` or `path` only for local/debug flows when remote hosting is unavailable.38- Bind the provider under the correct Stash section such as `http.script`, `cron.script`, or another documented script consumer.39- Follow the Script Hub module shape: top-level metadata, only the required Stash section, then `script-providers`.40- When uncertain, mirror the layout used by Script Hub's own Stash module at `https://raw.githubusercontent.com/Script-Hub-Org/Script-Hub/main/modules/script-hub.stash.stoverride`.41425. Ensure override metadata and install path are present.43- Always include `name` and `desc` in generated override YAML.44- Use a descriptive, task-specific name.45- For shared or published installable wrappers, add `author`, `icon`, and `category` when those values are known and useful.46- When the artifact is meant for one-click install, return one of these forms:47- `stash://install-override?url=<url-encoded-wrapper-url>`48- `https://link.stash.ws/install-override/<domain>/<path-to-override>`49506. Verify the runtime effect.51- Confirm the raw `.js` URL returns JavaScript.52- Confirm the wrapper URL returns valid YAML.53- Validate the install link format when one is included.54- Run probes that match the user's request, not generic checks.5556## Cross-Agent Compatibility5758Use this contract so the skill works across different coding agents and toolchains:59601. Use agent-neutral artifacts.61- Emit YAML, JavaScript, install URLs, and shell commands only.62- Avoid agent-specific APIs, memory features, or proprietary tool calls.63642. Support both execution modes.65- If terminal execution is available, run probes and report observed output.66- If execution is unavailable, provide exact commands and expected results for manual run.67683. Return a consistent output package.69- For override-only requests: return a complete `.stoverride` YAML block with `name` and `desc`.70- For script-package requests: return the `.js` source, the wrapper `.stoverride`, the expected hosting paths or raw URLs, and an install link when relevant.71- Always include verification commands and pass/fail interpretation.7273## Templates7475### Base override skeleton7677```yaml78name: |-79 <Override Name>80desc: |-81 <What this override changes>82```8384### Installable HTTP script wrapper8586```yaml87name: |-88 <Override Name>89desc: |-90 Install <Script Name> into Stash via script-providers91author: <Optional Author>92icon: <Optional Icon URL>93category: <Optional Category>94http:95 # Add force-http-engine or mitm when the target flow requires interception.96 script:97 - match: <url-regex>98 name: <Script Name>99 type: request # or response100 require-body: false101 timeout: 20102script-providers:103 <Script Name>:104 url: https://example.com/<script-name>.js105 interval: 86400106```107108### Installable cron script wrapper109110```yaml111name: |-112 <Override Name>113desc: |-114 Install <Script Name> as a Stash cron script115author: <Optional Author>116icon: <Optional Icon URL>117category: <Optional Category>118cron:119 script:120 - name: <Script Name>121 cron: "0 * * * *"122 timeout: 20123script-providers:124 <Script Name>:125 url: https://example.com/<script-name>.js126 interval: 86400127```128129### Minimal Stash script skeleton130131```javascript132const url = typeof $request !== "undefined" ? $request.url : "";133134// Add only the logic needed for the user's rule or rewrite.135136$done({});137```138139### Docker fake-IP bypass override140141```yaml142name: |-143 Docker FakeIP Bypass144desc: |-145 Bypass fake-ip for Docker registry domains146dns:147 fake-ip-filter:148 - +.docker.io149 - registry-1.docker.io150 - auth.docker.io151 - index.docker.io152 - production.cloudflare.docker.com153```154155## Validation Commands156157Use these for installable script packages:158159```bash160curl -L <raw-js-url> | sed -n '1,80p'161curl -L <wrapper-override-url> | sed -n '1,120p'162```163164Use these after enabling an override that touches Docker access:165166```bash167dig +short registry-1.docker.io168dig +short auth.docker.io169docker pull --quiet hello-world170```171172Expected:173- DNS does not return fake-IP addresses in `198.18.0.0/15`.174- Raw script response is JavaScript, not HTML.175- Wrapper response includes the expected `name`, `desc`, and `script-providers` wiring.176- Docker pull succeeds when the request is Docker-related.177178## Troubleshooting179180- Script imports but does not run:181 - Confirm the wrapper binds the script under the correct Stash section.182 - Confirm the match pattern or cron expression actually triggers.183 - Confirm the script ends with `$done(...)`.184185- Bare `.js` was shared as the install artifact:186 - Wrap it in a `.stoverride` using `script-providers`.187 - Stash installs the override, then fetches the remote JS from the provider URL.188189- Override appears installed but has no effect:190 - Confirm Overrides toggle is ON globally.191 - Confirm the specific override toggle is ON.192 - Confirm a base config is selected in Configs.193 - Reload or restart Stash core and retest.194195- HTTP script does not trigger:196 - Confirm `http.force-http-engine` or `http.mitm` are present when the flow requires them.197 - Confirm the request actually matches the configured regex.198199- Remote update does not appear in Stash:200 - Treat it as a script-provider cache issue first.201 - Check the provider `interval`.202 - If needed for debugging, seed with `payload` and keep the final artifact remote.203204- User selected `.stoverride` as the active config:205 - Switch the active config back to the base profile.206 - Keep `.stoverride` only in Overrides.