Skip to content

Instantly share code, notes, and snippets.

View vgrichina's full-sized avatar

Vladimir Grichina vgrichina

View GitHub Profile
@vgrichina
vgrichina / README.md
Last active June 5, 2025 09:37
AI Agent Design

AI Code Agent

A lightweight, Node.js-based AI agent for code generation and project management, similar to Aider. It integrates with Git, supports a CLI with autocompletion, a rich web UI with visual commands, and fully configurable LLM prompts stored in separate .txt files. Every code change is automatically committed with the prompt included, with support for managing context, undoing changes, running tests, and copying context to the clipboard.

Features

  • CLI Interface: Interactive terminal with @ file autocompletion, / commands, ! or /run for shell commands, and ? for questions.
  • Web UI: Browser-based interface with visual buttons for all slash commands, input fields, diffs, commit history, and context management.
  • Git Integration: Automatically commits code changes with prompts included; supports /undo for reverting.
  • LLM-Powered: Uses an LLM (e.g., xAI's Grok API) to generate code and answers, with dynamic file context via /add and /drop.
  • Test & Fix: Run
@vgrichina
vgrichina / vibec.md
Last active March 20, 2025 08:50
vibec.md

Vibe Compiler (vibec)

A self-compiling tool to process vibe-coded projects using prompt stacks and LLM generation.

Overview

vibec transforms stacks of prompts into code and tests, supporting static .md and dynamic .js plugins. It outputs staged artifacts (output/stages/) for Git history and a current runtime version (output/current/) aggregated from all stages with a "Last-Wins" strategy. It can compile itself using its own structure.

Project Structure

@vgrichina
vgrichina / minimal-ai-coder.md
Last active March 18, 2025 02:59
minimal-ai-coder.md

Minimalistic AI Coding Assistant

1. ./context - Code Context Generator

Purpose

Generate contextual information from a codebase to send to an LLM.

Arguments

--files=<pattern>        File pattern to include (e.g., "src/*.js")
select
format_timestamp('%m/%d/%Y %H:%M:%S', timestamp_millis(div(block_timestamp, 1000000))) as `Date`,
parse_bignumeric(json_value(args, '$.deposit')) / POW(cast(10 as bignumeric), 24) as `Sent Quantity`,
'NEAR' as `Sent Currency`
, receipt_predecessor_account_id
, receipt_receiver_account_id
from `bigquery-public-data.crypto_near_mainnet_us.receipt_actions`
where receipt_predecessor_account_id in
(
'vlad.near',
@vgrichina
vgrichina / parse-json.c
Last active December 5, 2022 06:49
chatGPT parse json lazy
// Tokenize the JSON string by splitting on `{`, `}`, `[`, and `]`, unless the character is inside a string
char* token = strtok(jsonCopy, "{}[],");
bool inString = false;
int depth = 0;
while (token != NULL) {
if (!inString && depth == 0 && strcmp(token, path) == 0) {
// The requested path was found, so return the next token as the value
token = strtok(NULL, "{}[],");
slice_t value = {
.len = strlen(token),
@vgrichina
vgrichina / web4-min.zig
Last active March 15, 2024 00:20
Minimalistic Web4 demo using Zig language
const std = @import("std");
// NOTE: In smart contract context don't really have to free memory before execution ends
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
var allocator = arena.allocator();
// Import host functions provided by NEAR runtime.
// See https://github.com/near/near-sdk-rs/blob/78c16447486285fd952765ef3e727e16d6c8c867/near-sdk/src/environment/env.rs#L117
extern fn input(register_id: u64) void;
extern fn read_register(register_id: u64, ptr: u64) void;
select
to_timestamp(receipt_included_in_block_timestamp / 1000000000) as timestamp,
(args->>'deposit')::numeric / (10 ^ 24) as deposit,
receipt_predecessor_account_id
from action_receipt_actions
where receipt_receiver_account_id = 'root.near'
and receipt_predecessor_account_id != 'system'
@vgrichina
vgrichina / index.html
Last active April 5, 2021 00:20
libp2p pubsub web demo
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>js-libp2p parcel.js browser example</title>
</head>
<body>
@vgrichina
vgrichina / set-contract-to-deploy.md
Created June 18, 2020 22:28
How to deploy contract from AssemblyScript

You can do following to allow passing blob into contract without a lot of overhead:

export function setContractToDeploy(): void {
     env.input(0);
     util.read_register(0);
     // ...
}
async function deploy(options) {
const configPath = process.cwd() + '/src/config';
const config = require(configPath)(process.env.NODE_ENV || 'development');
const near = await nearlib.connect({...config, deps: { keyStore: new UnencryptedFileSystemKeyStore('./neardev') } });
const contractData = [...fs.readFileSync(options.wasmFile)];
const account = await near.account(options.accountId);
await account.signAndSendTransaction(options.accountId, [
deployContract(contractData),
// TODO: Use whatever actual params need to be for functionCall or include any other actions as well