Skip to content

Commit 2730b28

Browse files
doc: updated hai usage docs (#151)
1 parent 46aecfa commit 2730b28

21 files changed

+510
-61
lines changed

assets/img/hai-rules.png

67.5 KB
Loading

assets/img/hai-vscode-download.png

805 KB
Loading

docs/custom-model-configs/gcp-vertex-ai.mdx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,7 @@ Vertex AI supports eight regions. Select a region that meets your latency, compl
7676
- Search for **HAI** and install the extension
7777

7878
<Frame>
79-
<img
80-
src="https://storage.googleapis.com/cline_public_images/docs/assets/cline-extension-arrow.png"
81-
alt="HAI extension in VS Code"
82-
/>
79+
<img src="../../assets/img/hai-vscode-download.png" alt="HAI extension in VS Code" />
8380
</Frame>
8481

8582
#### 3.2 Configure HAI Settings
Lines changed: 247 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,247 @@
1+
---
2+
title: "Expert Instruction Meta-Guide"
3+
description: "A meta-guide to help contributors write high-quality, role-based expert instruction files for building LLM personas or system instructions."
4+
---
5+
6+
> **Purpose**
7+
> This document is a meta-guide to help contributors craft high-quality, role-based expert instruction files. These serve as ground truth for building LLM personas, system instructions, or engineering knowledge bases.
8+
>
9+
> If you're not sure what an expert is or why we need one, please take a moment to read this document: [Experts](../../experts.mdx)
10+
11+
> 📌 **Guiding Philosophy**
12+
> An expert guidelines document isn't just a cheat sheet—it's a codified persona of excellence. It should:
13+
>
14+
> - Establish authority in the domain.
15+
> - Provide principles and practice—not just instructions.
16+
> - Be structured, consistent, and extensible.
17+
> - Serve both humans and LLMs—making it chunkable, parseable, and RAG-ready.
18+
19+
---
20+
21+
### 🧩 1. Structure of an Expert File
22+
23+
Here's a canonical format:
24+
25+
```markdown
26+
## You are HAI, a specialized expert in [DOMAIN] with deep knowledge of [TOOLING/SUBDOMAINS].
27+
28+
## [DOMAIN]-Specific Guidelines
29+
30+
### 1. [Thematic Group Title]
31+
32+
Content, code blocks, rationale, and rules here.
33+
34+
### 2. [Next Area of Concern]
35+
36+
Repeat with clarity.
37+
...
38+
39+
### X. [CI/CD | Security | Best Practices]
40+
41+
Close with extensibility and enforcement sections.
42+
```
43+
44+
**Keep it consistent across personas:**
45+
46+
- Always start with a role declaration
47+
- Always follow with a domain-specific guidelines heading
48+
- Break content into clearly scoped thematic sections
49+
- Use markdown + code fences to support syntax highlighting
50+
- Highlight both "How" and "Why"
51+
52+
---
53+
54+
## 🏗️ 2. Before You Begin
55+
56+
**Ask These Questions:**
57+
58+
| Question | Purpose |
59+
| ----------------------------------------------- | ----------------------------------------- |
60+
| What persona am I writing as? | DevOps expert, React guru, etc. |
61+
| Who is the target reader? | Beginner? Intermediate? Contributor? LLM? |
62+
| What are the core pillars of this domain? | Structure, testing, versioning, etc. |
63+
| What tools or frameworks dominate this space? | e.g., Next.js, Terraform, Playwright |
64+
| What is considered bad practice in this domain? | Helps define the edges of expertise |
65+
| How can I include reusable code patterns? | Makes doc practical and referenceable |
66+
67+
---
68+
69+
## 🧠 3. What Makes It Expert-Level
70+
71+
| Trait | Description |
72+
| -------------------- | ----------------------------------------------------------- |
73+
| Opinionated | Don’t be afraid to prescribe best practices. Experts guide. |
74+
| Battle-Tested Advice | Include guidance reflecting real-world scenarios. |
75+
| Code-First | Add idiomatic examples with syntax and patterns. |
76+
| Explains Trade-offs | Prefer “X over Y because…” vs simply “use X”. |
77+
| Modular | Sections should be pluggable, referenceable, and swappable. |
78+
| LLM-Friendly | Structured, token-efficient, chunkable. |
79+
80+
---
81+
82+
## ✍️ 4. Writing Checklist
83+
84+
Use this as a repeatable checklist:
85+
86+
**Role Setup**
87+
88+
- Name the expert clearly.
89+
- Define the domain explicitly.
90+
- Mention specializations.
91+
92+
**Core Sections (pick and tailor)**
93+
94+
- Project Structure
95+
- Setup & Initialization
96+
- Configuration Management
97+
- CI/CD Integration
98+
- Security Guidelines
99+
- Testing Methodologies
100+
- Environment Handling (Dev/Staging/Prod)
101+
- Versioning & Upgrade Strategies
102+
- Deployment or Scaling Patterns
103+
- Common Pitfalls / Anti-Patterns
104+
- Performance Best Practices
105+
- Observability & Logging
106+
107+
**Content Style**
108+
109+
- Context or explanation for every code block.
110+
- Instructions with action verbs.
111+
- Consistent terminology.
112+
- Links to RFCs, standards, or docs.
113+
114+
---
115+
116+
## ⚙️ 5. Format Guidelines
117+
118+
| Element | Usage |
119+
| -------------- | -------------------------------------------------- |
120+
| ## | Top-level role or section headers |
121+
| ### | Subsections by theme |
122+
| ```language | Always use language tags (e.g., lua, go, ts, bash) |
123+
| ✅ / ⚠️ / ❌ | Use emojis sparingly for clarity |
124+
| Tables | For comparisons, options, trade-offs |
125+
| Bullet Lists | When ordering is irrelevant |
126+
| Numbered Lists | When process/order matters |
127+
128+
---
129+
130+
## 🧬 6. Reusability for LLMs & Knowledge Graphs
131+
132+
To make the docs ready for automation:
133+
134+
- Ensure each section is self-contained
135+
- Use consistent headings for chunking
136+
- Minimize overly verbose narrative — clarity wins
137+
- Prefer `term: definition` format for glossary-type items
138+
- Group example-first where possible
139+
140+
---
141+
142+
## 🧪 7. Example Meta Templates
143+
144+
Example role primers:
145+
146+
```markdown
147+
## You are HAI, a DevOps Reliability Expert specializing in Kubernetes-based microservice deployments at scale on AWS and GCP.
148+
149+
## DevOps-Specific Guidelines
150+
151+
### 1. Cluster Configuration
152+
153+
...
154+
155+
### 2. Autoscaling & Cost Controls
156+
157+
...
158+
```
159+
160+
```markdown
161+
## You are HAI, an LLM Product Engineer focused on Retrieval-Augmented Generation pipelines using LangChain, Weaviate, and OpenAI APIs.
162+
163+
## LLM Engineering Guidelines
164+
165+
### 1. Chunking & Indexing Strategies
166+
167+
...
168+
169+
### 2. Prompt Engineering Principles
170+
171+
...
172+
```
173+
174+
---
175+
176+
## 🧭 8. Final Tips
177+
178+
- Start with a skeleton using the checklist above
179+
- Avoid repeating generalities — focus on sharp, unique knowledge
180+
- Think of each section as a “tile” of expertise — someone should be able to take just one tile and apply it
181+
- Think in terms of portable intelligence, not just documentation
182+
183+
Now that you know how to write an expert, why not contribute? Please refer to the below guide to contribute to HAI.
184+
185+
---
186+
187+
## 🤝 How to Contribute Experts to the GitHub Repository
188+
189+
**1. Clone the Repository**
190+
191+
Start by cloning the repository to your local machine:
192+
193+
```bash
194+
git clone https://github.com/presidio-oss/cline-based-code-generator
195+
```
196+
197+
**2. Navigate to the Experts Directory**
198+
199+
Once you've cloned the repository, navigate to the src/experts directory:
200+
201+
```bash
202+
cd src/experts
203+
```
204+
205+
**3. Create Your Own Expert Folder**
206+
207+
Each expert should have its own dedicated folder. The folder name should match the name of the expert. For example, if you're contributing a Golang expert, create a folder called golang.
208+
209+
Inside this folder, create two files:
210+
211+
- prompt.md: The content file that will contain the instructions or prompt for the expert.
212+
213+
- icon.svg: The SVG icon that represents the expert. Make sure to keep the icon file small and optimized for use in the UI.
214+
215+
Example folder structure:
216+
217+
```plaintext
218+
src/experts/
219+
├── golang/
220+
│ ├── prompt.md
221+
│ └── icon.svg
222+
└── ...
223+
```
224+
225+
**4. Create an Issue**
226+
227+
Before submitting your contribution, create an issue to track the addition of the new expert. The issue format should be as follows:
228+
229+
- Format: `[Expert]: Expert Name`
230+
- Example: `[Expert]: Golang`
231+
232+
Make sure to tag the issue with the Expert label for easy identification.
233+
234+
**5. Raise a Pull Request**
235+
236+
After you've made your changes, raise a pull request (PR) to merge your contributions into the main repository.
237+
238+
When creating the pull request, please follow these standards:
239+
240+
- Pull Request Title Format: `[Experts]: Expert Name expert`
241+
- Example: `[Experts]: Golang expert`
242+
- Link the Pull Request with the Issue: Make sure to link the pull request to the issue you created earlier. This helps in tracking the progress of the contribution and ensures the expert is properly documented and tracked.
243+
244+
**6. Review and Merge**
245+
Once your PR is raised, we will review your contribution. If everything is in order, it will be merged into the repository. If there are any issues, we will provide feedback to help you get your contribution ready for merging.
246+
247+
**Thank You!**

docs/extended-feature-set/experts.mdx

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
---
2+
title: "Experts"
3+
description: "Learn how Experts help tailor the HAI Code Generator with domain-specific context for smarter, more accurate code generation."
4+
---
5+
6+
### 🤔 1. What are Experts?
7+
8+
Experts are like smart guides for the code generator—they help it focus on specific tech stacks or domain-specific knowledge the LLM may not know on its own.
9+
10+
### 💡 2. Why do you need an Expert?
11+
12+
Imagine this: you’ve got custom UI components or internal libraries with secret documentation.
13+
14+
The LLM? It’s smart, but it doesn’t know your internal playbook.
15+
16+
Experts bring that knowledge into the loop, so your code gen becomes context-aware and more accurate.
17+
18+
### 🛠️ 3. Built-in Experts
19+
20+
We’ve bundled in 4 ready-to-go experts:
21+
22+
- ✅ .NET
23+
- ✅ Terraform
24+
- ✅ Node.js
25+
- ✅ Go
26+
27+
Each comes with predefined best practices & usage guidelines.
28+
29+
> 📚 **Note:** These are currently read-only.
30+
31+
### ✍️ 4. Can I create my own Expert?
32+
33+
Yes, you can! 🙌
34+
35+
Here’s how it works:
36+
37+
- 📝 Define your own custom guidelines
38+
- 🔗 Add up to 3 document links as references
39+
- 📥 We scrape those URLs and convert the content to markdown
40+
- 🧠 LLM uses both the guidelines + docs for code generation
41+
42+
> **Result?** A highly tailored, smart assistant.
43+
44+
### ⚙️ 5. How does it work under the hood?
45+
46+
When you select an Expert, the system sends:
47+
48+
- The guidelines
49+
- The scraped doc content
50+
51+
...to the LLM, giving it the context it needs to generate better code.
52+
53+
### 🚧 6. Current Limitations
54+
55+
- 📄 Only 3 documents can be uploaded right now
56+
- 🌐 Large URLs may not be fully processed
57+
58+
### 🔍 7. Are we solving this?
59+
60+
Yes! We're actively exploring:
61+
62+
- Smarter ways to index and chunk content
63+
- Reducing noise while keeping the useful stuff
64+
65+
### 🧪 8. How we handle doc content?
66+
67+
We tested two approaches:
68+
69+
#### 📄 Raw Scraped Content
70+
71+
**Pros:**
72+
73+
- Full fidelity
74+
75+
**Cons:**
76+
77+
- Too much info = LLM overwhelm
78+
- Higher chance of hitting token limits
79+
80+
#### ✂️ Summarized via LLM (Current Approach)
81+
82+
**Pros:**
83+
84+
- Clean, focused content
85+
- Smaller token usage
86+
87+
**Cons:**
88+
89+
- Might skip minor details
90+
91+
> ⚖️ **Trade-off:** Better performance with most important info kept intact.
92+
93+
### 📄 9. Expert Guidelines
94+
95+
Looking to define your own expert? Check out the [Experts Guidelines](../../experts-guidelines.mdx) file.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
title: "File Identification"
3+
description: "Intelligently identify and retrieve relevant files using task-based discovery, contextual comments, and vector-powered indexing."
4+
---
5+
6+
### 🔍 File Identification
7+
8+
Elevate your workflow with **intelligent file discovery and retrieval**, designed to help you quickly locate, understand, and act on the right files — even in large codebases.
9+
10+
<div align="center">
11+
<img src="assets/gifs/find-files.gif" alt="File Identification" />
12+
<p>
13+
<i>File Identification</i>
14+
</p>
15+
</div>
16+
17+
---
18+
19+
#### 🧠 Task-Based File Discovery
20+
21+
Redefine how you manage code assets through **Task-Based File Discovery**, which combines intelligent analysis with context-aware tools:
22+
23+
- **🗒️ Contextual Code Comments**
24+
25+
- Automatically generate insightful, contextual comments for every identified file.
26+
- Comments are stored in a dedicated folder, keeping your code clean while maintaining full traceability.
27+
28+
- **📚 Faiss DB Indexing**
29+
- Built on the powerful **Faiss** vector search engine for lightning-fast and accurate file retrieval.
30+
- Scales effortlessly across large repositories, making file identification reliable even in complex projects.
31+
32+
Together, these tools create a **smart and contextual system** for navigating your codebase — transforming file identification from a bottleneck into a breeze.
33+
34+
🔎 With HAI, finding the right file is no longer a challenge — it's a feature.

0 commit comments

Comments
 (0)