Use ask.sh, devai.sh, and plan_exec.sh
The scripts in /opt/devsecops-ai/scripts are the command-line entry points for an existing local AI installation. They turn the API and model router into everyday question-answering, development, and planning workflows.
Start in the right environment
Section titled “Start in the right environment”From Windows PowerShell, enter the Ubuntu distribution hosting the service:
wsl -d UbuntuThen use WSL Bash:
cd /opt/devsecops-ails scripts/ask.sh scripts/devai.sh scripts/plan_exec.shsystemctl status devsecops-ai ollamaollama listThis assumes an existing deployment at /opt/devsecops-ai. For a development checkout, use its own root instead and follow installation. Do not create an empty /opt directory as a substitute for installing the project.
The scripts need Bash, curl, Python 3, and standard Linux shell utilities. Memory operations also need the project’s compatible Python environment. The examples use bash scripts/... so they do not depend on aliases, executable bits, or your shell’s PATH.
Choose the script for the job
Section titled “Choose the script for the job”| Script | Best starting point | Router behavior |
|---|---|---|
ask.sh | Ask one question and continue a saved thread on the next invocation | Automatic unless MODEL_SELECTION requests a model |
devai.sh | Generate/review code, chat, and manage local knowledge memory | Automatic unless DEVAI_MODEL requests a model; supports a task hint |
plan_exec.sh | Produce a plan, then request implementation from the code specialist | Explicit planner and executor models, with different task hints |
All three call the FastAPI backend. They do not run a separate model server. With routing enabled, the backend analyzes the request and checks model availability. With routing disabled, it uses OLLAMA_MODEL and ignores these per-request model choices.
Argument order matters: put devai.sh and plan_exec.sh flags before the quoted task. The current parsers treat everything after the first task argument as prompt text, even when it looks like a flag.
ask.sh: ask a question
Section titled “ask.sh: ask a question”cd /opt/devsecops-aibash scripts/ask.shType the question at What would you like to know?. For example: Explain the purpose of a GitLab merge request. This script reads an interactive question; passing task text as a command-line argument is not its interface.
After the answer, look for Model: and Routing:. These report the backend’s selected model and reason. With conversation memory enabled, a saved conversation ID allows another invocation of ask.sh to continue that thread.
Request a model or supply a task hint
Section titled “Request a model or supply a task hint”MODEL_SELECTION=qwen3.5:2b bash scripts/ask.shMODEL_SELECTION=qwen2.5-coder:3b TASK_TYPE=coding bash scripts/ask.shTASK_TYPE=planning bash scripts/ask.shThe last example leaves model selection automatic and supplies only a planning hint. To return to automatic behavior, omit the model setting; if you previously exported it, unset it in that terminal.
ask.sh builds JSON through shell interpolation. Quoted or multiline input can break the request. Use a JSON file with the API for complex input instead of repeatedly escaping it.
devai.sh: develop with local AI
Section titled “devai.sh: develop with local AI”Inspect help and health
Section titled “Inspect help and health”bash scripts/devai.sh --helpbash scripts/devai.sh --healthHealth output is a starting check, not proof of successful inference. Use a small request to verify generation.
Generate a response without running generated code
Section titled “Generate a response without running generated code”bash scripts/devai.sh "Write a Python function that validates a nonempty project name."The default one-shot mode displays the response and can save extracted code under /tmp/devai. It also logs activity and ingests the result into local knowledge memory. “Do not execute generated code” does not mean “no files or memory are written.”
Use automatic routing or a requested specialist
Section titled “Use automatic routing or a requested specialist”DEVAI_TASK_TYPE=coding bash scripts/devai.sh "Write a Python function that adds two integers."DEVAI_MODEL=qwen2.5-coder:3b DEVAI_TASK_TYPE=coding bash scripts/devai.sh "Write the same function with type hints."DEVAI_MODEL=qwen3.5:2b bash scripts/devai.sh "Explain the tradeoffs in the proposed design."Read the [Model: ... | Routing: ...] diagnostic, printed to standard error. It can disappear from a capture that saves only standard output. Model availability can cause a fallback; inspect the actual selection rather than assuming the requested model ran.
Interactive conversation
Section titled “Interactive conversation”bash scripts/devai.sh --interactiveType a question, or use health, history, search <text>, and exit/quit. If a response contains code blocks, this mode saves them and asks whether to execute them. Answer N when you only want to inspect the code.
Local knowledge memory
Section titled “Local knowledge memory”bash scripts/devai.sh --ingest "The fictional Aurora service uses port 8123 in the training lab."bash scripts/devai.sh --search "Aurora service port"bash scripts/devai.sh --historybash scripts/devai.sh --clearIngest/search/history operate through the local Python memory helper and vector store. --clear (also --new) resets devai’s saved thread ID; it does not erase stored conversations, knowledge, backups, or the thread saved by ask.sh.
Execute only after inspecting the output
Section titled “Execute only after inspecting the output”In an isolated lab where execution is intended:
bash scripts/devai.sh --execute "Write a Python script that prints a greeting."--execute/--exec asks before running extracted code. Adding --yes removes that prompt for code that passes the script’s pattern checks. Those checks are not a sandbox or a safety guarantee. The runner uses Python for Python blocks and Bash otherwise; a saved YAML or Dockerfile is not automatically deployed with the appropriate tool.
plan_exec.sh: planner to code specialist
Section titled “plan_exec.sh: planner to code specialist”The default planner is qwen3.5:2b; the default executor is qwen2.5-coder:3b. The script supplies explicit models and planning/coding task hints to the same backend router. This is a two-phase workflow, not a separate training process.
Generate and inspect a plan
Section titled “Generate and inspect a plan”cd /opt/devsecops-aimkdir -p /tmp/devaibash scripts/plan_exec.sh --plan-only "Plan a small Python command-line greeting program."less /tmp/devai/current_plan.txtCreate the temporary directory before the first planning call: the current script redirects the plan there before its code-saving helper creates the directory. TMP_DIR can select another location.
Review the plan’s objective, constraints, tasks, acceptance criteria, and handoff. A later planning call overwrites current_plan.txt, so preserve a reviewed plan separately if you need it. See the handoff guide for field types and two-pass planning.
Continue with the reviewed plan
Section titled “Continue with the reviewed plan”Only when you intend to request implementation and review any offered execution:
bash scripts/plan_exec.sh --exec-only "Implement the reviewed Python greeting program."This reads the existing plan, asks the code specialist for implementation, saves extracted blocks, and prompts before running them. --exec-only is not a preview flag. It still needs task text. Starting without either phase flag runs planning followed by implementation; --auto can execute generated code without individual prompts and is not a recommended first-use mode.
Set the phase models
Section titled “Set the phase models”PLAN_MODEL=qwen3.5:2b EXEC_MODEL=qwen2.5-coder:3b \ bash scripts/plan_exec.sh --plan-only "Plan a small Python greeting program."The plan-only command uses the planner; EXEC_MODEL applies when the execution phase is requested. The interactive mode (--interactive) supports plan <task>, exec <task>, help, and exit. Avoid auto <task> until its execution behavior is understood.
Prerequisites and generated code checks
Section titled “Prerequisites and generated code checks”The planner schema includes prerequisites. The executor prompt asks for dependency installation commands in a separate Bash block beginning with # install, before the application code. Review both blocks: the current detector matches a line beginning with # install anywhere in a block, rather than strictly validating its first line.
Normal mode asks before running installation commands; --auto may run them without that prompt, subject to the script’s pattern filter. Install commands can change your environment. Blocks run in response order, and an installation failure does not reliably stop subsequent blocks because the caller suppresses execution failures.
Generated Python files undergo python3 -m py_compile before execution. A syntax failure prevents that file from running; syntax success does not establish correctness or safety. Shebang detection helps select Python versus Bash, and multiple blocks receive distinct filenames. The pattern filter is not a sandbox.
Long plans are shortened before the execution request; see command behavior. Confirm that the portion sent to the coder still contains the acceptance criteria and prerequisites.
For generated webcam or recording tools, verify that the device actually exists in the execution environment (for example, /dev/video* in WSL). Otherwise use an environment with device access; model-generated code cannot attach hardware to WSL.
Why the router matters
Section titled “Why the router matters”The advancement is from a fixed answering model to a shared request path with task analysis, metadata signals, explicit overrides, and availability-aware selection:
ask.sh / devai.sh / plan_exec.sh → query + optional model + task_type → FastAPI model router → selected Ollama model → answer + model + routing reasonThe backend also accepts prompt/playbook metadata paths, but these three helpers do not currently send prompt_id or playbook_id. Use the API when you need those signals. Neither a routing score nor a specialist label proves answer quality. Compare results using the routing lab.
Configuration, memory, and troubleshooting
Section titled “Configuration, memory, and troubleshooting”See CLI settings and paths for exact variable names. They differ between scripts; MODEL_SELECTION does not configure devai.sh.
- Authentication fails: check which environment file the helper reads and whether it matches the backend.
- No model or wrong model: check
ollama list, routing enablement, and the returned model/reason. Refresh the backend registry after downloading a model. - Plan fails with 422: the full schema plus task, or a two-pass prompt, can exceed the committed API limit. Start with a short request and inspect the deployed API schema.
- Plan fails on a missing path: create the configured
TMP_DIRand confirm it is writable. - Memory fails: use the project’s ChromaDB-compatible virtual environment; do not let a different system package rewrite the store.
- Helper parsing fails after a response: compare with a direct API request and inspect that helper’s error; a working backend does not prove the shell wrapper parsed its response.
The helpers currently omit user_id, and the backend can use the credential as that identifier when conversation memory is enabled. Semantic thread isolation is also incomplete. Disabling backend memory does not disable devai.sh’s separate local knowledge ingestion. Read memory behavior before using private data.
Next: CLI settings and paths, model selection, or build an API client.