ScriptSmith: LLM Bash Script Generation, Assessment and Refinement
ScriptSmith is a unified, reference-free and execution-free LLM framework for generating, assessing and refining Bash scripts for IT operations, built on CodeSift. The last stage of an incident-remediation pipeline (root-cause diagnosis, action recommendation, action automation) turns recommended actions into scripts an SRE can run, and Bash is the tool of choice. LLMs can draft those scripts, but validating Bash by execution is often impossible: a test environment may not exist, and values such as free memory depend on the live system, so unit-test-based generate-and-fix approaches do not transfer. ScriptSmith instead assesses and refines scripts with LLMs alone, cutting the manual writing and debugging effort of SRE teams.
For each recommended action step the framework first searches a knowledge catalog of SRE-verified scripts (descriptions embedded as vectors, approximate nearest-neighbour search); a high-confidence hit is shown directly. Otherwise a code LLM generates a script, CodeSift assesses it without execution, and if it fails the LLM is asked to explain why and the explanation is fed back as a prompt to regenerate the script; the SRE approves, edits or rejects the result and approved scripts join the catalog. On the CodeSift Bash dataset (100 tasks, scored by execution) and InterCode Bash (153 tasks, scored by domain experts), the framework improves script generation by 7–10% overall. A peer-review setup, where a smaller model (Llama3 8B) judges a larger model's (Llama3 70B) scripts, beats self-reflection (assessment accuracy 74% vs 69% and 61% vs 54%), the largest refinement gain is 17% when a 70B model refines what an 8B model generated and assessed, and open-source models with ScriptSmith match raw closed-source (Gemini 1.5) generation. In a user study with four domain experts on the 153 InterCode tasks, first-pass accuracy of 42% rose to 76% after feedback-driven refinement, and experts judged the model's failure explanations correct in 69% of the failing cases. ScriptSmith is being deployed in IBM Instana's intelligent remediation pipeline as a tech preview.
- 1Action step: each natural-language remediation step from the action-recommendation service is turned into a script
- 2Retrieve: catalog script descriptions are embedded as vectors; the step text is embedded and matched by approximate nearest-neighbour search
- 3Miss: no high-confidence match, so a code LLM generates a new Bash script (post-processed to extract the script from the raw output)
- 4Hit: a high-confidence match is shown directly to the SRE
- 5Assess: CodeSift validates the script without an execution bed; in the peer-review setting a smaller model (Llama3 8B) judges the larger model's script
- 6Fails: the LLM is prompted to explain briefly why the script does not perform the action, and the explanation is fed back as feedback to refine the script
- 7Refined: the regenerated script is proposed to the SRE
- 8Passes: a script that CodeSift labels correct goes to the SRE as is
- 9Approved: the SRE approves, edits or rejects; the final recommendation is published to the Postgres knowledge catalog, so future steps are answered by retrieval