{"id":49549173,"url":"https://github.com/adityajhakumar/agentic_techfile","last_synced_at":"2026-05-02T21:04:50.392Z","repository":{"id":312836821,"uuid":"1048935260","full_name":"adityajhakumar/agentic_techfile","owner":"adityajhakumar","description":null,"archived":false,"fork":false,"pushed_at":"2025-09-02T09:51:06.000Z","size":26,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-02T10:27:14.804Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adityajhakumar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-02T08:43:35.000Z","updated_at":"2025-09-02T09:51:09.000Z","dependencies_parsed_at":"2025-09-02T10:27:16.847Z","dependency_job_id":"ada800e2-32d4-4d25-bacd-e6623b5451fd","html_url":"https://github.com/adityajhakumar/agentic_techfile","commit_stats":null,"previous_names":["adityajhakumar/agentic_techfile"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/adityajhakumar/agentic_techfile","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adityajhakumar%2Fagentic_techfile","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adityajhakumar%2Fagentic_techfile/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adityajhakumar%2Fagentic_techfile/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adityajhakumar%2Fagentic_techfile/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adityajhakumar","download_url":"https://codeload.github.com/adityajhakumar/agentic_techfile/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adityajhakumar%2Fagentic_techfile/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32549393,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-02T19:18:06.202Z","status":"ssl_error","status_checked_at":"2026-05-02T19:16:21.335Z","response_time":132,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-05-02T21:04:49.565Z","updated_at":"2026-05-02T21:04:50.387Z","avatar_url":"https://github.com/adityajhakumar.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# 📘 README — Autonomous AI Agent for Ruby Techfile Automation (Electronics Engineer Friendly)\n\n---\n\n## 🔹 1. Why We Need This\n\nIn chip design and semiconductor industries, you often have:\n\n* Hundreds of **Ruby files** in a Linux folder, each describing **materials, metals, or layers**.\n* A **techfile** must be generated (can be 11,000–12,000 lines long).\n* If even one **metal definition is missing**, the techfile build fails.\n\n👉 Instead of engineers manually hunting down missing files, we use an **AI agent** to:\n\n1. Detect missing definitions.\n2. Generate the missing Ruby files automatically.\n3. Validate correctness.\n4. Build a correct techfile.\n\n---\n\n## 🔹 2. What the Agent Will Do (Workflow in Simple Words)\n\nImagine the agent as a **robot assistant** in your Linux VM:\n\n1. **Look around** the folder (scan all Ruby and text files).\n2. **Take a handful** (5–10 files at a time → called a “chunk”).\n3. **Ask the AI model**:\n\n   * “Are any materials/metals missing here?”\n   * If yes → generate the missing file(s).\n   * If no → move to the next chunk.\n4. **Make a safe copy** (backup) of any file before editing.\n5. **Apply the changes** suggested by the AI.\n6. **Check correctness**:\n\n   * Run Ruby syntax check.\n   * Run the internal script that builds the techfile.\n7. **If it fails** → AI tries again (up to 3 retries).\n8. **If it works** → Save results in a log file + keep the backup.\n\n---\n\n## 🔹 3. Workflow Flowchart\n\n```\n[Start]\n   |\n   v\n[Scan all Ruby files in folder]\n   |\n   v\n[Split into chunks of 5-10 files]\n   |\n   v\n[For each chunk --\u003e Send to AI model]\n   |\n   +----\u003e [AI says \"Nothing missing\"] ---\u003e [Move to next chunk]\n   |\n   +----\u003e [AI finds \"Missing metal\"] ---\u003e [Generate patch file]\n                                               |\n                                               v\n                                   [Backup old file before editing]\n                                               |\n                                               v\n                                    [Write new Ruby file(s) into folder]\n                                               |\n                                               v\n                               [Run validator: ruby -c + techfile build]\n                                               |\n              +--------------------------------+--------------------------+\n              |                                                               |\n              v                                                               v\n     [Validation PASSED]                                          [Validation FAILED]\n              |                                                               |\n              v                                                               v\n [Mark chunk completed, continue]                              [Retry (max 3 times)]\n              |                                                               |\n              v                                                               v\n        [Final Techfile OK]                                       [Escalate to engineer]\n              |\n              v\n             [End]\n```\n\n---\n\n## 🔹 4. Step-by-Step Instructions (Linux Only, No GitHub)\n\n### Step 1 — Prepare Environment\n\nRun these once inside your VM:\n\n```bash\n# Create work directories\nmkdir -p /opt/ai-agent/repo\nmkdir -p /opt/ai-agent/backups\nmkdir -p /opt/ai-agent/logs\n\n# Ensure Ruby is installed\nruby -v\n\n# Optional: Install linter\ngem install rubocop\n```\n\nPlace your **Ruby + text files** into `/opt/ai-agent/repo/`.\n\n---\n\n### Step 2 — Scanning and Chunking\n\nThe agent will:\n\n* **Scan** all `.rb` files.\n* Group them into **chunks of 5–10 files**.\n\nExample Linux command to list Ruby files:\n\n```bash\ncd /opt/ai-agent/repo\nfind . -name \"*.rb\"\n```\n\n---\n\n### Step 3 — AI Model Processing\n\n* Send each chunk to the **AI model (Qwen3-Coder, Mistral, DeepSeek, etc.)**.\n* The model checks for missing metal/material definitions.\n* If missing → it generates new Ruby files like:\n\n```ruby\n# materials/metal_m3.rb\nMaterial.define :M3 do\n  name \"Metal 3\"\n  layer :m3\n  thickness_um 0.5\n  conductivity 1.2\n  description \"Auto-generated by AI\"\nend\n```\n\n---\n\n### Step 4 — Safe File Updates\n\nBefore writing any changes:\n\n```bash\ncp path/to/file.rb /opt/ai-agent/backups/file.rb.bak\n```\n\nThen replace with AI-generated file.\n\n---\n\n### Step 5 — Validation\n\nRun checks:\n\n```bash\n# Syntax check\nruby -c path/to/modified.rb\n\n# Full repo check\nfind . -name \"*.rb\" -exec ruby -c {} \\;\n\n# Try to build techfile\n./generate_techfile.sh --output /opt/ai-agent/logs/techfile.out\n```\n\nIf error → AI retries up to 3 times.\n\nIf still failing → stop and engineer checks logs in `/opt/ai-agent/logs/`.\n\n---\n\n### Step 6 — Logs \u0026 Rollback\n\nAll logs go into:\n\n```\n/opt/ai-agent/logs/run-YYYYMMDD-HHMM.log\n```\n\nIf something goes wrong:\n\n```bash\ncp /opt/ai-agent/backups/file.rb.bak /opt/ai-agent/repo/file.rb\n```\n\n---\n\n## 🔹 5. Handling **If–Else Scenarios** (Error Handling)\n\n* **If AI output is invalid JSON →** discard, retry once.\n* **If file already exists →** create a backup first.\n* **If syntax check fails →** rollback file, retry AI fix.\n* **If techfile build fails →** retry up to 3 times.\n* **If all retries fail →** stop, alert engineer.\n* **If validation passes →** accept file, mark success.\n\n---\n\n## 🔹 6. Fine-Tuning an Open-Source AI Model (For Electronics Engineers)\n\nIf you want to train your **own AI model** (e.g., Mistral, DeepSeek, LLaMA, etc.), here’s the **plain-English process**:\n\n### Step 1 — Collect Data\n\n* Gather **Ruby files + techfiles** from past projects.\n* Also collect **examples of mistakes and their fixes** (before + after).\n* Store them in folders like:\n\n  ```\n  dataset/\n    correct_examples/\n    incorrect_examples/\n    fixes/\n  ```\n\n---\n\n### Step 2 — Clean and Label\n\n* Remove sensitive info (company secrets).\n* Create **input → output pairs**:\n\n  * Input: broken Ruby files.\n  * Output: fixed Ruby files or patches.\n\nStore in JSONL format (one example per line):\n\n```json\n{\"input\": \"File missing METAL_M3\", \"output\": \"Add file metal_m3.rb with correct Material.define block\"}\n```\n\n---\n\n### Step 3 — Choose a Base Model\n\nPick an **open-source code model**:\n\n* **Mistral** (good balance, 7B or 8x7B).\n* **DeepSeek Coder** (powerful, optimized for code).\n* **Qwen Coder** (already specialized for code repos).\n\n---\n\n### Step 4 — Fine-Tuning Process\n\nRun inside Linux with GPUs:\n\n1. **Install framework**:\n\n   ```bash\n   pip install transformers datasets peft\n   ```\n2. **Prepare dataset** (JSONL).\n3. **Run LoRA fine-tuning** (parameter-efficient training). Example command:\n\n   ```bash\n   python train.py \\\n       --model mistral-7b \\\n       --data dataset/ \\\n       --output fine_tuned_model/\n   ```\n4. After training, test with your repo files.\n\n---\n\n### Step 5 — Deployment\n\n* Copy fine-tuned model into VM.\n* Replace calls to Qwen with your fine-tuned model.\n* Same workflow applies: chunk files → detect → patch → validate.\n\n---\n\n## 🔹 7. Key Notes for Electronics Engineers\n\n* Think of AI as a **junior engineer**: it suggests fixes, but you always keep backups.\n* The **agent is not GitHub** → it only edits local Linux files.\n* Validation (syntax + build) is **your safety net**.\n* Fine-tuning makes the AI **better at your company’s specific style** of Ruby files and techfiles.\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadityajhakumar%2Fagentic_techfile","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadityajhakumar%2Fagentic_techfile","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadityajhakumar%2Fagentic_techfile/lists"}