diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2026-01-22 11:58:39 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2026-01-23 09:36:05 +0000 |
| commit | 8fb0f8fb04f74e0c849fb8e2ae236419ceae6fcf (patch) | |
| tree | 252d5e60314e9a082289c2b135f196d8393c371b /pkg | |
| parent | 778c365cd9979cc5ab5eb7df8e7ec5d1ab834495 (diff) | |
pkg/aflow/tool/researcher: add researching LLM tool
It can answer complex questions about kernel,
and provide a concise answer to other LLMs.
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/aflow/flow/patching/patching.go | 3 | ||||
| -rw-r--r-- | pkg/aflow/tool/codeexpert/codeexpert.go | 44 |
2 files changed, 46 insertions, 1 deletions
diff --git a/pkg/aflow/flow/patching/patching.go b/pkg/aflow/flow/patching/patching.go index ab3394f4e..a0b8d4a6c 100644 --- a/pkg/aflow/flow/patching/patching.go +++ b/pkg/aflow/flow/patching/patching.go @@ -10,6 +10,7 @@ import ( "github.com/google/syzkaller/pkg/aflow/action/crash" "github.com/google/syzkaller/pkg/aflow/action/kernel" "github.com/google/syzkaller/pkg/aflow/ai" + "github.com/google/syzkaller/pkg/aflow/tool/codeexpert" "github.com/google/syzkaller/pkg/aflow/tool/codesearcher" ) @@ -38,7 +39,7 @@ type Outputs struct { } func init() { - tools := codesearcher.Tools + tools := append([]aflow.Tool{codeexpert.Tool}, codesearcher.Tools...) aflow.Register[Inputs, Outputs]( ai.WorkflowPatching, diff --git a/pkg/aflow/tool/codeexpert/codeexpert.go b/pkg/aflow/tool/codeexpert/codeexpert.go new file mode 100644 index 000000000..62d9c6f5d --- /dev/null +++ b/pkg/aflow/tool/codeexpert/codeexpert.go @@ -0,0 +1,44 @@ +// Copyright 2026 syzkaller project authors. All rights reserved. +// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. + +package codeexpert + +import ( + "github.com/google/syzkaller/pkg/aflow" + "github.com/google/syzkaller/pkg/aflow/tool/codesearcher" +) + +var Tool = &aflow.LLMTool{ + Name: "codeexpert", + Model: aflow.GoodBalancedModel, + Temperature: 1, + Description: description, + Instruction: instruction, + Tools: codesearcher.Tools, +} + +const description = ` +The tool can answer complex questions about kernel source code, +function behavior/pre-conditons/post-conditions, structs and their fields, +assess vality of code snippets, verify various hypothesis, etc. +It has access to more sources of information than you, use it to answer +particularly complex questions that require lots of research, and looking +at lots of data, and have a concrete concise answer. + +Formulate your question as concretly as possible, include concrete +function/struct/field/variable names, line numbers, etc. +Formulate what exactly you want to see in the answer and in what form. +` + +const instruction = ` +You are a capable Linux kernel developer tasked with researching complex questions +about kernel source code. You will be given a concrete question, and need to provide +a concrete answer. +Use tools extensively while researching the question. Don't make assumptions, +or rely on your previous knowledge about the kernel source code, use available tools +to access the actual source code. +Use all available sources of information: + - kernel source code + - documentation in the Documentation dir in the source tree + - git commits descriptions, git blame +` |
