File tree Expand file tree Collapse file tree
examples/agentic-system-prompting Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
2+ """
3+ Convert a skillbook JSON file to an external agent injection text file.
4+
5+ Usage:
6+ python convert_skillbook_to_injection.py /path/to/skillbook.json
7+ python convert_skillbook_to_injection.py /path/to/skillbook.json -o output.txt
8+ """
9+
10+ import argparse
11+ from pathlib import Path
12+
13+ from ace import Skillbook
14+ from ace .prompts_v3 import wrap_skillbook_for_external_agent
15+
16+
17+ def main ():
18+ parser = argparse .ArgumentParser (
19+ description = "Convert a skillbook JSON to external agent injection format"
20+ )
21+ parser .add_argument ("skillbook" , type = Path , help = "Path to skillbook JSON file" )
22+ parser .add_argument (
23+ "-o" ,
24+ "--output" ,
25+ type = Path ,
26+ default = None ,
27+ help = "Output file path (default: <skillbook_name>_injection.txt)" ,
28+ )
29+ args = parser .parse_args ()
30+
31+ if not args .skillbook .exists ():
32+ print (f"Error: Skillbook not found: { args .skillbook } " )
33+ return 1
34+
35+ skillbook = Skillbook .load_from_file (str (args .skillbook ))
36+ print (f"Loaded skillbook with { len (skillbook .skills ())} skills" )
37+
38+ injection_text = wrap_skillbook_for_external_agent (skillbook )
39+
40+ if not injection_text :
41+ print ("No skills in skillbook - nothing to output" )
42+ return 1
43+
44+ output_path = args .output or args .skillbook .with_name (
45+ f"{ args .skillbook .stem } _injection.txt"
46+ )
47+ output_path .write_text (injection_text )
48+ print (f"Wrote injection to: { output_path } " )
49+
50+ return 0
51+
52+
53+ if __name__ == "__main__" :
54+ exit (main ())
You can’t perform that action at this time.
0 commit comments