Welcome! This guide explains how to use the **chat-driven lab management system** that lives inside this repository. It covers everyday workflows (for researchers) _and_ advanced features (for power users / maintainers).
---
## 1. What *is* the Lab Agent?
The Lab Agent is an AI assistant that turns plain-language instructions (typed in a chat window) into structured actions:
* Creating or updating YAML files in `Protocols/`, `Experiments/`, or `Projects/`
* Suggesting metadata ("Smart-Fill") using past lab records or PubMed
* Committing changes, opening GitHub Issues, or drafting Pull Requests so the PI can review
Think of it as a smart electronic lab notebook that lives entirely in this repo and **never** forgets to save or commit your work.
---
## 2. Quick-Start Checklist (⚡ _5 minutes_)
1.**Open this repo in GitHub Codespaces** (or locally with Dev Containers).
2.**Set secrets** (once per user):
• `OPENAI_API_KEY`– required for embeddings & Smart-Fill
• `GITHUB_TOKEN`– Codespaces usually injects one automatically
3. Wait for the container to build (it installs Python deps & starts the Agent runner automatically).
4.**Open the _Cursor_ / _Copilot Chat_ tab** inside VS Code.
5. Start talking! e.g. `"Create a new experiment using the cell staining protocol tomorrow at 10 AM"`.
> 💡 **Tips**
> • If chat replies look like JSON function calls, _that's expected_ – the Agent is planning deterministic actions.
> • All generated files & commits appear immediately in the Explorer + Git view.
---
## 3. Everyday Workflows
### 3.1 Create a Protocol
```text
User: Create a protocol called "RNA Extraction v2" based on the existing v1 but increase incubation to 15 min.
Agent → creates `Protocols/rna_extraction_v2.yaml`, commits it, and tells you the file path.
```
### 3.2 Start an Experiment
```text
User: I'm starting an experiment tomorrow using RNA Extraction v2 on sample 123.
Agent → scaffolds an experiment YAML in `Experiments/`, auto-fills metadata, commits, and links it to the protocol.
```
### 3.3 Log Results / Update Status
```text
User: Mark experiment EXP-0005 completed and add results "Yield was 250 ng/µL".
Agent → updates the YAML, validates required fields, commits, and updates TASKS.md.
```
### 3.4 Get Smart-Fill Suggestions
```text
User: Suggest metadata for cell line HeLa in my staining experiment.
Agent → returns top suggestions from previous experiments + PubMed if needed.
```
### 3.5 Open an Issue for PI Review
```text
User: Flag experiment EXP-0005 for PI review.
Agent → `gh issue create` with a pre-filled title/body and commits reference.
```
---
## 4. Available Commands / Phrases
The Agent understands natural language, but these verbs map 1-to-1 with internal functions.
| Action | Example Phrase | Notes |
| --- | --- | --- |
| **create_protocol** | "Make a protocol for western blotting" | Will duplicate `Templates/protocol_template.yaml` |
| **create_experiment** | "Plan an experiment using XYZ protocol next Monday" | Auto IDs the file with date & researcher |
| **update_experiment** | "Add results to EXP-0007" | Triggers validation if `status: completed` |
| **suggest_metadata** | "Suggest antibody concentration for HeLa staining" | Uses embeddings + PubMed |
| **commit_and_push** | Usually automatic | Manual call: "Commit with message ..." |
This will append the issue to both `TASKS.md` and `ISSUES_LOG.md` for easy tracking inside the repo. (You can automate this in your workflow or call it manually after each issue is created.)