Use CodeBadger in this order so requests stay bounded and results remain actionable:
- Call
get_backend_statusbefore submitting builds. Respectrecommended_max_concurrent_buildsand page through CPG summaries only when needed. - Call
generate_cpgonce for the repository, or select an existingcodebase_hash. Pollget_cpg_statusuntilstatusisready; stop when it isfailedand use itserror_code/errorto recover. - Start with narrow browsing:
list_methods,list_calls,get_type_definition, orget_cfgusing a filename/name filter and a small limit. Checktruncatedand pagination fields before broadening. - Expand only after locating a relevant function or line. Use
get_program_slice/get_variable_flowfor local context, then taint or detector tools for a focused hypothesis. - For taint analysis, use
find_taint_sourcesandfind_taint_sinksfirst.find_taint_sinksis focused by default; usebroad=trueor explicit patterns when an exhaustive audit is intended. - Treat every result as bounded. Follow
total_pages,available,returned,has_more, ortruncatedinstead of assuming the first page is complete. - Rendered analysis tools default to compact output. Request
detail="full"only when the bounded summary is insufficient; otherwise keepdetail="compact"to reduce context usage. Native tool failures expose stable error-code prefixes such asVALIDATION_ERRORandQUERY_ERROR.
remove_cpg(delete_files=false) only releases the Joern worker and preserves
the CPG. delete_files=true removes the CPG, copied source, and catalog
record; use it only when permanent deletion is intended.