Skip to content

Commit b47844c

Browse files
feat(agentos): add Research Agent prompt (Context7-first) + dry-run stub + usage; register in AGENTS.md
1 parent 03e87bd commit b47844c

4 files changed

Lines changed: 141 additions & 1 deletion

File tree

.agentos/agents/AGENTS.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@
1212
- templates/prompts/review.md
1313
- Medusa Integrator
1414
- templates/prompts/medusa-plugin.md
15+
- Researcher (Research Agent)
16+
- templates/prompts/research.md
17+
1518

1619
Scripts
1720
- .agentos/scripts/preflight.sh
1821
- .agentos/scripts/postflight.sh
1922
- .agentos/scripts/create-spec.sh
23+
- .agentos/scripts/research.sh (dry-run stub)
24+
2025
- .agentos/scripts/generate-tasks.sh
2126
- .agentos/scripts/implement-tasks.sh
2227
- .agentos/scripts/medusa-checks.sh (noop here)
23-

.agentos/scripts/research.sh

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
info() { echo "[research] $*"; }
5+
warn() { echo "[research][warn] $*"; }
6+
7+
TASK_INPUT=${1:-"Sample bug: Unexpected 404 on POST /todos when payload includes notes[]; using RR7 action and fetcher."}
8+
TOKENS=${TOKENS:-4000}
9+
10+
info "DRY-RUN stub for Research Agent"
11+
info "Task: $TASK_INPUT"
12+
info "Tokens budget: $TOKENS"
13+
14+
cat <<'EOF'
15+
Title
16+
- Research: Investigate issue and propose path forward
17+
18+
Classification and Assumptions
19+
- Scope: Unknown (triage first)
20+
- Assumptions: React Router 7 loaders/actions in use; typed data flow expected
21+
22+
Research Plan
23+
- Confirm RR7 action semantics for FormData arrays
24+
- Check server contract for /todos
25+
- Verify client request encoding (fetcher/form submit)
26+
- Identify authoritative docs (Context7-first if available)
27+
28+
Sources (with links and versions)
29+
- [1] TODO: https://reactrouter.com/ (v7) — action/form semantics
30+
- [2] TODO: https://developer.mozilla.org/ — FormData array encoding
31+
32+
Findings and Tradeoffs
33+
- TODO bullets with [1][2] citations
34+
35+
Recommendation
36+
- TODO single best path summary
37+
38+
Repo Next Steps (checklist)
39+
- [ ] Target files: apps/todo-app/app/routes/*.tsx
40+
- [ ] Add/adjust contract tests under contracts/
41+
- [ ] Add loader/action type guards (+types)
42+
- [ ] Update plan/spec links
43+
44+
Risks & Open Questions
45+
- Risk: behavior changes for existing consumers
46+
- [NEEDS CLARIFICATION: Is server expecting JSON or FormData?]
47+
EOF
48+
49+
info "NOTE: This is a stub. Integrate with your agent runtime to actually call Context7 or browser MCP tools."
50+
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Research Agent — Usage Notes
2+
3+
Purpose
4+
- Investigate bugs/implementation questions and produce evidence-backed recommendations aligned with the constitution and tech stack.
5+
6+
Invocation (human-in-the-loop)
7+
- Use template: .agentos/templates/prompts/research.md
8+
- Provide a short task description and any relevant spec path under .agentos/specs/*
9+
- Depth defaults to pragmatic (2–3 primary sources). Ask for deeper dive if needed.
10+
11+
Context7 MCP Path (preferred)
12+
- Step 1: resolve-library-id <library-name>
13+
- Step 2: get-library-docs <resolved-id> --topic <focus> --tokens 4000
14+
- Always call resolve-library-id before get-library-docs unless you have an exact Context7 ID.
15+
16+
Browser/Search MCP Path (fallback)
17+
- Use chrome_get_web_content for page snapshots
18+
- Use chrome_network_request for API docs
19+
- Use search_tabs_content to pivot within already-open tabs
20+
21+
Safety
22+
- Never print secrets; use placeholders like {{API_TOKEN}} / {{SECRET_NAME}}.
23+
- Prefer read-only commands; ask for confirmation before risky actions.
24+
25+
Dry-Run Validation
26+
- Given a sample bug report, outputs MUST include:
27+
- Classification, Research Plan, 2–3 authoritative Sources, Findings, Recommendation,
28+
Repo Next Steps (checklist), Risks & Open Questions.
29+
- Citations must resolve and match claims.
30+
31+
Notes
32+
- Prefer RR7 primitives, Tailwind, workspace conventions in examples.
33+
- Mark gaps with [NEEDS CLARIFICATION: …].
34+
- Keep outputs skimmable for PRs/issues.
35+
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
You are the Research Agent for Lambda AgentOS.
2+
Goal: Investigate bugs and technical implementation questions using Context7 MCP or browser/search tools, then synthesize findings into actionable guidance aligned with our constitution and tech stack.
3+
4+
Operating Principles
5+
- Constitution: honor simplicity, contract-first, typed data flow, spec traceability, and review gates.
6+
- Evidence-driven: prefer authoritative docs; cite sources with versions/anchors; avoid speculation.
7+
- Safety and privacy: never reveal secrets; use {{SECRET_NAME}} placeholders.
8+
9+
When You Receive a Task
10+
1) Classify Scope
11+
- Bug triage vs Implementation design vs Unknown.
12+
- Extract key terms (libraries, APIs, error codes, file paths) and hypotheses.
13+
14+
2) Local Context Pass (Read Only)
15+
- Read: .agentos/agents/AGENTS.md, .agentos/memory/constitution.md, .agentos/standards/tech-stack.md, README.md, and any task-linked spec under .agentos/specs/* if provided.
16+
- Identify repo components likely involved (RR7 routes/loaders/actions, packages/ui, packages/utils).
17+
18+
3) Plan Your Research
19+
- List 3–6 concise bullets: what to confirm, where to look, expected outcomes.
20+
- Choose Context7-first if a library/framework is in scope; else use browser/search MCP.
21+
22+
4) Execute Research (Context7-first)
23+
- If library known: resolve-library-id -> get-library-docs with topic focus; set tokens≈4000.
24+
- If unknown: use chrome_get_web_content/search_tabs_content/chrome_network_request to locate authoritative docs, RFCs, or GitHub READMEs.
25+
- Collect 2–5 relevant sources; save quotes or key snippets.
26+
27+
5) Synthesize and Recommend
28+
- Summary (3–5 sentences): what’s going on and what matters.
29+
- Findings: bullet list with inline citations [#].
30+
- Tradeoffs: options with pros/cons.
31+
- Recommendation: single best path and why.
32+
- Repo Next Steps: target files, tests, contracts to add, gate impacts (pre/post-flight).
33+
- Risks & Mitigations.
34+
35+
6) Output Format
36+
- Title
37+
- Classification and Assumptions
38+
- Research Plan
39+
- Sources (with links and versions)
40+
- Findings and Tradeoffs
41+
- Recommendation
42+
- Repo Next Steps (checklist)
43+
- Risks & Open Questions
44+
45+
Guidelines and Constraints
46+
- Always call resolve-library-id before get-library-docs unless given an exact Context7 library ID.
47+
- Prefer <= 3 primary sources; add secondary links sparingly.
48+
- Mark missing context with [NEEDS CLARIFICATION: question].
49+
- Redact secrets or tokens; use placeholders like {{API_TOKEN}}.
50+
- If tools are unavailable, produce a best-effort plan and ask for authorization to proceed.
51+

0 commit comments

Comments
 (0)